Completed
Push — develop ( 330709...9bd6be )
by Zack
59:58 queued 40:04
created
includes/extensions/edit-entry/class-edit-entry-render.php 1 patch
Spacing   +227 added lines, -227 removed lines patch added patch discarded remove patch
@@ -106,16 +106,16 @@  discard block
 block discarded – undo
106 106
     function load() {
107 107
 
108 108
         /** @define "GRAVITYVIEW_DIR" "../../../" */
109
-        include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' );
109
+        include_once( GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php' );
110 110
 
111 111
         // Don't display an embedded form when editing an entry
112 112
         add_action( 'wp_head', array( $this, 'prevent_render_form' ) );
113 113
         add_action( 'wp_footer', array( $this, 'prevent_render_form' ) );
114 114
 
115 115
         // Stop Gravity Forms processing what is ours!
116
-        add_filter( 'wp', array( $this, 'prevent_maybe_process_form'), 8 );
116
+        add_filter( 'wp', array( $this, 'prevent_maybe_process_form' ), 8 );
117 117
 
118
-        add_filter( 'gravityview_is_edit_entry', array( $this, 'is_edit_entry') );
118
+        add_filter( 'gravityview_is_edit_entry', array( $this, 'is_edit_entry' ) );
119 119
 
120 120
         add_action( 'gravityview_edit_entry', array( $this, 'init' ) );
121 121
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
         add_filter( 'gform_plupload_settings', array( $this, 'modify_fileupload_settings' ), 10, 3 );
127 127
 
128 128
         // Add fields expected by GFFormDisplay::validate()
129
-        add_filter( 'gform_pre_validation', array( $this, 'gform_pre_validation') );
129
+        add_filter( 'gform_pre_validation', array( $this, 'gform_pre_validation' ) );
130 130
 
131 131
     }
132 132
 
@@ -141,8 +141,8 @@  discard block
 block discarded – undo
141 141
      * @return void
142 142
      */
143 143
     public function prevent_render_form() {
144
-        if( $this->is_edit_entry() ) {
145
-            if( 'wp_head' === current_filter() ) {
144
+        if ( $this->is_edit_entry() ) {
145
+            if ( 'wp_head' === current_filter() ) {
146 146
                 add_filter( 'gform_shortcode_form', '__return_empty_string' );
147 147
             } else {
148 148
                 remove_filter( 'gform_shortcode_form', '__return_empty_string' );
@@ -157,12 +157,12 @@  discard block
 block discarded – undo
157 157
      */
158 158
     public function prevent_maybe_process_form() {
159 159
 
160
-        if( ! empty( $_POST ) ) {
160
+        if ( ! empty( $_POST ) ) {
161 161
 	        do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[prevent_maybe_process_form] $_POSTed data (sanitized): ', esc_html( print_r( $_POST, true ) ) );
162 162
         }
163 163
 
164
-        if( $this->is_edit_entry_submission() ) {
165
-            remove_action( 'wp',  array( 'RGForms', 'maybe_process_form'), 9 );
164
+        if ( $this->is_edit_entry_submission() ) {
165
+            remove_action( 'wp', array( 'RGForms', 'maybe_process_form' ), 9 );
166 166
         }
167 167
     }
168 168
 
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
      */
173 173
     public function is_edit_entry() {
174 174
 
175
-        $is_edit_entry = GravityView_frontend::is_single_entry() && ! empty( $_GET['edit'] );
175
+        $is_edit_entry = GravityView_frontend::is_single_entry() && ! empty( $_GET[ 'edit' ] );
176 176
 
177 177
         return ( $is_edit_entry || $this->is_edit_entry_submission() );
178 178
     }
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 	 * @return boolean
184 184
 	 */
185 185
 	public function is_edit_entry_submission() {
186
-		return !empty( $_POST[ self::$nonce_field ] );
186
+		return ! empty( $_POST[ self::$nonce_field ] );
187 187
 	}
188 188
 
189 189
     /**
@@ -194,15 +194,15 @@  discard block
 block discarded – undo
194 194
 
195 195
 
196 196
         $entries = $gravityview_view->getEntries();
197
-	    self::$original_entry = $entries[0];
198
-	    $this->entry = $entries[0];
197
+	    self::$original_entry = $entries[ 0 ];
198
+	    $this->entry = $entries[ 0 ];
199 199
 
200 200
         self::$original_form = $gravityview_view->getForm();
201 201
         $this->form = $gravityview_view->getForm();
202 202
         $this->form_id = $gravityview_view->getFormId();
203 203
         $this->view_id = $gravityview_view->getViewId();
204 204
 
205
-        self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry['id'] );
205
+        self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry[ 'id' ] );
206 206
     }
207 207
 
208 208
 
@@ -222,14 +222,14 @@  discard block
 block discarded – undo
222 222
         $this->setup_vars();
223 223
 
224 224
         // Multiple Views embedded, don't proceed if nonce fails
225
-        if( $gv_data->has_multiple_views() && ! wp_verify_nonce( $_GET['edit'], self::$nonce_key ) ) {
226
-            do_action('gravityview_log_error', __METHOD__ . ': Nonce validation failed for the Edit Entry request; returning' );
225
+        if ( $gv_data->has_multiple_views() && ! wp_verify_nonce( $_GET[ 'edit' ], self::$nonce_key ) ) {
226
+            do_action( 'gravityview_log_error', __METHOD__ . ': Nonce validation failed for the Edit Entry request; returning' );
227 227
             return;
228 228
         }
229 229
 
230 230
         // Sorry, you're not allowed here.
231
-        if( false === $this->user_can_edit_entry( true ) ) {
232
-            do_action('gravityview_log_error', __METHOD__ . ': User is not allowed to edit this entry; returning', $this->entry );
231
+        if ( false === $this->user_can_edit_entry( true ) ) {
232
+            do_action( 'gravityview_log_error', __METHOD__ . ': User is not allowed to edit this entry; returning', $this->entry );
233 233
             return;
234 234
         }
235 235
 
@@ -249,9 +249,9 @@  discard block
 block discarded – undo
249 249
     private function print_scripts() {
250 250
         $gravityview_view = GravityView_View::getInstance();
251 251
 
252
-        wp_register_script( 'gform_gravityforms', GFCommon::get_base_url().'/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) );
252
+        wp_register_script( 'gform_gravityforms', GFCommon::get_base_url() . '/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) );
253 253
 
254
-        GFFormDisplay::enqueue_form_scripts($gravityview_view->getForm(), false);
254
+        GFFormDisplay::enqueue_form_scripts( $gravityview_view->getForm(), false );
255 255
 
256 256
         // Sack is required for images
257 257
         wp_print_scripts( array( 'sack', 'gform_gravityforms' ) );
@@ -263,32 +263,32 @@  discard block
 block discarded – undo
263 263
      */
264 264
     private function process_save() {
265 265
 
266
-        if( empty( $_POST ) || ! isset( $_POST['lid'] ) ) {
266
+        if ( empty( $_POST ) || ! isset( $_POST[ 'lid' ] ) ) {
267 267
             return;
268 268
         }
269 269
 
270 270
         // Make sure the entry, view, and form IDs are all correct
271 271
         $valid = $this->verify_nonce();
272 272
 
273
-        if( !$valid ) {
274
-            do_action('gravityview_log_error', __METHOD__ . ' Nonce validation failed.' );
273
+        if ( ! $valid ) {
274
+            do_action( 'gravityview_log_error', __METHOD__ . ' Nonce validation failed.' );
275 275
             return;
276 276
         }
277 277
 
278
-        if( $this->entry['id'] !== $_POST['lid'] ) {
279
-            do_action('gravityview_log_error', __METHOD__ . ' Entry ID did not match posted entry ID.' );
278
+        if ( $this->entry[ 'id' ] !== $_POST[ 'lid' ] ) {
279
+            do_action( 'gravityview_log_error', __METHOD__ . ' Entry ID did not match posted entry ID.' );
280 280
             return;
281 281
         }
282 282
 
283
-        do_action('gravityview_log_debug', __METHOD__ . ': $_POSTed data (sanitized): ', esc_html( print_r( $_POST, true ) ) );
283
+        do_action( 'gravityview_log_debug', __METHOD__ . ': $_POSTed data (sanitized): ', esc_html( print_r( $_POST, true ) ) );
284 284
 
285 285
         $this->process_save_process_files( $this->form_id );
286 286
 
287 287
         $this->validate();
288 288
 
289
-        if( $this->is_valid ) {
289
+        if ( $this->is_valid ) {
290 290
 
291
-            do_action('gravityview_log_debug', __METHOD__ . ': Submission is valid.' );
291
+            do_action( 'gravityview_log_debug', __METHOD__ . ': Submission is valid.' );
292 292
 
293 293
             /**
294 294
              * @hack This step is needed to unset the adminOnly from form fields, to add the calculation fields
@@ -298,22 +298,22 @@  discard block
 block discarded – undo
298 298
             /**
299 299
              * @hack to avoid the capability validation of the method save_lead for GF 1.9+
300 300
              */
301
-            unset( $_GET['page'] );
301
+            unset( $_GET[ 'page' ] );
302 302
 
303
-            $date_created = $this->entry['date_created'];
303
+            $date_created = $this->entry[ 'date_created' ];
304 304
 
305 305
             /**
306 306
              * @hack to force Gravity Forms to use $read_value_from_post in GFFormsModel::save_lead()
307 307
              * @since 1.17.2
308 308
              */
309
-            unset( $this->entry['date_created'] );
309
+            unset( $this->entry[ 'date_created' ] );
310 310
 
311 311
             GFFormsModel::save_lead( $form, $this->entry );
312 312
 
313 313
 	        // Delete the values for hidden inputs
314 314
 	        $this->unset_hidden_field_values();
315 315
             
316
-            $this->entry['date_created'] = $date_created;
316
+            $this->entry[ 'date_created' ] = $date_created;
317 317
 
318 318
             // Process calculation fields
319 319
             $this->update_calculation_fields();
@@ -333,10 +333,10 @@  discard block
 block discarded – undo
333 333
              * @param string $entry_id Numeric ID of the entry that was updated
334 334
              * @param GravityView_Edit_Entry_Render $this This object
335 335
              */
336
-            do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry['id'], $this );
336
+            do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry[ 'id' ], $this );
337 337
 
338 338
         } else {
339
-            do_action('gravityview_log_error', __METHOD__ . ': Submission is NOT valid.', $this->entry );
339
+            do_action( 'gravityview_log_error', __METHOD__ . ': Submission is NOT valid.', $this->entry );
340 340
         }
341 341
 
342 342
     } // process_save
@@ -353,8 +353,8 @@  discard block
 block discarded – undo
353 353
     private function unset_hidden_field_values() {
354 354
 	    global $wpdb;
355 355
 
356
-	    $lead_detail_table      = GFFormsModel::get_lead_details_table_name();
357
-	    $current_fields   = $wpdb->get_results( $wpdb->prepare( "SELECT id, field_number FROM $lead_detail_table WHERE lead_id=%d", $this->entry['id'] ) );
356
+	    $lead_detail_table = GFFormsModel::get_lead_details_table_name();
357
+	    $current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT id, field_number FROM $lead_detail_table WHERE lead_id=%d", $this->entry[ 'id' ] ) );
358 358
 
359 359
 	    foreach ( $this->entry as $input_id => $field_value ) {
360 360
 
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
 		}
435 435
 
436 436
 		/** No file is being uploaded. */
437
-		if ( empty( $_FILES[ $input_name ]['name'] ) ) {
437
+		if ( empty( $_FILES[ $input_name ][ 'name' ] ) ) {
438 438
 			/** So return the original upload */
439 439
 			return $entry[ $input_id ];
440 440
 		}
@@ -452,11 +452,11 @@  discard block
 block discarded – undo
452 452
      * @return mixed
453 453
      */
454 454
     public function modify_fileupload_settings( $plupload_init, $form_id, $instance ) {
455
-        if( ! $this->is_edit_entry() ) {
455
+        if ( ! $this->is_edit_entry() ) {
456 456
             return $plupload_init;
457 457
         }
458 458
 
459
-        $plupload_init['gf_vars']['max_files'] = 0;
459
+        $plupload_init[ 'gf_vars' ][ 'max_files' ] = 0;
460 460
 
461 461
         return $plupload_init;
462 462
     }
@@ -471,22 +471,22 @@  discard block
 block discarded – undo
471 471
         $form = $this->form;
472 472
 
473 473
 	    /** @var GF_Field $field */
474
-        foreach( $form['fields'] as $k => &$field ) {
474
+        foreach ( $form[ 'fields' ] as $k => &$field ) {
475 475
 
476 476
             /**
477 477
              * Remove the fields with calculation formulas before save to avoid conflicts with GF logic
478 478
              * @since 1.16.3
479 479
              * @var GF_Field $field
480 480
              */
481
-            if( $field->has_calculation() ) {
482
-                unset( $form['fields'][ $k ] );
481
+            if ( $field->has_calculation() ) {
482
+                unset( $form[ 'fields' ][ $k ] );
483 483
             }
484 484
 
485 485
             $field->adminOnly = false;
486 486
 
487
-            if( isset( $field->inputs ) && is_array( $field->inputs ) ) {
488
-                foreach( $field->inputs as $key => $input ) {
489
-                    $field->inputs[ $key ][ 'id' ] = (string)$input['id'];
487
+            if ( isset( $field->inputs ) && is_array( $field->inputs ) ) {
488
+                foreach ( $field->inputs as $key => $input ) {
489
+                    $field->inputs[ $key ][ 'id' ] = (string)$input[ 'id' ];
490 490
                 }
491 491
             }
492 492
         }
@@ -500,30 +500,30 @@  discard block
 block discarded – undo
500 500
         $update = false;
501 501
 
502 502
         // get the most up to date entry values
503
-        $entry = GFAPI::get_entry( $this->entry['id'] );
503
+        $entry = GFAPI::get_entry( $this->entry[ 'id' ] );
504 504
 
505
-        if( !empty( $this->fields_with_calculation ) ) {
505
+        if ( ! empty( $this->fields_with_calculation ) ) {
506 506
             $update = true;
507 507
             foreach ( $this->fields_with_calculation as $calc_field ) {
508 508
                 $inputs = $calc_field->get_entry_inputs();
509 509
                 if ( is_array( $inputs ) ) {
510 510
                     foreach ( $inputs as $input ) {
511
-                        $input_name = 'input_' . str_replace( '.', '_', $input['id'] );
512
-                        $entry[ strval( $input['id'] ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
511
+                        $input_name = 'input_' . str_replace( '.', '_', $input[ 'id' ] );
512
+                        $entry[ strval( $input[ 'id' ] ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry[ 'id' ], $entry );
513 513
                     }
514 514
                 } else {
515
-                    $input_name = 'input_' . str_replace( '.', '_', $calc_field->id);
516
-                    $entry[ strval( $calc_field->id ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
515
+                    $input_name = 'input_' . str_replace( '.', '_', $calc_field->id );
516
+                    $entry[ strval( $calc_field->id ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry[ 'id' ], $entry );
517 517
                 }
518 518
             }
519 519
 
520 520
         }
521 521
 
522
-        if( $update ) {
522
+        if ( $update ) {
523 523
 
524 524
             $return_entry = GFAPI::update_entry( $entry );
525 525
 
526
-            if( is_wp_error( $return_entry ) ) {
526
+            if ( is_wp_error( $return_entry ) ) {
527 527
                 do_action( 'gravityview_log_error', 'Updating the entry calculation fields failed', $return_entry );
528 528
             } else {
529 529
                 do_action( 'gravityview_log_debug', 'Updating the entry calculation fields succeeded' );
@@ -554,18 +554,18 @@  discard block
 block discarded – undo
554 554
 
555 555
         $input_name = 'input_' . $field_id;
556 556
 
557
-        if ( !empty( $_FILES[ $input_name ]['name'] ) ) {
557
+        if ( ! empty( $_FILES[ $input_name ][ 'name' ] ) ) {
558 558
 
559 559
             // We have a new image
560 560
 
561
-            $value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'] );
561
+            $value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ] );
562 562
 
563 563
             $ary = ! empty( $value ) ? explode( '|:|', $value ) : array();
564 564
             $img_url = rgar( $ary, 0 );
565 565
 
566
-            $img_title       = count( $ary ) > 1 ? $ary[1] : '';
567
-            $img_caption     = count( $ary ) > 2 ? $ary[2] : '';
568
-            $img_description = count( $ary ) > 3 ? $ary[3] : '';
566
+            $img_title       = count( $ary ) > 1 ? $ary[ 1 ] : '';
567
+            $img_caption     = count( $ary ) > 2 ? $ary[ 2 ] : '';
568
+            $img_description = count( $ary ) > 3 ? $ary[ 3 ] : '';
569 569
 
570 570
             $image_meta = array(
571 571
                 'post_excerpt' => $img_caption,
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
 
575 575
             //adding title only if it is not empty. It will default to the file name if it is not in the array
576 576
             if ( ! empty( $img_title ) ) {
577
-                $image_meta['post_title'] = $img_title;
577
+                $image_meta[ 'post_title' ] = $img_title;
578 578
             }
579 579
 
580 580
             /**
@@ -589,22 +589,22 @@  discard block
 block discarded – undo
589 589
                 set_post_thumbnail( $post_id, $media_id );
590 590
             }
591 591
 
592
-        } elseif ( !empty( $_POST[ $input_name ] ) && is_array( $value ) ) {
592
+        } elseif ( ! empty( $_POST[ $input_name ] ) && is_array( $value ) ) {
593 593
 
594 594
             // Same image although the image title, caption or description might have changed
595 595
 
596 596
             $ary = array();
597
-            if( ! empty( $entry[ $field_id ] ) ) {
597
+            if ( ! empty( $entry[ $field_id ] ) ) {
598 598
                 $ary = is_array( $entry[ $field_id ] ) ? $entry[ $field_id ] : explode( '|:|', $entry[ $field_id ] );
599 599
             }
600 600
             $img_url = rgar( $ary, 0 );
601 601
 
602 602
             // is this really the same image or something went wrong ?
603
-            if( $img_url === $_POST[ $input_name ] ) {
603
+            if ( $img_url === $_POST[ $input_name ] ) {
604 604
 
605
-                $img_title       = rgar( $value, $field_id .'.1' );
606
-                $img_caption     = rgar( $value, $field_id .'.4' );
607
-                $img_description = rgar( $value, $field_id .'.7' );
605
+                $img_title       = rgar( $value, $field_id . '.1' );
606
+                $img_caption     = rgar( $value, $field_id . '.4' );
607
+                $img_description = rgar( $value, $field_id . '.7' );
608 608
 
609 609
                 $value = ! empty( $img_url ) ? $img_url . "|:|" . $img_title . "|:|" . $img_caption . "|:|" . $img_description : '';
610 610
 
@@ -644,16 +644,16 @@  discard block
 block discarded – undo
644 644
      */
645 645
     private function maybe_update_post_fields( $form ) {
646 646
 
647
-        if( empty( $this->entry['post_id'] ) ) {
647
+        if ( empty( $this->entry[ 'post_id' ] ) ) {
648 648
 	        do_action( 'gravityview_log_debug', __METHOD__ . ': This entry has no post fields. Continuing...' );
649 649
             return;
650 650
         }
651 651
 
652
-        $post_id = $this->entry['post_id'];
652
+        $post_id = $this->entry[ 'post_id' ];
653 653
 
654 654
         // Security check
655
-        if( false === GVCommon::has_cap( 'edit_post', $post_id ) ) {
656
-            do_action( 'gravityview_log_error', 'The current user does not have the ability to edit Post #'.$post_id );
655
+        if ( false === GVCommon::has_cap( 'edit_post', $post_id ) ) {
656
+            do_action( 'gravityview_log_error', 'The current user does not have the ability to edit Post #' . $post_id );
657 657
             return;
658 658
         }
659 659
 
@@ -665,25 +665,25 @@  discard block
 block discarded – undo
665 665
 
666 666
             $field = RGFormsModel::get_field( $form, $field_id );
667 667
 
668
-            if( ! $field ) {
668
+            if ( ! $field ) {
669 669
                 continue;
670 670
             }
671 671
 
672
-            if( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) {
672
+            if ( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) {
673 673
 
674 674
                 // Get the value of the field, including $_POSTed value
675 675
                 $value = RGFormsModel::get_field_value( $field );
676 676
 
677 677
                 // Use temporary entry variable, to make values available to fill_post_template() and update_post_image()
678 678
                 $entry_tmp = $this->entry;
679
-                $entry_tmp["{$field_id}"] = $value;
679
+                $entry_tmp[ "{$field_id}" ] = $value;
680 680
 
681
-                switch( $field->type ) {
681
+                switch ( $field->type ) {
682 682
 
683 683
                     case 'post_title':
684 684
                         $post_title = $value;
685
-                        if( rgar( $form, 'postTitleTemplateEnabled' ) ) {
686
-                            $post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
685
+                        if ( rgar( $form, 'postTitleTemplateEnabled' ) ) {
686
+                            $post_title = $this->fill_post_template( $form[ 'postTitleTemplate' ], $form, $entry_tmp );
687 687
                         }
688 688
                         $updated_post->post_title = $post_title;
689 689
                         $updated_post->post_name  = $post_title;
@@ -692,8 +692,8 @@  discard block
 block discarded – undo
692 692
 
693 693
                     case 'post_content':
694 694
                         $post_content = $value;
695
-                        if( rgar( $form, 'postContentTemplateEnabled' ) ) {
696
-                            $post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
695
+                        if ( rgar( $form, 'postContentTemplateEnabled' ) ) {
696
+                            $post_content = $this->fill_post_template( $form[ 'postContentTemplate' ], $form, $entry_tmp, true );
697 697
                         }
698 698
                         $updated_post->post_content = $post_content;
699 699
                         unset( $post_content );
@@ -707,12 +707,12 @@  discard block
 block discarded – undo
707 707
                     case 'post_category':
708 708
                         break;
709 709
                     case 'post_custom_field':
710
-                        if( ! empty( $field->customFieldTemplateEnabled ) ) {
710
+                        if ( ! empty( $field->customFieldTemplateEnabled ) ) {
711 711
                             $value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
712 712
                         }
713 713
 
714 714
 	                    if ( $this->is_field_json_encoded( $field ) && ! is_string( $value ) ) {
715
-		                    $value = function_exists('wp_json_encode') ? wp_json_encode( $value ) : json_encode( $value );
715
+		                    $value = function_exists( 'wp_json_encode' ) ? wp_json_encode( $value ) : json_encode( $value );
716 716
 	                    }
717 717
 
718 718
                         update_post_meta( $post_id, $field->postCustomFieldName, $value );
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
                 }
726 726
 
727 727
                 // update entry after
728
-                $this->entry["{$field_id}"] = $value;
728
+                $this->entry[ "{$field_id}" ] = $value;
729 729
 
730 730
                 $update_entry = true;
731 731
 
@@ -734,25 +734,25 @@  discard block
 block discarded – undo
734 734
 
735 735
         }
736 736
 
737
-        if( $update_entry ) {
737
+        if ( $update_entry ) {
738 738
 
739 739
             $return_entry = GFAPI::update_entry( $this->entry );
740 740
 
741
-            if( is_wp_error( $return_entry ) ) {
741
+            if ( is_wp_error( $return_entry ) ) {
742 742
                do_action( 'gravityview_log_error', 'Updating the entry post fields failed', array( '$this->entry' => $this->entry, '$return_entry' => $return_entry ) );
743 743
             } else {
744
-                do_action( 'gravityview_log_debug', 'Updating the entry post fields for post #'.$post_id.' succeeded' );
744
+                do_action( 'gravityview_log_debug', 'Updating the entry post fields for post #' . $post_id . ' succeeded' );
745 745
             }
746 746
 
747 747
         }
748 748
 
749 749
         $return_post = wp_update_post( $updated_post, true );
750 750
 
751
-        if( is_wp_error( $return_post ) ) {
751
+        if ( is_wp_error( $return_post ) ) {
752 752
             $return_post->add_data( $updated_post, '$updated_post' );
753 753
             do_action( 'gravityview_log_error', 'Updating the post content failed', compact( 'updated_post', 'return_post' ) );
754 754
         } else {
755
-            do_action( 'gravityview_log_debug', 'Updating the post content for post #'.$post_id.' succeeded', $updated_post );
755
+            do_action( 'gravityview_log_debug', 'Updating the post content for post #' . $post_id . ' succeeded', $updated_post );
756 756
         }
757 757
     }
758 758
 
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
         $input_type = RGFormsModel::get_input_type( $field );
771 771
 
772 772
 	    // Only certain custom field types are supported
773
-	    switch( $input_type ) {
773
+	    switch ( $input_type ) {
774 774
 		    case 'fileupload':
775 775
 		    case 'list':
776 776
 		    case 'multiselect':
@@ -807,7 +807,7 @@  discard block
 block discarded – undo
807 807
         $output = GFCommon::replace_variables( $output, $form, $entry, false, false, false );
808 808
 
809 809
         // replace conditional shortcodes
810
-        if( $do_shortcode ) {
810
+        if ( $do_shortcode ) {
811 811
             $output = do_shortcode( $output );
812 812
         }
813 813
 
@@ -826,18 +826,18 @@  discard block
 block discarded – undo
826 826
      */
827 827
     private function after_update() {
828 828
 
829
-        do_action( 'gform_after_update_entry', $this->form, $this->entry['id'], self::$original_entry );
830
-        do_action( "gform_after_update_entry_{$this->form['id']}", $this->form, $this->entry['id'], self::$original_entry );
829
+        do_action( 'gform_after_update_entry', $this->form, $this->entry[ 'id' ], self::$original_entry );
830
+        do_action( "gform_after_update_entry_{$this->form[ 'id' ]}", $this->form, $this->entry[ 'id' ], self::$original_entry );
831 831
 
832 832
         // Re-define the entry now that we've updated it.
833
-        $entry = RGFormsModel::get_lead( $this->entry['id'] );
833
+        $entry = RGFormsModel::get_lead( $this->entry[ 'id' ] );
834 834
 
835 835
         $entry = GFFormsModel::set_entry_meta( $entry, $this->form );
836 836
 
837 837
         // We need to clear the cache because Gravity Forms caches the field values, which
838 838
         // we have just updated.
839
-        foreach ($this->form['fields'] as $key => $field) {
840
-            GFFormsModel::refresh_lead_field_value( $entry['id'], $field->id );
839
+        foreach ( $this->form[ 'fields' ] as $key => $field ) {
840
+            GFFormsModel::refresh_lead_field_value( $entry[ 'id' ], $field->id );
841 841
         }
842 842
 
843 843
         $this->entry = $entry;
@@ -855,7 +855,7 @@  discard block
 block discarded – undo
855 855
 
856 856
         <div class="gv-edit-entry-wrapper"><?php
857 857
 
858
-            $javascript = gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/inline-javascript.php', $this );
858
+            $javascript = gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/inline-javascript.php', $this );
859 859
 
860 860
             /**
861 861
              * Fixes weird wpautop() issue
@@ -871,7 +871,7 @@  discard block
 block discarded – undo
871 871
                      * @param string $edit_entry_title Modify the "Edit Entry" title
872 872
                      * @param GravityView_Edit_Entry_Render $this This object
873 873
                      */
874
-                    $edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
874
+                    $edit_entry_title = apply_filters( 'gravityview_edit_entry_title', __( 'Edit Entry', 'gravityview' ), $this );
875 875
 
876 876
                     echo esc_attr( $edit_entry_title );
877 877
             ?></span>
@@ -917,20 +917,20 @@  discard block
 block discarded – undo
917 917
      */
918 918
     private function maybe_print_message() {
919 919
 
920
-        if( rgpost('action') === 'update' ) {
920
+        if ( rgpost( 'action' ) === 'update' ) {
921 921
 
922 922
             $back_link = esc_url( remove_query_arg( array( 'page', 'view', 'edit' ) ) );
923 923
 
924
-            if( ! $this->is_valid ){
924
+            if ( ! $this->is_valid ) {
925 925
 
926 926
                 // Keeping this compatible with Gravity Forms.
927
-                $validation_message = "<div class='validation_error'>" . __('There was a problem with your submission.', 'gravityview') . " " . __('Errors have been highlighted below.', 'gravityview') . "</div>";
928
-                $message = apply_filters("gform_validation_message_{$this->form['id']}", apply_filters("gform_validation_message", $validation_message, $this->form), $this->form);
927
+                $validation_message = "<div class='validation_error'>" . __( 'There was a problem with your submission.', 'gravityview' ) . " " . __( 'Errors have been highlighted below.', 'gravityview' ) . "</div>";
928
+                $message = apply_filters( "gform_validation_message_{$this->form[ 'id' ]}", apply_filters( "gform_validation_message", $validation_message, $this->form ), $this->form );
929 929
 
930
-                echo GVCommon::generate_notice( $message , 'gv-error' );
930
+                echo GVCommon::generate_notice( $message, 'gv-error' );
931 931
 
932 932
             } else {
933
-                $entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturn to Entry%s', 'gravityview'), '<a href="'. $back_link .'">', '</a>' );
933
+                $entry_updated_message = sprintf( esc_attr__( 'Entry Updated. %sReturn to Entry%s', 'gravityview' ), '<a href="' . $back_link . '">', '</a>' );
934 934
 
935 935
                 /**
936 936
                  * @filter `gravityview/edit_entry/success` Modify the edit entry success message (including the anchor link)
@@ -940,7 +940,7 @@  discard block
 block discarded – undo
940 940
                  * @param array $entry Gravity Forms entry array
941 941
                  * @param string $back_link URL to return to the original entry. @since 1.6
942 942
                  */
943
-                $message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message , $this->view_id, $this->entry, $back_link );
943
+                $message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message, $this->view_id, $this->entry, $back_link );
944 944
 
945 945
                 echo GVCommon::generate_notice( $message );
946 946
             }
@@ -964,21 +964,21 @@  discard block
 block discarded – undo
964 964
          */
965 965
         do_action( 'gravityview/edit-entry/render/before', $this );
966 966
 
967
-        add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields'), 5000, 3 );
968
-        add_filter( 'gform_submit_button', array( $this, 'render_form_buttons') );
967
+        add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000, 3 );
968
+        add_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) );
969 969
         add_filter( 'gform_disable_view_counter', '__return_true' );
970 970
 
971 971
         add_filter( 'gform_field_input', array( $this, 'verify_user_can_edit_post' ), 5, 5 );
972 972
         add_filter( 'gform_field_input', array( $this, 'modify_edit_field_input' ), 10, 5 );
973 973
 
974 974
         // We need to remove the fake $_GET['page'] arg to avoid rendering form as if in admin.
975
-        unset( $_GET['page'] );
975
+        unset( $_GET[ 'page' ] );
976 976
 
977 977
         // TODO: Verify multiple-page forms
978 978
 
979 979
         ob_start(); // Prevent PHP warnings possibly caused by prefilling list fields for conditional logic
980 980
 
981
-        $html = GFFormDisplay::get_form( $this->form['id'], false, false, true, $this->entry );
981
+        $html = GFFormDisplay::get_form( $this->form[ 'id' ], false, false, true, $this->entry );
982 982
 
983 983
         ob_get_clean();
984 984
 
@@ -1004,7 +1004,7 @@  discard block
 block discarded – undo
1004 1004
      * @return string
1005 1005
      */
1006 1006
     public function render_form_buttons() {
1007
-        return gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/form-buttons.php', $this );
1007
+        return gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/form-buttons.php', $this );
1008 1008
     }
1009 1009
 
1010 1010
 
@@ -1024,10 +1024,10 @@  discard block
 block discarded – undo
1024 1024
     public function filter_modify_form_fields( $form, $ajax = false, $field_values = '' ) {
1025 1025
 
1026 1026
         // In case we have validated the form, use it to inject the validation results into the form render
1027
-        if( isset( $this->form_after_validation ) ) {
1027
+        if ( isset( $this->form_after_validation ) ) {
1028 1028
             $form = $this->form_after_validation;
1029 1029
         } else {
1030
-            $form['fields'] = $this->get_configured_edit_fields( $form, $this->view_id );
1030
+            $form[ 'fields' ] = $this->get_configured_edit_fields( $form, $this->view_id );
1031 1031
         }
1032 1032
 
1033 1033
         $form = $this->filter_conditional_logic( $form );
@@ -1035,8 +1035,8 @@  discard block
 block discarded – undo
1035 1035
         $form = $this->prefill_conditional_logic( $form );
1036 1036
 
1037 1037
         // for now we don't support Save and Continue feature.
1038
-        if( ! self::$supports_save_and_continue ) {
1039
-	        unset( $form['save'] );
1038
+        if ( ! self::$supports_save_and_continue ) {
1039
+	        unset( $form[ 'save' ] );
1040 1040
         }
1041 1041
 
1042 1042
         return $form;
@@ -1057,29 +1057,29 @@  discard block
 block discarded – undo
1057 1057
      */
1058 1058
     public function verify_user_can_edit_post( $field_content = '', $field, $value, $lead_id = 0, $form_id ) {
1059 1059
 
1060
-        if( GFCommon::is_post_field( $field ) ) {
1060
+        if ( GFCommon::is_post_field( $field ) ) {
1061 1061
 
1062 1062
             $message = null;
1063 1063
 
1064 1064
             // First, make sure they have the capability to edit the post.
1065
-            if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) {
1065
+            if ( false === current_user_can( 'edit_post', $this->entry[ 'post_id' ] ) ) {
1066 1066
 
1067 1067
                 /**
1068 1068
                  * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post
1069 1069
                  * @param string $message The existing "You don't have permission..." text
1070 1070
                  */
1071
-                $message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don&rsquo;t have permission to edit this post.', 'gravityview') );
1071
+                $message = apply_filters( 'gravityview/edit_entry/unsupported_post_field_text', __( 'You don&rsquo;t have permission to edit this post.', 'gravityview' ) );
1072 1072
 
1073
-            } elseif( null === get_post( $this->entry['post_id'] ) ) {
1073
+            } elseif ( null === get_post( $this->entry[ 'post_id' ] ) ) {
1074 1074
                 /**
1075 1075
                  * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists
1076 1076
                  * @param string $message The existing "This field is not editable; the post no longer exists." text
1077 1077
                  */
1078
-                $message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) );
1078
+                $message = apply_filters( 'gravityview/edit_entry/no_post_text', __( 'This field is not editable; the post no longer exists.', 'gravityview' ) );
1079 1079
             }
1080 1080
 
1081
-            if( $message ) {
1082
-                $field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1081
+            if ( $message ) {
1082
+                $field_content = sprintf( '<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1083 1083
             }
1084 1084
         }
1085 1085
 
@@ -1104,8 +1104,8 @@  discard block
 block discarded – undo
1104 1104
 
1105 1105
         // If the form has been submitted, then we don't need to pre-fill the values,
1106 1106
         // Except for fileupload type and when a field input is overridden- run always!!
1107
-        if(
1108
-            ( $this->is_edit_entry_submission() && !in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
1107
+        if (
1108
+            ( $this->is_edit_entry_submission() && ! in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
1109 1109
             && false === ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) )
1110 1110
             && ! GFCommon::is_product_field( $field->type )
1111 1111
             || ! empty( $field_content )
@@ -1125,7 +1125,7 @@  discard block
 block discarded – undo
1125 1125
 	    $return = null;
1126 1126
 
1127 1127
         /** @var GravityView_Field $gv_field */
1128
-        if( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1128
+        if ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1129 1129
             $return = $gv_field->get_field_input( $this->form, $field_value, $this->entry, $field );
1130 1130
         } else {
1131 1131
 	        $return = $field->get_field_input( $this->form, $field_value, $this->entry );
@@ -1134,7 +1134,7 @@  discard block
 block discarded – undo
1134 1134
 	    // If there was output, it's an error
1135 1135
 	    $warnings = ob_get_clean();
1136 1136
 
1137
-	    if( !empty( $warnings ) ) {
1137
+	    if ( ! empty( $warnings ) ) {
1138 1138
 		    do_action( 'gravityview_log_error', __METHOD__ . $warnings, $field_value );
1139 1139
 	    }
1140 1140
 
@@ -1159,7 +1159,7 @@  discard block
 block discarded – undo
1159 1159
         $override_saved_value = apply_filters( 'gravityview/edit_entry/pre_populate/override', false, $field );
1160 1160
 
1161 1161
         // We're dealing with multiple inputs (e.g. checkbox) but not time or date (as it doesn't store data in input IDs)
1162
-        if( isset( $field->inputs ) && is_array( $field->inputs ) && !in_array( $field->type, array( 'time', 'date' ) ) ) {
1162
+        if ( isset( $field->inputs ) && is_array( $field->inputs ) && ! in_array( $field->type, array( 'time', 'date' ) ) ) {
1163 1163
 
1164 1164
             $field_value = array();
1165 1165
 
@@ -1168,10 +1168,10 @@  discard block
 block discarded – undo
1168 1168
 
1169 1169
             foreach ( (array)$field->inputs as $input ) {
1170 1170
 
1171
-                $input_id = strval( $input['id'] );
1171
+                $input_id = strval( $input[ 'id' ] );
1172 1172
                 
1173 1173
                 if ( isset( $this->entry[ $input_id ] ) && ! gv_empty( $this->entry[ $input_id ], false, false ) ) {
1174
-                    $field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1174
+                    $field_value[ $input_id ] = 'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1175 1175
                     $allow_pre_populated = false;
1176 1176
                 }
1177 1177
 
@@ -1179,7 +1179,7 @@  discard block
 block discarded – undo
1179 1179
 
1180 1180
             $pre_value = $field->get_value_submission( array(), false );
1181 1181
 
1182
-            $field_value = ! $allow_pre_populated && ! ( $override_saved_value && !gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
1182
+            $field_value = ! $allow_pre_populated && ! ( $override_saved_value && ! gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
1183 1183
 
1184 1184
         } else {
1185 1185
 
@@ -1190,13 +1190,13 @@  discard block
 block discarded – undo
1190 1190
 
1191 1191
             // saved field entry value (if empty, fallback to the pre-populated value, if exists)
1192 1192
             // or pre-populated value if not empty and set to override saved value
1193
-            $field_value = !gv_empty( $this->entry[ $id ], false, false ) && ! ( $override_saved_value && !gv_empty( $pre_value, false, false ) ) ? $this->entry[ $id ] : $pre_value;
1193
+            $field_value = ! gv_empty( $this->entry[ $id ], false, false ) && ! ( $override_saved_value && ! gv_empty( $pre_value, false, false ) ) ? $this->entry[ $id ] : $pre_value;
1194 1194
 
1195 1195
             // in case field is post_category but inputType is select, multi-select or radio, convert value into array of category IDs.
1196
-            if ( 'post_category' === $field->type && !gv_empty( $field_value, false, false ) ) {
1196
+            if ( 'post_category' === $field->type && ! gv_empty( $field_value, false, false ) ) {
1197 1197
                 $categories = array();
1198 1198
                 foreach ( explode( ',', $field_value ) as $cat_string ) {
1199
-                    $categories[] = GFCommon::format_post_category( $cat_string, true );
1199
+                    $categories[ ] = GFCommon::format_post_category( $cat_string, true );
1200 1200
                 }
1201 1201
                 $field_value = 'multiselect' === $field->get_input_type() ? $categories : implode( '', $categories );
1202 1202
             }
@@ -1224,7 +1224,7 @@  discard block
 block discarded – undo
1224 1224
 	     * @param GF_Field $field Gravity Forms field object
1225 1225
 	     * @param GravityView_Edit_Entry_Render $this Current object
1226 1226
 	     */
1227
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1227
+	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type, $field_value, $field, $this );
1228 1228
 
1229 1229
         return $field_value;
1230 1230
     }
@@ -1241,12 +1241,12 @@  discard block
 block discarded – undo
1241 1241
      */
1242 1242
     public function gform_pre_validation( $form ) {
1243 1243
 
1244
-        if( ! $this->verify_nonce() ) {
1244
+        if ( ! $this->verify_nonce() ) {
1245 1245
             return $form;
1246 1246
         }
1247 1247
 
1248 1248
         // Fix PHP warning regarding undefined index.
1249
-        foreach ( $form['fields'] as &$field) {
1249
+        foreach ( $form[ 'fields' ] as &$field ) {
1250 1250
 
1251 1251
             // This is because we're doing admin form pretending to be front-end, so Gravity Forms
1252 1252
             // expects certain field array items to be set.
@@ -1254,7 +1254,7 @@  discard block
 block discarded – undo
1254 1254
 	            $field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1255 1255
             }
1256 1256
 
1257
-            switch( RGFormsModel::get_input_type( $field ) ) {
1257
+            switch ( RGFormsModel::get_input_type( $field ) ) {
1258 1258
 
1259 1259
                 /**
1260 1260
                  * 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.
@@ -1268,37 +1268,37 @@  discard block
 block discarded – undo
1268 1268
                     // Set the previous value
1269 1269
                     $entry = $this->get_entry();
1270 1270
 
1271
-                    $input_name = 'input_'.$field->id;
1272
-                    $form_id = $form['id'];
1271
+                    $input_name = 'input_' . $field->id;
1272
+                    $form_id = $form[ 'id' ];
1273 1273
 
1274 1274
                     $value = NULL;
1275 1275
 
1276 1276
                     // Use the previous entry value as the default.
1277
-                    if( isset( $entry[ $field->id ] ) ) {
1277
+                    if ( isset( $entry[ $field->id ] ) ) {
1278 1278
                         $value = $entry[ $field->id ];
1279 1279
                     }
1280 1280
 
1281 1281
                     // If this is a single upload file
1282
-                    if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1283
-                        $file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1284
-                        $value = $file_path['url'];
1282
+                    if ( ! empty( $_FILES[ $input_name ] ) && ! empty( $_FILES[ $input_name ][ 'name' ] ) ) {
1283
+                        $file_path = GFFormsModel::get_file_upload_path( $form[ 'id' ], $_FILES[ $input_name ][ 'name' ] );
1284
+                        $value = $file_path[ 'url' ];
1285 1285
 
1286 1286
                     } else {
1287 1287
 
1288 1288
                         // Fix PHP warning on line 1498 of form_display.php for post_image fields
1289 1289
                         // Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1290
-                        $_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1290
+                        $_FILES[ $input_name ] = array( 'name' => '', 'size' => '' );
1291 1291
 
1292 1292
                     }
1293 1293
 
1294
-                    if( rgar($field, "multipleFiles") ) {
1294
+                    if ( rgar( $field, "multipleFiles" ) ) {
1295 1295
 
1296 1296
                         // If there are fresh uploads, process and merge them.
1297 1297
                         // Otherwise, use the passed values, which should be json-encoded array of URLs
1298
-                        if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) {
1298
+                        if ( isset( GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] ) ) {
1299 1299
                             $value = empty( $value ) ? '[]' : $value;
1300 1300
                             $value = stripslashes_deep( $value );
1301
-                            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array());
1301
+                            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ], array() );
1302 1302
                         }
1303 1303
 
1304 1304
                     } else {
@@ -1316,8 +1316,8 @@  discard block
 block discarded – undo
1316 1316
 
1317 1317
                 case 'number':
1318 1318
                     // Fix "undefined index" issue at line 1286 in form_display.php
1319
-                    if( !isset( $_POST['input_'.$field->id ] ) ) {
1320
-                        $_POST['input_'.$field->id ] = NULL;
1319
+                    if ( ! isset( $_POST[ 'input_' . $field->id ] ) ) {
1320
+                        $_POST[ 'input_' . $field->id ] = NULL;
1321 1321
                     }
1322 1322
                     break;
1323 1323
             }
@@ -1354,7 +1354,7 @@  discard block
 block discarded – undo
1354 1354
          * You can enter whatever you want!
1355 1355
          * We try validating, and customize the results using `self::custom_validation()`
1356 1356
          */
1357
-        add_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10, 4);
1357
+        add_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10, 4 );
1358 1358
 
1359 1359
         // Needed by the validate funtion
1360 1360
         $failed_validation_page = NULL;
@@ -1362,14 +1362,14 @@  discard block
 block discarded – undo
1362 1362
 
1363 1363
         // Prevent entry limit from running when editing an entry, also
1364 1364
         // prevent form scheduling from preventing editing
1365
-        unset( $this->form['limitEntries'], $this->form['scheduleForm'] );
1365
+        unset( $this->form[ 'limitEntries' ], $this->form[ 'scheduleForm' ] );
1366 1366
 
1367 1367
         // Hide fields depending on Edit Entry settings
1368
-        $this->form['fields'] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1368
+        $this->form[ 'fields' ] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1369 1369
 
1370 1370
         $this->is_valid = GFFormDisplay::validate( $this->form, $field_values, 1, $failed_validation_page );
1371 1371
 
1372
-        remove_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10 );
1372
+        remove_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10 );
1373 1373
     }
1374 1374
 
1375 1375
 
@@ -1386,13 +1386,13 @@  discard block
 block discarded – undo
1386 1386
      */
1387 1387
     public function custom_validation( $validation_results ) {
1388 1388
 
1389
-        do_action('gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Validation results: ', $validation_results );
1389
+        do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Validation results: ', $validation_results );
1390 1390
 
1391
-        do_action('gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] $_POSTed data (sanitized): ', esc_html( print_r( $_POST, true ) ) );
1391
+        do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] $_POSTed data (sanitized): ', esc_html( print_r( $_POST, true ) ) );
1392 1392
 
1393 1393
         $gv_valid = true;
1394 1394
 
1395
-        foreach ( $validation_results['form']['fields'] as $key => &$field ) {
1395
+        foreach ( $validation_results[ 'form' ][ 'fields' ] as $key => &$field ) {
1396 1396
 
1397 1397
             $value = RGFormsModel::get_field_value( $field );
1398 1398
             $field_type = RGFormsModel::get_input_type( $field );
@@ -1405,35 +1405,35 @@  discard block
 block discarded – undo
1405 1405
                 case 'post_image':
1406 1406
 
1407 1407
                     // in case nothing is uploaded but there are already files saved
1408
-                    if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) {
1408
+                    if ( ! empty( $field->failed_validation ) && ! empty( $field->isRequired ) && ! empty( $value ) ) {
1409 1409
                         $field->failed_validation = false;
1410 1410
                         unset( $field->validation_message );
1411 1411
                     }
1412 1412
 
1413 1413
                     // validate if multi file upload reached max number of files [maxFiles] => 2
1414
-                    if( rgobj( $field, 'maxFiles') && rgobj( $field, 'multipleFiles') ) {
1414
+                    if ( rgobj( $field, 'maxFiles' ) && rgobj( $field, 'multipleFiles' ) ) {
1415 1415
 
1416 1416
                         $input_name = 'input_' . $field->id;
1417 1417
                         //uploaded
1418
-                        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1418
+                        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] : array();
1419 1419
 
1420 1420
                         //existent
1421 1421
                         $entry = $this->get_entry();
1422 1422
                         $value = NULL;
1423
-                        if( isset( $entry[ $field->id ] ) ) {
1423
+                        if ( isset( $entry[ $field->id ] ) ) {
1424 1424
                             $value = json_decode( $entry[ $field->id ], true );
1425 1425
                         }
1426 1426
 
1427 1427
                         // count uploaded files and existent entry files
1428 1428
                         $count_files = count( $file_names ) + count( $value );
1429 1429
 
1430
-                        if( $count_files > $field->maxFiles ) {
1430
+                        if ( $count_files > $field->maxFiles ) {
1431 1431
                             $field->validation_message = __( 'Maximum number of files reached', 'gravityview' );
1432 1432
                             $field->failed_validation = 1;
1433 1433
                             $gv_valid = false;
1434 1434
 
1435 1435
                             // in case of error make sure the newest upload files are removed from the upload input
1436
-                            GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1436
+                            GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ] = null;
1437 1437
                         }
1438 1438
 
1439 1439
                     }
@@ -1444,7 +1444,7 @@  discard block
 block discarded – undo
1444 1444
             }
1445 1445
 
1446 1446
             // This field has failed validation.
1447
-            if( !empty( $field->failed_validation ) ) {
1447
+            if ( ! empty( $field->failed_validation ) ) {
1448 1448
 
1449 1449
                 do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Field is invalid.', array( 'field' => $field, 'value' => $value ) );
1450 1450
 
@@ -1462,32 +1462,32 @@  discard block
 block discarded – undo
1462 1462
                 }
1463 1463
 
1464 1464
                 // You can't continue inside a switch, so we do it after.
1465
-                if( empty( $field->failed_validation ) ) {
1465
+                if ( empty( $field->failed_validation ) ) {
1466 1466
                     continue;
1467 1467
                 }
1468 1468
 
1469 1469
                 // checks if the No Duplicates option is not validating entry against itself, since
1470 1470
                 // we're editing a stored entry, it would also assume it's a duplicate.
1471
-                if( !empty( $field->noDuplicates ) ) {
1471
+                if ( ! empty( $field->noDuplicates ) ) {
1472 1472
 
1473 1473
                     $entry = $this->get_entry();
1474 1474
 
1475 1475
                     // If the value of the entry is the same as the stored value
1476 1476
                     // Then we can assume it's not a duplicate, it's the same.
1477
-                    if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1477
+                    if ( ! empty( $entry ) && $value == $entry[ $field->id ] ) {
1478 1478
                         //if value submitted was not changed, then don't validate
1479 1479
                         $field->failed_validation = false;
1480 1480
 
1481 1481
                         unset( $field->validation_message );
1482 1482
 
1483
-                        do_action('gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', $entry );
1483
+                        do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', $entry );
1484 1484
 
1485 1485
                         continue;
1486 1486
                     }
1487 1487
                 }
1488 1488
 
1489 1489
                 // if here then probably we are facing the validation 'At least one field must be filled out'
1490
-                if( GFFormDisplay::is_empty( $field, $this->form_id  ) && empty( $field->isRequired ) ) {
1490
+                if ( GFFormDisplay::is_empty( $field, $this->form_id ) && empty( $field->isRequired ) ) {
1491 1491
                     unset( $field->validation_message );
1492 1492
 	                $field->validation_message = false;
1493 1493
                     continue;
@@ -1499,12 +1499,12 @@  discard block
 block discarded – undo
1499 1499
 
1500 1500
         }
1501 1501
 
1502
-        $validation_results['is_valid'] = $gv_valid;
1502
+        $validation_results[ 'is_valid' ] = $gv_valid;
1503 1503
 
1504
-        do_action('gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Validation results.', $validation_results );
1504
+        do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Validation results.', $validation_results );
1505 1505
 
1506 1506
         // We'll need this result when rendering the form ( on GFFormDisplay::get_form )
1507
-        $this->form_after_validation = $validation_results['form'];
1507
+        $this->form_after_validation = $validation_results[ 'form' ];
1508 1508
 
1509 1509
         return $validation_results;
1510 1510
     }
@@ -1517,7 +1517,7 @@  discard block
 block discarded – undo
1517 1517
      */
1518 1518
     public function get_entry() {
1519 1519
 
1520
-        if( empty( $this->entry ) ) {
1520
+        if ( empty( $this->entry ) ) {
1521 1521
             // Get the database value of the entry that's being edited
1522 1522
             $this->entry = gravityview_get_entry( GravityView_frontend::is_single_entry() );
1523 1523
         }
@@ -1544,10 +1544,10 @@  discard block
 block discarded – undo
1544 1544
         $properties = GravityView_View_Data::getInstance()->get_fields( $view_id );
1545 1545
 
1546 1546
         // If edit tab not yet configured, show all fields
1547
-        $edit_fields = !empty( $properties['edit_edit-fields'] ) ? $properties['edit_edit-fields'] : NULL;
1547
+        $edit_fields = ! empty( $properties[ 'edit_edit-fields' ] ) ? $properties[ 'edit_edit-fields' ] : NULL;
1548 1548
 
1549 1549
         // Hide fields depending on admin settings
1550
-        $fields = $this->filter_fields( $form['fields'], $edit_fields );
1550
+        $fields = $this->filter_fields( $form[ 'fields' ], $edit_fields );
1551 1551
 
1552 1552
 	    // If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1553 1553
 	    $fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
@@ -1579,7 +1579,7 @@  discard block
 block discarded – undo
1579 1579
      */
1580 1580
     private function filter_fields( $fields, $configured_fields ) {
1581 1581
 
1582
-        if( empty( $fields ) || !is_array( $fields ) ) {
1582
+        if ( empty( $fields ) || ! is_array( $fields ) ) {
1583 1583
             return $fields;
1584 1584
         }
1585 1585
 
@@ -1592,18 +1592,18 @@  discard block
 block discarded – undo
1592 1592
 
1593 1593
             // Remove the fields that have calculation properties and keep them to be used later
1594 1594
             // @since 1.16.2
1595
-            if( $field->has_calculation() ) {
1596
-                $this->fields_with_calculation[] = $field;
1595
+            if ( $field->has_calculation() ) {
1596
+                $this->fields_with_calculation[ ] = $field;
1597 1597
                 // don't remove the calculation fields on form render.
1598 1598
             }
1599 1599
 
1600
-            if( in_array( $field->type, $field_type_blacklist ) ) {
1600
+            if ( in_array( $field->type, $field_type_blacklist ) ) {
1601 1601
                 unset( $fields[ $key ] );
1602 1602
             }
1603 1603
         }
1604 1604
 
1605 1605
         // The Edit tab has not been configured, so we return all fields by default.
1606
-        if( empty( $configured_fields ) ) {
1606
+        if ( empty( $configured_fields ) ) {
1607 1607
             return $fields;
1608 1608
         }
1609 1609
 
@@ -1613,8 +1613,8 @@  discard block
 block discarded – undo
1613 1613
 	        /** @var GF_Field $field */
1614 1614
 	        foreach ( $fields as $field ) {
1615 1615
 
1616
-                if( intval( $configured_field['id'] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1617
-                    $edit_fields[] = $this->merge_field_properties( $field, $configured_field );
1616
+                if ( intval( $configured_field[ 'id' ] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1617
+                    $edit_fields[ ] = $this->merge_field_properties( $field, $configured_field );
1618 1618
                     break;
1619 1619
                 }
1620 1620
 
@@ -1637,14 +1637,14 @@  discard block
 block discarded – undo
1637 1637
 
1638 1638
         $return_field = $field;
1639 1639
 
1640
-        if( empty( $field_setting['show_label'] ) ) {
1640
+        if ( empty( $field_setting[ 'show_label' ] ) ) {
1641 1641
             $return_field->label = '';
1642
-        } elseif ( !empty( $field_setting['custom_label'] ) ) {
1643
-            $return_field->label = $field_setting['custom_label'];
1642
+        } elseif ( ! empty( $field_setting[ 'custom_label' ] ) ) {
1643
+            $return_field->label = $field_setting[ 'custom_label' ];
1644 1644
         }
1645 1645
 
1646
-        if( !empty( $field_setting['custom_class'] ) ) {
1647
-            $return_field->cssClass .= ' '. gravityview_sanitize_html_class( $field_setting['custom_class'] );
1646
+        if ( ! empty( $field_setting[ 'custom_class' ] ) ) {
1647
+            $return_field->cssClass .= ' ' . gravityview_sanitize_html_class( $field_setting[ 'custom_class' ] );
1648 1648
         }
1649 1649
 
1650 1650
         /**
@@ -1682,16 +1682,16 @@  discard block
 block discarded – undo
1682 1682
 	     */
1683 1683
 	    $use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
1684 1684
 
1685
-	    if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
1686
-            foreach( $fields as $k => $field ) {
1687
-                if( $field->adminOnly ) {
1685
+	    if ( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry[ 'id' ] ) ) {
1686
+            foreach ( $fields as $k => $field ) {
1687
+                if ( $field->adminOnly ) {
1688 1688
                     unset( $fields[ $k ] );
1689 1689
                 }
1690 1690
             }
1691 1691
             return $fields;
1692 1692
         }
1693 1693
 
1694
-	    foreach( $fields as &$field ) {
1694
+	    foreach ( $fields as &$field ) {
1695 1695
 		    $field->adminOnly = false;
1696 1696
         }
1697 1697
 
@@ -1715,22 +1715,22 @@  discard block
 block discarded – undo
1715 1715
      */
1716 1716
     function prefill_conditional_logic( $form ) {
1717 1717
 
1718
-        if( ! GFFormDisplay::has_conditional_logic( $form ) ) {
1718
+        if ( ! GFFormDisplay::has_conditional_logic( $form ) ) {
1719 1719
             return $form;
1720 1720
         }
1721 1721
 
1722 1722
         // Have Conditional Logic pre-fill fields as if the data were default values
1723 1723
         /** @var GF_Field $field */
1724
-        foreach ( $form['fields'] as &$field ) {
1724
+        foreach ( $form[ 'fields' ] as &$field ) {
1725 1725
 
1726
-            if( 'checkbox' === $field->type ) {
1726
+            if ( 'checkbox' === $field->type ) {
1727 1727
                 foreach ( $field->get_entry_inputs() as $key => $input ) {
1728
-                    $input_id = $input['id'];
1728
+                    $input_id = $input[ 'id' ];
1729 1729
                     $choice = $field->choices[ $key ];
1730 1730
                     $value = rgar( $this->entry, $input_id );
1731 1731
                     $match = RGFormsModel::choice_value_match( $field, $choice, $value );
1732
-                    if( $match ) {
1733
-                        $field->choices[ $key ]['isSelected'] = true;
1732
+                    if ( $match ) {
1733
+                        $field->choices[ $key ][ 'isSelected' ] = true;
1734 1734
                     }
1735 1735
                 }
1736 1736
             } else {
@@ -1738,15 +1738,15 @@  discard block
 block discarded – undo
1738 1738
                 // We need to run through each field to set the default values
1739 1739
                 foreach ( $this->entry as $field_id => $field_value ) {
1740 1740
 
1741
-                    if( floatval( $field_id ) === floatval( $field->id ) ) {
1741
+                    if ( floatval( $field_id ) === floatval( $field->id ) ) {
1742 1742
 
1743
-                        if( 'list' === $field->type ) {
1743
+                        if ( 'list' === $field->type ) {
1744 1744
                             $list_rows = maybe_unserialize( $field_value );
1745 1745
 
1746 1746
                             $list_field_value = array();
1747
-                            foreach ( (array) $list_rows as $row ) {
1748
-                                foreach ( (array) $row as $column ) {
1749
-                                    $list_field_value[] = $column;
1747
+                            foreach ( (array)$list_rows as $row ) {
1748
+                                foreach ( (array)$row as $column ) {
1749
+                                    $list_field_value[ ] = $column;
1750 1750
                                 }
1751 1751
                             }
1752 1752
 
@@ -1781,16 +1781,16 @@  discard block
 block discarded – undo
1781 1781
          */
1782 1782
         $use_conditional_logic = apply_filters( 'gravityview/edit_entry/conditional_logic', true, $form );
1783 1783
 
1784
-        if( $use_conditional_logic ) {
1784
+        if ( $use_conditional_logic ) {
1785 1785
             return $form;
1786 1786
         }
1787 1787
 
1788
-        foreach( $form['fields'] as &$field ) {
1788
+        foreach ( $form[ 'fields' ] as &$field ) {
1789 1789
             /* @var GF_Field $field */
1790 1790
             $field->conditionalLogic = null;
1791 1791
         }
1792 1792
 
1793
-        unset( $form['button']['conditionalLogic'] );
1793
+        unset( $form[ 'button' ][ 'conditionalLogic' ] );
1794 1794
 
1795 1795
         return $form;
1796 1796
 
@@ -1807,7 +1807,7 @@  discard block
 block discarded – undo
1807 1807
      */
1808 1808
     public function manage_conditional_logic( $has_conditional_logic, $form ) {
1809 1809
 
1810
-        if( ! $this->is_edit_entry() ) {
1810
+        if ( ! $this->is_edit_entry() ) {
1811 1811
             return $has_conditional_logic;
1812 1812
         }
1813 1813
 
@@ -1839,44 +1839,44 @@  discard block
 block discarded – undo
1839 1839
          *  2. There are two entries embedded using oEmbed
1840 1840
          *  3. One of the entries has just been saved
1841 1841
          */
1842
-        if( !empty( $_POST['lid'] ) && !empty( $_GET['entry'] ) && ( $_POST['lid'] !== $_GET['entry'] ) ) {
1842
+        if ( ! empty( $_POST[ 'lid' ] ) && ! empty( $_GET[ 'entry' ] ) && ( $_POST[ 'lid' ] !== $_GET[ 'entry' ] ) ) {
1843 1843
 
1844 1844
             $error = true;
1845 1845
 
1846 1846
         }
1847 1847
 
1848
-        if( !empty( $_GET['entry'] ) && (string)$this->entry['id'] !== $_GET['entry'] ) {
1848
+        if ( ! empty( $_GET[ 'entry' ] ) && (string)$this->entry[ 'id' ] !== $_GET[ 'entry' ] ) {
1849 1849
 
1850 1850
             $error = true;
1851 1851
 
1852
-        } elseif( ! $this->verify_nonce() ) {
1852
+        } elseif ( ! $this->verify_nonce() ) {
1853 1853
 
1854 1854
             /**
1855 1855
              * If the Entry is embedded, there may be two entries on the same page.
1856 1856
              * If that's the case, and one is being edited, the other should fail gracefully and not display an error.
1857 1857
              */
1858
-            if( GravityView_oEmbed::getInstance()->get_entry_id() ) {
1858
+            if ( GravityView_oEmbed::getInstance()->get_entry_id() ) {
1859 1859
                 $error = true;
1860 1860
             } else {
1861
-                $error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview');
1861
+                $error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview' );
1862 1862
             }
1863 1863
 
1864 1864
         }
1865 1865
 
1866
-        if( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
1867
-            $error = __( 'You do not have permission to edit this entry.', 'gravityview');
1866
+        if ( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
1867
+            $error = __( 'You do not have permission to edit this entry.', 'gravityview' );
1868 1868
         }
1869 1869
 
1870
-        if( $this->entry['status'] === 'trash' ) {
1871
-            $error = __('You cannot edit the entry; it is in the trash.', 'gravityview' );
1870
+        if ( $this->entry[ 'status' ] === 'trash' ) {
1871
+            $error = __( 'You cannot edit the entry; it is in the trash.', 'gravityview' );
1872 1872
         }
1873 1873
 
1874 1874
         // No errors; everything's fine here!
1875
-        if( empty( $error ) ) {
1875
+        if ( empty( $error ) ) {
1876 1876
             return true;
1877 1877
         }
1878 1878
 
1879
-        if( $echo && $error !== true ) {
1879
+        if ( $echo && $error !== true ) {
1880 1880
 
1881 1881
 	        $error = esc_html( $error );
1882 1882
 
@@ -1884,13 +1884,13 @@  discard block
 block discarded – undo
1884 1884
 	         * @since 1.9
1885 1885
 	         */
1886 1886
 	        if ( ! empty( $this->entry ) ) {
1887
-		        $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;" ) );
1887
+		        $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;" ) );
1888 1888
 	        }
1889 1889
 
1890
-            echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error');
1890
+            echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error' );
1891 1891
         }
1892 1892
 
1893
-        do_action('gravityview_log_error', 'GravityView_Edit_Entry[user_can_edit_entry]' . $error );
1893
+        do_action( 'gravityview_log_error', 'GravityView_Edit_Entry[user_can_edit_entry]' . $error );
1894 1894
 
1895 1895
         return false;
1896 1896
     }
@@ -1907,20 +1907,20 @@  discard block
 block discarded – undo
1907 1907
 
1908 1908
         $error = NULL;
1909 1909
 
1910
-        if( ! $this->check_user_cap_edit_field( $field ) ) {
1911
-            $error = __( 'You do not have permission to edit this field.', 'gravityview');
1910
+        if ( ! $this->check_user_cap_edit_field( $field ) ) {
1911
+            $error = __( 'You do not have permission to edit this field.', 'gravityview' );
1912 1912
         }
1913 1913
 
1914 1914
         // No errors; everything's fine here!
1915
-        if( empty( $error ) ) {
1915
+        if ( empty( $error ) ) {
1916 1916
             return true;
1917 1917
         }
1918 1918
 
1919
-        if( $echo ) {
1920
-            echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error');
1919
+        if ( $echo ) {
1920
+            echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error' );
1921 1921
         }
1922 1922
 
1923
-        do_action('gravityview_log_error', 'GravityView_Edit_Entry[user_can_edit_field]' . $error );
1923
+        do_action( 'gravityview_log_error', 'GravityView_Edit_Entry[user_can_edit_field]' . $error );
1924 1924
 
1925 1925
         return false;
1926 1926
 
@@ -1938,15 +1938,15 @@  discard block
 block discarded – undo
1938 1938
     private function check_user_cap_edit_field( $field ) {
1939 1939
 
1940 1940
         // If they can edit any entries (as defined in Gravity Forms), we're good.
1941
-        if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
1941
+        if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
1942 1942
             return true;
1943 1943
         }
1944 1944
 
1945
-        $field_cap = isset( $field['allow_edit_cap'] ) ? $field['allow_edit_cap'] : false;
1945
+        $field_cap = isset( $field[ 'allow_edit_cap' ] ) ? $field[ 'allow_edit_cap' ] : false;
1946 1946
 
1947 1947
         // If the field has custom editing capaibilities set, check those
1948
-        if( $field_cap ) {
1949
-            return GVCommon::has_cap( $field['allow_edit_cap'] );
1948
+        if ( $field_cap ) {
1949
+            return GVCommon::has_cap( $field[ 'allow_edit_cap' ] );
1950 1950
         }
1951 1951
 
1952 1952
         return false;
@@ -1960,17 +1960,17 @@  discard block
 block discarded – undo
1960 1960
     public function verify_nonce() {
1961 1961
 
1962 1962
         // Verify form submitted for editing single
1963
-        if( $this->is_edit_entry_submission() ) {
1963
+        if ( $this->is_edit_entry_submission() ) {
1964 1964
             $valid = wp_verify_nonce( $_POST[ self::$nonce_field ], self::$nonce_field );
1965 1965
         }
1966 1966
 
1967 1967
         // Verify
1968
-        else if( ! $this->is_edit_entry() ) {
1968
+        else if ( ! $this->is_edit_entry() ) {
1969 1969
             $valid = false;
1970 1970
         }
1971 1971
 
1972 1972
         else {
1973
-            $valid = wp_verify_nonce( $_GET['edit'], self::$nonce_key );
1973
+            $valid = wp_verify_nonce( $_GET[ 'edit' ], self::$nonce_key );
1974 1974
         }
1975 1975
 
1976 1976
         /**
Please login to merge, or discard this patch.