Completed
Pull Request — master (#747)
by Steve
19:06
created
includes/extensions/edit-entry/class-edit-entry-render.php 1 patch
Spacing   +229 added lines, -229 removed lines patch added patch discarded remove patch
@@ -119,16 +119,16 @@  discard block
 block discarded – undo
119 119
     function load() {
120 120
 
121 121
         /** @define "GRAVITYVIEW_DIR" "../../../" */
122
-        include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' );
122
+        include_once( GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php' );
123 123
 
124 124
         // Don't display an embedded form when editing an entry
125 125
         add_action( 'wp_head', array( $this, 'prevent_render_form' ) );
126 126
         add_action( 'wp_footer', array( $this, 'prevent_render_form' ) );
127 127
 
128 128
         // Stop Gravity Forms processing what is ours!
129
-        add_filter( 'wp', array( $this, 'prevent_maybe_process_form'), 8 );
129
+        add_filter( 'wp', array( $this, 'prevent_maybe_process_form' ), 8 );
130 130
 
131
-        add_filter( 'gravityview_is_edit_entry', array( $this, 'is_edit_entry') );
131
+        add_filter( 'gravityview_is_edit_entry', array( $this, 'is_edit_entry' ) );
132 132
 
133 133
         add_action( 'gravityview_edit_entry', array( $this, 'init' ) );
134 134
 
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
         add_filter( 'gform_plupload_settings', array( $this, 'modify_fileupload_settings' ), 10, 3 );
140 140
 
141 141
         // Add fields expected by GFFormDisplay::validate()
142
-        add_filter( 'gform_pre_validation', array( $this, 'gform_pre_validation') );
142
+        add_filter( 'gform_pre_validation', array( $this, 'gform_pre_validation' ) );
143 143
 
144 144
     }
145 145
 
@@ -154,8 +154,8 @@  discard block
 block discarded – undo
154 154
      * @return void
155 155
      */
156 156
     function prevent_render_form() {
157
-        if( $this->is_edit_entry() ) {
158
-            if( 'wp_head' === current_filter() ) {
157
+        if ( $this->is_edit_entry() ) {
158
+            if ( 'wp_head' === current_filter() ) {
159 159
                 add_filter( 'gform_shortcode_form', '__return_empty_string' );
160 160
             } else {
161 161
                 remove_filter( 'gform_shortcode_form', '__return_empty_string' );
@@ -170,10 +170,10 @@  discard block
 block discarded – undo
170 170
      */
171 171
     function prevent_maybe_process_form() {
172 172
 
173
-        do_action('gravityview_log_debug', 'GravityView_Edit_Entry[prevent_maybe_process_form] $_POSTed data (sanitized): ', esc_html( print_r( $_POST, true ) ) );
173
+        do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[prevent_maybe_process_form] $_POSTed data (sanitized): ', esc_html( print_r( $_POST, true ) ) );
174 174
 
175
-        if( $this->is_edit_entry_submission() && $this->verify_nonce() ) {
176
-            remove_action( 'wp',  array( 'RGForms', 'maybe_process_form'), 9 );
175
+        if ( $this->is_edit_entry_submission() && $this->verify_nonce() ) {
176
+            remove_action( 'wp', array( 'RGForms', 'maybe_process_form' ), 9 );
177 177
         }
178 178
     }
179 179
 
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
      */
184 184
     public function is_edit_entry() {
185 185
 
186
-        $gf_page = function_exists('rgpost') && ( 'entry' === rgget( 'view' ) && isset( $_GET['edit'] ) );
186
+        $gf_page = function_exists( 'rgpost' ) && ( 'entry' === rgget( 'view' ) && isset( $_GET[ 'edit' ] ) );
187 187
 
188 188
         return $gf_page;
189 189
     }
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 	 * @return boolean
195 195
 	 */
196 196
 	public function is_edit_entry_submission() {
197
-		return !empty( $_POST[ self::$nonce_field ] );
197
+		return ! empty( $_POST[ self::$nonce_field ] );
198 198
 	}
199 199
 
200 200
     /**
@@ -205,15 +205,15 @@  discard block
 block discarded – undo
205 205
 
206 206
 
207 207
         $entries = $gravityview_view->getEntries();
208
-	    self::$original_entry = $entries[0];
209
-	    $this->entry = $entries[0];
208
+	    self::$original_entry = $entries[ 0 ];
209
+	    $this->entry = $entries[ 0 ];
210 210
 
211 211
         self::$original_form = $gravityview_view->getForm();
212 212
         $this->form = $gravityview_view->getForm();
213 213
         $this->form_id = $gravityview_view->getFormId();
214 214
         $this->view_id = $gravityview_view->getViewId();
215 215
 
216
-        self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry['id'] );
216
+        self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry[ 'id' ] );
217 217
     }
218 218
 
219 219
 
@@ -233,12 +233,12 @@  discard block
 block discarded – undo
233 233
         $this->setup_vars();
234 234
 
235 235
         // Multiple Views embedded, don't proceed if nonce fails
236
-        if( $gv_data->has_multiple_views() && ! wp_verify_nonce( $_GET['edit'], self::$nonce_key ) ) {
236
+        if ( $gv_data->has_multiple_views() && ! wp_verify_nonce( $_GET[ 'edit' ], self::$nonce_key ) ) {
237 237
             return;
238 238
         }
239 239
 
240 240
         // Sorry, you're not allowed here.
241
-        if( false === $this->user_can_edit_entry( true ) ) {
241
+        if ( false === $this->user_can_edit_entry( true ) ) {
242 242
             return;
243 243
         }
244 244
 
@@ -258,9 +258,9 @@  discard block
 block discarded – undo
258 258
     function print_scripts() {
259 259
         $gravityview_view = GravityView_View::getInstance();
260 260
 
261
-        wp_register_script( 'gform_gravityforms', GFCommon::get_base_url().'/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) );
261
+        wp_register_script( 'gform_gravityforms', GFCommon::get_base_url() . '/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) );
262 262
 
263
-        GFFormDisplay::enqueue_form_scripts($gravityview_view->getForm(), false);
263
+        GFFormDisplay::enqueue_form_scripts( $gravityview_view->getForm(), false );
264 264
 
265 265
         // Sack is required for images
266 266
         wp_print_scripts( array( 'sack', 'gform_gravityforms' ) );
@@ -272,32 +272,32 @@  discard block
 block discarded – undo
272 272
      */
273 273
     function process_save() {
274 274
 
275
-        if( empty( $_POST ) ) {
275
+        if ( empty( $_POST ) ) {
276 276
             return;
277 277
         }
278 278
 
279 279
         // Make sure the entry, view, and form IDs are all correct
280 280
         $valid = $this->verify_nonce();
281 281
 
282
-        if( !$valid ) {
283
-            do_action('gravityview_log_error', __METHOD__ . ' Nonce validation failed.' );
282
+        if ( ! $valid ) {
283
+            do_action( 'gravityview_log_error', __METHOD__ . ' Nonce validation failed.' );
284 284
             return;
285 285
         }
286 286
 
287
-        if( $this->entry['id'] !== $_POST['lid'] ) {
288
-            do_action('gravityview_log_error', __METHOD__ . ' Entry ID did not match posted entry ID.' );
287
+        if ( $this->entry[ 'id' ] !== $_POST[ 'lid' ] ) {
288
+            do_action( 'gravityview_log_error', __METHOD__ . ' Entry ID did not match posted entry ID.' );
289 289
             return;
290 290
         }
291 291
 
292
-        do_action('gravityview_log_debug', 'GravityView_Edit_Entry[process_save] $_POSTed data (sanitized): ', esc_html( print_r( $_POST, true ) ) );
292
+        do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[process_save] $_POSTed data (sanitized): ', esc_html( print_r( $_POST, true ) ) );
293 293
 
294 294
         $this->process_save_process_files( $this->form_id );
295 295
 
296 296
         $this->validate();
297 297
 
298
-        if( $this->is_valid ) {
298
+        if ( $this->is_valid ) {
299 299
 
300
-            do_action('gravityview_log_debug', 'GravityView_Edit_Entry[process_save] Submission is valid.' );
300
+            do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[process_save] Submission is valid.' );
301 301
 
302 302
             /**
303 303
              * @hack This step is needed to unset the adminOnly from form fields, to add the calculation fields
@@ -307,12 +307,12 @@  discard block
 block discarded – undo
307 307
             /**
308 308
              * @hack to avoid the capability validation of the method save_lead for GF 1.9+
309 309
              */
310
-            unset( $_GET['page'] );
310
+            unset( $_GET[ 'page' ] );
311 311
 
312 312
             GFFormsModel::save_lead( $form, $this->entry );
313 313
 
314 314
             // If there's a post associated with the entry, process post fields
315
-            if( !empty( $this->entry['post_id'] ) ) {
315
+            if ( ! empty( $this->entry[ 'post_id' ] ) ) {
316 316
                 $this->maybe_update_post_fields( $form );
317 317
             }
318 318
 
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
              * @param array $form Gravity Forms form array
328 328
              * @param string $entry_id Numeric ID of the entry that was updated
329 329
              */
330
-            do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry['id'] );
330
+            do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry[ 'id' ] );
331 331
         }
332 332
 
333 333
     } // process_save
@@ -361,11 +361,11 @@  discard block
 block discarded – undo
361 361
      * @return mixed
362 362
      */
363 363
     public function modify_fileupload_settings( $plupload_init, $form_id, $instance ) {
364
-        if( ! $this->is_edit_entry() ) {
364
+        if ( ! $this->is_edit_entry() ) {
365 365
             return $plupload_init;
366 366
         }
367 367
 
368
-        $plupload_init['gf_vars']['max_files'] = 0;
368
+        $plupload_init[ 'gf_vars' ][ 'max_files' ] = 0;
369 369
 
370 370
         return $plupload_init;
371 371
     }
@@ -379,19 +379,19 @@  discard block
 block discarded – undo
379 379
 
380 380
         $form = $this->form;
381 381
 
382
-        foreach( $form['fields'] as $k => &$field ) {
382
+        foreach ( $form[ 'fields' ] as $k => &$field ) {
383 383
 
384 384
             // Remove the fields with calculation formulas before save to avoid conflicts with GF logic
385 385
             // @since 1.16.3
386
-            if( $field->has_calculation() ) {
387
-                unset( $form['fields'][ $k ] );
386
+            if ( $field->has_calculation() ) {
387
+                unset( $form[ 'fields' ][ $k ] );
388 388
             }
389 389
 
390 390
             $field->adminOnly = false;
391 391
 
392
-            if( isset( $field->inputs ) && is_array( $field->inputs ) ) {
393
-                foreach( $field->inputs as $key => $input ) {
394
-                    $field->inputs[ $key ][ 'id' ] = (string)$input['id'];
392
+            if ( isset( $field->inputs ) && is_array( $field->inputs ) ) {
393
+                foreach ( $field->inputs as $key => $input ) {
394
+                    $field->inputs[ $key ][ 'id' ] = (string)$input[ 'id' ];
395 395
                 }
396 396
             }
397 397
         }
@@ -405,20 +405,20 @@  discard block
 block discarded – undo
405 405
         $update = false;
406 406
 
407 407
         // get the most up to date entry values
408
-        $entry = GFAPI::get_entry( $this->entry['id'] );
408
+        $entry = GFAPI::get_entry( $this->entry[ 'id' ] );
409 409
 
410
-        if( !empty( $this->fields_with_calculation ) ) {
410
+        if ( ! empty( $this->fields_with_calculation ) ) {
411 411
             $update = true;
412 412
             foreach ( $this->fields_with_calculation as $calc_field ) {
413 413
                 $inputs = $calc_field->get_entry_inputs();
414 414
                 if ( is_array( $inputs ) ) {
415 415
                     foreach ( $inputs as $input ) {
416
-                        $input_name = 'input_' . str_replace( '.', '_', $input['id'] );
417
-                        $entry[ strval( $input['id'] ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
416
+                        $input_name = 'input_' . str_replace( '.', '_', $input[ 'id' ] );
417
+                        $entry[ strval( $input[ 'id' ] ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry[ 'id' ], $entry );
418 418
                     }
419 419
                 } else {
420
-                    $input_name = 'input_' . str_replace( '.', '_', $calc_field->id);
421
-                    $entry[ strval( $calc_field->id ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
420
+                    $input_name = 'input_' . str_replace( '.', '_', $calc_field->id );
421
+                    $entry[ strval( $calc_field->id ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry[ 'id' ], $entry );
422 422
                 }
423 423
             }
424 424
 
@@ -428,16 +428,16 @@  discard block
 block discarded – undo
428 428
         if ( ! empty( $this->total_fields ) ) {
429 429
             $update = true;
430 430
             foreach ( $this->total_fields as $total_field ) {
431
-                $input_name = 'input_' . str_replace( '.', '_', $total_field->id);
432
-                $entry[ strval( $total_field->id ) ] = RGFormsModel::prepare_value( $form, $total_field, '', $input_name, $entry['id'], $entry );
431
+                $input_name = 'input_' . str_replace( '.', '_', $total_field->id );
432
+                $entry[ strval( $total_field->id ) ] = RGFormsModel::prepare_value( $form, $total_field, '', $input_name, $entry[ 'id' ], $entry );
433 433
             }
434 434
         }
435 435
 
436
-        if( $update ) {
436
+        if ( $update ) {
437 437
 
438 438
             $return_entry = GFAPI::update_entry( $entry );
439 439
 
440
-            if( is_wp_error( $return_entry ) ) {
440
+            if ( is_wp_error( $return_entry ) ) {
441 441
                 do_action( 'gravityview_log_error', 'Updating the entry calculation and total fields failed', $return_entry );
442 442
             } else {
443 443
                 do_action( 'gravityview_log_debug', 'Updating the entry calculation and total fields succeeded' );
@@ -468,18 +468,18 @@  discard block
 block discarded – undo
468 468
 
469 469
         $input_name = 'input_' . $field_id;
470 470
 
471
-        if ( !empty( $_FILES[ $input_name ]['name'] ) ) {
471
+        if ( ! empty( $_FILES[ $input_name ][ 'name' ] ) ) {
472 472
 
473 473
             // We have a new image
474 474
 
475
-            $value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'] );
475
+            $value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ] );
476 476
 
477 477
             $ary = ! empty( $value ) ? explode( '|:|', $value ) : array();
478 478
             $img_url = rgar( $ary, 0 );
479 479
 
480
-            $img_title       = count( $ary ) > 1 ? $ary[1] : '';
481
-            $img_caption     = count( $ary ) > 2 ? $ary[2] : '';
482
-            $img_description = count( $ary ) > 3 ? $ary[3] : '';
480
+            $img_title       = count( $ary ) > 1 ? $ary[ 1 ] : '';
481
+            $img_caption     = count( $ary ) > 2 ? $ary[ 2 ] : '';
482
+            $img_description = count( $ary ) > 3 ? $ary[ 3 ] : '';
483 483
 
484 484
             $image_meta = array(
485 485
                 'post_excerpt' => $img_caption,
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
 
489 489
             //adding title only if it is not empty. It will default to the file name if it is not in the array
490 490
             if ( ! empty( $img_title ) ) {
491
-                $image_meta['post_title'] = $img_title;
491
+                $image_meta[ 'post_title' ] = $img_title;
492 492
             }
493 493
 
494 494
             /**
@@ -503,22 +503,22 @@  discard block
 block discarded – undo
503 503
                 set_post_thumbnail( $post_id, $media_id );
504 504
             }
505 505
 
506
-        } elseif ( !empty( $_POST[ $input_name ] ) && is_array( $value ) ) {
506
+        } elseif ( ! empty( $_POST[ $input_name ] ) && is_array( $value ) ) {
507 507
 
508 508
             // Same image although the image title, caption or description might have changed
509 509
 
510 510
             $ary = array();
511
-            if( ! empty( $entry[ $field_id ] ) ) {
511
+            if ( ! empty( $entry[ $field_id ] ) ) {
512 512
                 $ary = is_array( $entry[ $field_id ] ) ? $entry[ $field_id ] : explode( '|:|', $entry[ $field_id ] );
513 513
             }
514 514
             $img_url = rgar( $ary, 0 );
515 515
 
516 516
             // is this really the same image or something went wrong ?
517
-            if( $img_url === $_POST[ $input_name ] ) {
517
+            if ( $img_url === $_POST[ $input_name ] ) {
518 518
 
519
-                $img_title       = rgar( $value, $field_id .'.1' );
520
-                $img_caption     = rgar( $value, $field_id .'.4' );
521
-                $img_description = rgar( $value, $field_id .'.7' );
519
+                $img_title       = rgar( $value, $field_id . '.1' );
520
+                $img_caption     = rgar( $value, $field_id . '.4' );
521
+                $img_description = rgar( $value, $field_id . '.7' );
522 522
 
523 523
                 $value = ! empty( $img_url ) ? $img_url . "|:|" . $img_title . "|:|" . $img_caption . "|:|" . $img_description : '';
524 524
 
@@ -558,11 +558,11 @@  discard block
 block discarded – undo
558 558
      */
559 559
     private function maybe_update_post_fields( $form ) {
560 560
 
561
-        $post_id = $this->entry['post_id'];
561
+        $post_id = $this->entry[ 'post_id' ];
562 562
 
563 563
         // Security check
564
-        if( false === GVCommon::has_cap( 'edit_post', $post_id ) ) {
565
-            do_action( 'gravityview_log_error', 'The current user does not have the ability to edit Post #'.$post_id );
564
+        if ( false === GVCommon::has_cap( 'edit_post', $post_id ) ) {
565
+            do_action( 'gravityview_log_error', 'The current user does not have the ability to edit Post #' . $post_id );
566 566
             return;
567 567
         }
568 568
 
@@ -574,25 +574,25 @@  discard block
 block discarded – undo
574 574
 
575 575
             $field = RGFormsModel::get_field( $form, $field_id );
576 576
 
577
-            if( ! $field ) {
577
+            if ( ! $field ) {
578 578
                 continue;
579 579
             }
580 580
 
581
-            if( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) {
581
+            if ( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) {
582 582
 
583 583
                 // Get the value of the field, including $_POSTed value
584 584
                 $value = RGFormsModel::get_field_value( $field );
585 585
 
586 586
                 // Use temporary entry variable, to make values available to fill_post_template() and update_post_image()
587 587
                 $entry_tmp = $this->entry;
588
-                $entry_tmp["{$field_id}"] = $value;
588
+                $entry_tmp[ "{$field_id}" ] = $value;
589 589
 
590
-                switch( $field->type ) {
590
+                switch ( $field->type ) {
591 591
 
592 592
                     case 'post_title':
593 593
                         $post_title = $value;
594
-                        if( rgar( $form, 'postTitleTemplateEnabled' ) ) {
595
-                            $post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
594
+                        if ( rgar( $form, 'postTitleTemplateEnabled' ) ) {
595
+                            $post_title = $this->fill_post_template( $form[ 'postTitleTemplate' ], $form, $entry_tmp );
596 596
                         }
597 597
                         $updated_post->post_title = $post_title;
598 598
                         $updated_post->post_name  = $post_title;
@@ -601,8 +601,8 @@  discard block
 block discarded – undo
601 601
 
602 602
                     case 'post_content':
603 603
                         $post_content = $value;
604
-                        if( rgar( $form, 'postContentTemplateEnabled' ) ) {
605
-                            $post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
604
+                        if ( rgar( $form, 'postContentTemplateEnabled' ) ) {
605
+                            $post_content = $this->fill_post_template( $form[ 'postContentTemplate' ], $form, $entry_tmp, true );
606 606
                         }
607 607
                         $updated_post->post_content = $post_content;
608 608
                         unset( $post_content );
@@ -616,19 +616,19 @@  discard block
 block discarded – undo
616 616
                     case 'post_category':
617 617
                         break;
618 618
                     case 'post_custom_field':
619
-                        if( ! empty( $field->customFieldTemplateEnabled ) ) {
619
+                        if ( ! empty( $field->customFieldTemplateEnabled ) ) {
620 620
                             $value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
621 621
                         }
622 622
 
623 623
                         $input_type = RGFormsModel::get_input_type( $field );
624 624
 
625 625
                         // Only certain custom field types are supported
626
-                        switch( $input_type ) {
626
+                        switch ( $input_type ) {
627 627
                             case 'fileupload':
628 628
                             case 'list':
629 629
                             case 'multiselect':
630
-                                if( ! is_string( $value ) ) {
631
-                                    $value = function_exists('wp_json_encode') ? wp_json_encode( $value ) : json_encode( $value );
630
+                                if ( ! is_string( $value ) ) {
631
+                                    $value = function_exists( 'wp_json_encode' ) ? wp_json_encode( $value ) : json_encode( $value );
632 632
                                 }
633 633
                             // break; left intentionally out
634 634
                             default:
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
                 }
645 645
 
646 646
                 // update entry after
647
-                $this->entry["{$field_id}"] = $value;
647
+                $this->entry[ "{$field_id}" ] = $value;
648 648
 
649 649
                 $update_entry = true;
650 650
 
@@ -653,25 +653,25 @@  discard block
 block discarded – undo
653 653
 
654 654
         }
655 655
 
656
-        if( $update_entry ) {
656
+        if ( $update_entry ) {
657 657
 
658 658
             $return_entry = GFAPI::update_entry( $this->entry );
659 659
 
660
-            if( is_wp_error( $return_entry ) ) {
660
+            if ( is_wp_error( $return_entry ) ) {
661 661
                do_action( 'gravityview_log_error', 'Updating the entry post fields failed', array( '$this->entry' => $this->entry, '$return_entry' => $return_entry ) );
662 662
             } else {
663
-                do_action( 'gravityview_log_debug', 'Updating the entry post fields for post #'.$post_id.' succeeded' );
663
+                do_action( 'gravityview_log_debug', 'Updating the entry post fields for post #' . $post_id . ' succeeded' );
664 664
             }
665 665
 
666 666
         }
667 667
 
668 668
         $return_post = wp_update_post( $updated_post, true );
669 669
 
670
-        if( is_wp_error( $return_post ) ) {
670
+        if ( is_wp_error( $return_post ) ) {
671 671
             $return_post->add_data( $updated_post, '$updated_post' );
672 672
             do_action( 'gravityview_log_error', 'Updating the post content failed', compact( 'updated_post', 'return_post' ) );
673 673
         } else {
674
-            do_action( 'gravityview_log_debug', 'Updating the post content for post #'.$post_id.' succeeded', $updated_post );
674
+            do_action( 'gravityview_log_debug', 'Updating the post content for post #' . $post_id . ' succeeded', $updated_post );
675 675
         }
676 676
     }
677 677
 
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
         $output = GFCommon::replace_variables( $output, $form, $entry, false, false, false );
702 702
 
703 703
         // replace conditional shortcodes
704
-        if( $do_shortcode ) {
704
+        if ( $do_shortcode ) {
705 705
             $output = do_shortcode( $output );
706 706
         }
707 707
 
@@ -720,18 +720,18 @@  discard block
 block discarded – undo
720 720
      */
721 721
     function after_update() {
722 722
 
723
-        do_action( 'gform_after_update_entry', $this->form, $this->entry['id'], self::$original_entry );
724
-        do_action( "gform_after_update_entry_{$this->form['id']}", $this->form, $this->entry['id'] );
723
+        do_action( 'gform_after_update_entry', $this->form, $this->entry[ 'id' ], self::$original_entry );
724
+        do_action( "gform_after_update_entry_{$this->form[ 'id' ]}", $this->form, $this->entry[ 'id' ] );
725 725
 
726 726
         // Re-define the entry now that we've updated it.
727
-        $entry = RGFormsModel::get_lead( $this->entry['id'] );
727
+        $entry = RGFormsModel::get_lead( $this->entry[ 'id' ] );
728 728
 
729 729
         $entry = GFFormsModel::set_entry_meta( $entry, $this->form );
730 730
 
731 731
         // We need to clear the cache because Gravity Forms caches the field values, which
732 732
         // we have just updated.
733
-        foreach ($this->form['fields'] as $key => $field) {
734
-            GFFormsModel::refresh_lead_field_value( $entry['id'], $field->id );
733
+        foreach ( $this->form[ 'fields' ] as $key => $field ) {
734
+            GFFormsModel::refresh_lead_field_value( $entry[ 'id' ], $field->id );
735 735
         }
736 736
 
737 737
         $this->entry = $entry;
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
 
750 750
         <div class="gv-edit-entry-wrapper"><?php
751 751
 
752
-            $javascript = gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/inline-javascript.php', $this );
752
+            $javascript = gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/inline-javascript.php', $this );
753 753
 
754 754
             /**
755 755
              * Fixes weird wpautop() issue
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
                      * @param string $edit_entry_title Modify the "Edit Entry" title
766 766
                      * @param GravityView_Edit_Entry_Render $this This object
767 767
                      */
768
-                    $edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
768
+                    $edit_entry_title = apply_filters( 'gravityview_edit_entry_title', __( 'Edit Entry', 'gravityview' ), $this );
769 769
 
770 770
                     echo esc_attr( $edit_entry_title );
771 771
             ?></span>
@@ -805,20 +805,20 @@  discard block
 block discarded – undo
805 805
      */
806 806
     private function maybe_print_message() {
807 807
 
808
-        if( rgpost('action') === 'update' ) {
808
+        if ( rgpost( 'action' ) === 'update' ) {
809 809
 
810 810
             $back_link = esc_url( remove_query_arg( array( 'page', 'view', 'edit' ) ) );
811 811
 
812
-            if( ! $this->is_valid ){
812
+            if ( ! $this->is_valid ) {
813 813
 
814 814
                 // Keeping this compatible with Gravity Forms.
815
-                $validation_message = "<div class='validation_error'>" . __('There was a problem with your submission.', 'gravityview') . " " . __('Errors have been highlighted below.', 'gravityview') . "</div>";
816
-                $message = apply_filters("gform_validation_message_{$this->form['id']}", apply_filters("gform_validation_message", $validation_message, $this->form), $this->form);
815
+                $validation_message = "<div class='validation_error'>" . __( 'There was a problem with your submission.', 'gravityview' ) . " " . __( 'Errors have been highlighted below.', 'gravityview' ) . "</div>";
816
+                $message = apply_filters( "gform_validation_message_{$this->form[ 'id' ]}", apply_filters( "gform_validation_message", $validation_message, $this->form ), $this->form );
817 817
 
818
-                echo GVCommon::generate_notice( $message , 'gv-error' );
818
+                echo GVCommon::generate_notice( $message, 'gv-error' );
819 819
 
820 820
             } else {
821
-                $entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturn to Entry%s', 'gravityview'), '<a href="'. $back_link .'">', '</a>' );
821
+                $entry_updated_message = sprintf( esc_attr__( 'Entry Updated. %sReturn to Entry%s', 'gravityview' ), '<a href="' . $back_link . '">', '</a>' );
822 822
 
823 823
                 /**
824 824
                  * @filter `gravityview/edit_entry/success` Modify the edit entry success message (including the anchor link)
@@ -828,7 +828,7 @@  discard block
 block discarded – undo
828 828
                  * @param array $entry Gravity Forms entry array
829 829
                  * @param string $back_link URL to return to the original entry. @since 1.6
830 830
                  */
831
-                $message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message , $this->view_id, $this->entry, $back_link );
831
+                $message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message, $this->view_id, $this->entry, $back_link );
832 832
 
833 833
                 echo GVCommon::generate_notice( $message );
834 834
             }
@@ -852,24 +852,24 @@  discard block
 block discarded – undo
852 852
          */
853 853
         do_action( 'gravityview/edit-entry/render/before', $this );
854 854
 
855
-        add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields'), 5000, 3 );
856
-        add_filter( 'gform_submit_button', array( $this, 'render_form_buttons') );
855
+        add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000, 3 );
856
+        add_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) );
857 857
         add_filter( 'gform_disable_view_counter', '__return_true' );
858 858
 
859 859
         add_filter( 'gform_field_input', array( $this, 'verify_user_can_edit_post' ), 5, 5 );
860 860
         add_filter( 'gform_field_input', array( $this, 'modify_edit_field_input' ), 10, 5 );
861 861
 
862
-        add_filter( 'gform_field_value', array( $this, 'fix_survey_fields_value'), 10, 3 );
862
+        add_filter( 'gform_field_value', array( $this, 'fix_survey_fields_value' ), 10, 3 );
863 863
 
864 864
         // We need to remove the fake $_GET['page'] arg to avoid rendering form as if in admin.
865
-        unset( $_GET['page'] );
865
+        unset( $_GET[ 'page' ] );
866 866
 
867 867
         // TODO: Verify multiple-page forms
868 868
         // TODO: Product fields are not editable
869 869
 
870
-        $html = GFFormDisplay::get_form( $this->form['id'], false, false, true, $this->entry );
870
+        $html = GFFormDisplay::get_form( $this->form[ 'id' ], false, false, true, $this->entry );
871 871
 
872
-        remove_filter( 'gform_field_value', array( $this, 'fix_survey_fields_value'), 10 );
872
+        remove_filter( 'gform_field_value', array( $this, 'fix_survey_fields_value' ), 10 );
873 873
 	    remove_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000 );
874 874
         remove_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) );
875 875
         remove_filter( 'gform_disable_view_counter', '__return_true' );
@@ -902,7 +902,7 @@  discard block
 block discarded – undo
902 902
      */
903 903
     function fix_survey_fields_value( $value, $field, $name ) {
904 904
         
905
-        if( 'survey' === $field->type ) {
905
+        if ( 'survey' === $field->type ) {
906 906
 
907 907
 	        // We need to run through each survey row until we find a match for expected values
908 908
 	        foreach ( $this->entry as $field_id => $field_value ) {
@@ -911,11 +911,11 @@  discard block
 block discarded – undo
911 911
 			        continue;
912 912
 		        }
913 913
 
914
-		        if( rgar( $field, 'gsurveyLikertEnableMultipleRows' ) ) {
914
+		        if ( rgar( $field, 'gsurveyLikertEnableMultipleRows' ) ) {
915 915
 			        list( $row_val, $col_val ) = explode( ':', $field_value, 2 );
916 916
 
917 917
 		            // If the $name matches the $row_val, we are processing the correct row
918
-			        if( $row_val === $name ) {
918
+			        if ( $row_val === $name ) {
919 919
 				        $value = $field_value;
920 920
 				        break;
921 921
 			        }
@@ -936,7 +936,7 @@  discard block
 block discarded – undo
936 936
      * @return string
937 937
      */
938 938
     public function render_form_buttons() {
939
-        return gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/form-buttons.php', $this );
939
+        return gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/form-buttons.php', $this );
940 940
     }
941 941
 
942 942
 
@@ -956,17 +956,17 @@  discard block
 block discarded – undo
956 956
     public function filter_modify_form_fields( $form, $ajax = false, $field_values = '' ) {
957 957
 
958 958
         // In case we have validated the form, use it to inject the validation results into the form render
959
-        if( isset( $this->form_after_validation ) ) {
959
+        if ( isset( $this->form_after_validation ) ) {
960 960
             $form = $this->form_after_validation;
961 961
         } else {
962
-            $form['fields'] = $this->get_configured_edit_fields( $form, $this->view_id );
962
+            $form[ 'fields' ] = $this->get_configured_edit_fields( $form, $this->view_id );
963 963
         }
964 964
 
965 965
         $form = $this->filter_conditional_logic( $form );
966 966
 
967 967
         // for now we don't support Save and Continue feature.
968
-        if( ! self::$supports_save_and_continue ) {
969
-	        unset( $form['save'] );
968
+        if ( ! self::$supports_save_and_continue ) {
969
+	        unset( $form[ 'save' ] );
970 970
         }
971 971
 
972 972
         return $form;
@@ -987,29 +987,29 @@  discard block
 block discarded – undo
987 987
      */
988 988
     function verify_user_can_edit_post( $field_content = '', $field, $value, $lead_id = 0, $form_id ) {
989 989
 
990
-        if( GFCommon::is_post_field( $field ) ) {
990
+        if ( GFCommon::is_post_field( $field ) ) {
991 991
 
992 992
             $message = null;
993 993
 
994 994
             // First, make sure they have the capability to edit the post.
995
-            if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) {
995
+            if ( false === current_user_can( 'edit_post', $this->entry[ 'post_id' ] ) ) {
996 996
 
997 997
                 /**
998 998
                  * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post
999 999
                  * @param string $message The existing "You don't have permission..." text
1000 1000
                  */
1001
-                $message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don&rsquo;t have permission to edit this post.', 'gravityview') );
1001
+                $message = apply_filters( 'gravityview/edit_entry/unsupported_post_field_text', __( 'You don&rsquo;t have permission to edit this post.', 'gravityview' ) );
1002 1002
 
1003
-            } elseif( null === get_post( $this->entry['post_id'] ) ) {
1003
+            } elseif ( null === get_post( $this->entry[ 'post_id' ] ) ) {
1004 1004
                 /**
1005 1005
                  * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists
1006 1006
                  * @param string $message The existing "This field is not editable; the post no longer exists." text
1007 1007
                  */
1008
-                $message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) );
1008
+                $message = apply_filters( 'gravityview/edit_entry/no_post_text', __( 'This field is not editable; the post no longer exists.', 'gravityview' ) );
1009 1009
             }
1010 1010
 
1011
-            if( $message ) {
1012
-                $field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1011
+            if ( $message ) {
1012
+                $field_content = sprintf( '<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1013 1013
             }
1014 1014
         }
1015 1015
 
@@ -1034,8 +1034,8 @@  discard block
 block discarded – undo
1034 1034
 
1035 1035
         // If the form has been submitted, then we don't need to pre-fill the values,
1036 1036
         // Except for fileupload type and when a field input is overridden- run always!!
1037
-        if(
1038
-            ( $this->is_edit_entry_submission() && !in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
1037
+        if (
1038
+            ( $this->is_edit_entry_submission() && ! in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
1039 1039
             && false === ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) )
1040 1040
             || ! empty( $field_content )
1041 1041
             || in_array( $field->type, array( 'honeypot' ) )
@@ -1045,8 +1045,8 @@  discard block
 block discarded – undo
1045 1045
         }
1046 1046
 
1047 1047
         // Turn on Admin-style display for file upload fields only
1048
-        if( 'fileupload' === $field->type ) {
1049
-            $_GET['page'] = 'gf_entries';
1048
+        if ( 'fileupload' === $field->type ) {
1049
+            $_GET[ 'page' ] = 'gf_entries';
1050 1050
         }
1051 1051
 
1052 1052
         // SET SOME FIELD DEFAULTS TO PREVENT ISSUES
@@ -1073,12 +1073,12 @@  discard block
 block discarded – undo
1073 1073
          * @param mixed $field_value field value used to populate the input
1074 1074
          * @param GF_Field $field Gravity Forms field object
1075 1075
          */
1076
-        $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field );
1076
+        $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type, $field_value, $field );
1077 1077
 
1078 1078
 	    // Prevent any PHP warnings, like undefined index
1079 1079
 	    ob_start();
1080 1080
 
1081
-        if( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1081
+        if ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1082 1082
             /** @var GF_Field $gv_field */
1083 1083
             $return = $gv_field->get_field_input( $this->form, $field_value, $this->entry, $field );
1084 1084
         } else {
@@ -1089,7 +1089,7 @@  discard block
 block discarded – undo
1089 1089
 	    // If there was output, it's an error
1090 1090
 	    $warnings = ob_get_clean();
1091 1091
 
1092
-	    if( !empty( $warnings ) ) {
1092
+	    if ( ! empty( $warnings ) ) {
1093 1093
 		    do_action( 'gravityview_log_error', __METHOD__ . $warnings, $field_value );
1094 1094
 	    }
1095 1095
 
@@ -1098,7 +1098,7 @@  discard block
 block discarded – undo
1098 1098
          * We need the fileupload html field to render with the proper id
1099 1099
          *  ( <li id="field_80_16" ... > )
1100 1100
          */
1101
-        unset( $_GET['page'] );
1101
+        unset( $_GET[ 'page' ] );
1102 1102
 
1103 1103
         return $return;
1104 1104
     }
@@ -1121,7 +1121,7 @@  discard block
 block discarded – undo
1121 1121
         $override_saved_value = apply_filters( 'gravityview/edit_entry/pre_populate/override', false, $field );
1122 1122
 
1123 1123
         // We're dealing with multiple inputs (e.g. checkbox) but not time or date (as it doesn't store data in input IDs)
1124
-        if( isset( $field->inputs ) && is_array( $field->inputs ) && !in_array( $field->type, array( 'time', 'date' ) ) ) {
1124
+        if ( isset( $field->inputs ) && is_array( $field->inputs ) && ! in_array( $field->type, array( 'time', 'date' ) ) ) {
1125 1125
 
1126 1126
             $field_value = array();
1127 1127
 
@@ -1130,10 +1130,10 @@  discard block
 block discarded – undo
1130 1130
 
1131 1131
             foreach ( (array)$field->inputs as $input ) {
1132 1132
 
1133
-                $input_id = strval( $input['id'] );
1133
+                $input_id = strval( $input[ 'id' ] );
1134 1134
                 
1135 1135
                 if ( isset( $this->entry[ $input_id ] ) && ! gv_empty( $this->entry[ $input_id ], false, false ) ) {
1136
-                    $field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1136
+                    $field_value[ $input_id ] = 'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1137 1137
                     $allow_pre_populated = false;
1138 1138
                 }
1139 1139
 
@@ -1141,7 +1141,7 @@  discard block
 block discarded – undo
1141 1141
 
1142 1142
             $pre_value = $field->get_value_submission( array(), false );
1143 1143
 
1144
-            $field_value = ! $allow_pre_populated && ! ( $override_saved_value && !gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
1144
+            $field_value = ! $allow_pre_populated && ! ( $override_saved_value && ! gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
1145 1145
 
1146 1146
         } else {
1147 1147
 
@@ -1152,13 +1152,13 @@  discard block
 block discarded – undo
1152 1152
 
1153 1153
             // saved field entry value (if empty, fallback to the pre-populated value, if exists)
1154 1154
             // or pre-populated value if not empty and set to override saved value
1155
-            $field_value = !gv_empty( $this->entry[ $id ], false, false ) && ! ( $override_saved_value && !gv_empty( $pre_value, false, false ) ) ? $this->entry[ $id ] : $pre_value;
1155
+            $field_value = ! gv_empty( $this->entry[ $id ], false, false ) && ! ( $override_saved_value && ! gv_empty( $pre_value, false, false ) ) ? $this->entry[ $id ] : $pre_value;
1156 1156
 
1157 1157
             // in case field is post_category but inputType is select, multi-select or radio, convert value into array of category IDs.
1158
-            if ( 'post_category' === $field->type && !gv_empty( $field_value, false, false ) ) {
1158
+            if ( 'post_category' === $field->type && ! gv_empty( $field_value, false, false ) ) {
1159 1159
                 $categories = array();
1160 1160
                 foreach ( explode( ',', $field_value ) as $cat_string ) {
1161
-                    $categories[] = GFCommon::format_post_category( $cat_string, true );
1161
+                    $categories[ ] = GFCommon::format_post_category( $cat_string, true );
1162 1162
                 }
1163 1163
                 $field_value = 'multiselect' === $field->get_input_type() ? $categories : implode( '', $categories );
1164 1164
             }
@@ -1183,12 +1183,12 @@  discard block
 block discarded – undo
1183 1183
      */
1184 1184
     function gform_pre_validation( $form ) {
1185 1185
 
1186
-        if( ! $this->verify_nonce() ) {
1186
+        if ( ! $this->verify_nonce() ) {
1187 1187
             return $form;
1188 1188
         }
1189 1189
 
1190 1190
         // Fix PHP warning regarding undefined index.
1191
-        foreach ( $form['fields'] as &$field) {
1191
+        foreach ( $form[ 'fields' ] as &$field ) {
1192 1192
 
1193 1193
             // This is because we're doing admin form pretending to be front-end, so Gravity Forms
1194 1194
             // expects certain field array items to be set.
@@ -1201,7 +1201,7 @@  discard block
 block discarded – undo
1201 1201
                 $field['emailConfirmEnabled'] = '';
1202 1202
             }*/
1203 1203
 
1204
-            switch( RGFormsModel::get_input_type( $field ) ) {
1204
+            switch ( RGFormsModel::get_input_type( $field ) ) {
1205 1205
 
1206 1206
                 /**
1207 1207
                  * 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.
@@ -1215,37 +1215,37 @@  discard block
 block discarded – undo
1215 1215
                     // Set the previous value
1216 1216
                     $entry = $this->get_entry();
1217 1217
 
1218
-                    $input_name = 'input_'.$field->id;
1219
-                    $form_id = $form['id'];
1218
+                    $input_name = 'input_' . $field->id;
1219
+                    $form_id = $form[ 'id' ];
1220 1220
 
1221 1221
                     $value = NULL;
1222 1222
 
1223 1223
                     // Use the previous entry value as the default.
1224
-                    if( isset( $entry[ $field->id ] ) ) {
1224
+                    if ( isset( $entry[ $field->id ] ) ) {
1225 1225
                         $value = $entry[ $field->id ];
1226 1226
                     }
1227 1227
 
1228 1228
                     // If this is a single upload file
1229
-                    if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1230
-                        $file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1231
-                        $value = $file_path['url'];
1229
+                    if ( ! empty( $_FILES[ $input_name ] ) && ! empty( $_FILES[ $input_name ][ 'name' ] ) ) {
1230
+                        $file_path = GFFormsModel::get_file_upload_path( $form[ 'id' ], $_FILES[ $input_name ][ 'name' ] );
1231
+                        $value = $file_path[ 'url' ];
1232 1232
 
1233 1233
                     } else {
1234 1234
 
1235 1235
                         // Fix PHP warning on line 1498 of form_display.php for post_image fields
1236 1236
                         // Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1237
-                        $_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1237
+                        $_FILES[ $input_name ] = array( 'name' => '', 'size' => '' );
1238 1238
 
1239 1239
                     }
1240 1240
 
1241
-                    if( rgar($field, "multipleFiles") ) {
1241
+                    if ( rgar( $field, "multipleFiles" ) ) {
1242 1242
 
1243 1243
                         // If there are fresh uploads, process and merge them.
1244 1244
                         // Otherwise, use the passed values, which should be json-encoded array of URLs
1245
-                        if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) {
1245
+                        if ( isset( GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] ) ) {
1246 1246
                             $value = empty( $value ) ? '[]' : $value;
1247 1247
                             $value = stripslashes_deep( $value );
1248
-                            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array());
1248
+                            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ], array() );
1249 1249
                         }
1250 1250
 
1251 1251
                     } else {
@@ -1263,14 +1263,14 @@  discard block
 block discarded – undo
1263 1263
 
1264 1264
                 case 'number':
1265 1265
                     // Fix "undefined index" issue at line 1286 in form_display.php
1266
-                    if( !isset( $_POST['input_'.$field->id ] ) ) {
1267
-                        $_POST['input_'.$field->id ] = NULL;
1266
+                    if ( ! isset( $_POST[ 'input_' . $field->id ] ) ) {
1267
+                        $_POST[ 'input_' . $field->id ] = NULL;
1268 1268
                     }
1269 1269
                     break;
1270 1270
                 case 'captcha':
1271 1271
                     // Fix issue with recaptcha_check_answer() on line 1458 in form_display.php
1272
-                    $_POST['recaptcha_challenge_field'] = NULL;
1273
-                    $_POST['recaptcha_response_field'] = NULL;
1272
+                    $_POST[ 'recaptcha_challenge_field' ] = NULL;
1273
+                    $_POST[ 'recaptcha_response_field' ] = NULL;
1274 1274
                     break;
1275 1275
             }
1276 1276
 
@@ -1306,7 +1306,7 @@  discard block
 block discarded – undo
1306 1306
          * You can enter whatever you want!
1307 1307
          * We try validating, and customize the results using `self::custom_validation()`
1308 1308
          */
1309
-        add_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10, 4);
1309
+        add_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10, 4 );
1310 1310
 
1311 1311
         // Needed by the validate funtion
1312 1312
         $failed_validation_page = NULL;
@@ -1314,14 +1314,14 @@  discard block
 block discarded – undo
1314 1314
 
1315 1315
         // Prevent entry limit from running when editing an entry, also
1316 1316
         // prevent form scheduling from preventing editing
1317
-        unset( $this->form['limitEntries'], $this->form['scheduleForm'] );
1317
+        unset( $this->form[ 'limitEntries' ], $this->form[ 'scheduleForm' ] );
1318 1318
 
1319 1319
         // Hide fields depending on Edit Entry settings
1320
-        $this->form['fields'] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1320
+        $this->form[ 'fields' ] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1321 1321
 
1322 1322
         $this->is_valid = GFFormDisplay::validate( $this->form, $field_values, 1, $failed_validation_page );
1323 1323
 
1324
-        remove_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10 );
1324
+        remove_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10 );
1325 1325
     }
1326 1326
 
1327 1327
 
@@ -1338,13 +1338,13 @@  discard block
 block discarded – undo
1338 1338
      */
1339 1339
     function custom_validation( $validation_results ) {
1340 1340
 
1341
-        do_action('gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Validation results: ', $validation_results );
1341
+        do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Validation results: ', $validation_results );
1342 1342
 
1343
-        do_action('gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] $_POSTed data (sanitized): ', esc_html( print_r( $_POST, true ) ) );
1343
+        do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] $_POSTed data (sanitized): ', esc_html( print_r( $_POST, true ) ) );
1344 1344
 
1345 1345
         $gv_valid = true;
1346 1346
 
1347
-        foreach ( $validation_results['form']['fields'] as $key => &$field ) {
1347
+        foreach ( $validation_results[ 'form' ][ 'fields' ] as $key => &$field ) {
1348 1348
 
1349 1349
             $value = RGFormsModel::get_field_value( $field );
1350 1350
             $field_type = RGFormsModel::get_input_type( $field );
@@ -1357,35 +1357,35 @@  discard block
 block discarded – undo
1357 1357
                 case 'post_image':
1358 1358
 
1359 1359
                     // in case nothing is uploaded but there are already files saved
1360
-                    if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) {
1360
+                    if ( ! empty( $field->failed_validation ) && ! empty( $field->isRequired ) && ! empty( $value ) ) {
1361 1361
                         $field->failed_validation = false;
1362 1362
                         unset( $field->validation_message );
1363 1363
                     }
1364 1364
 
1365 1365
                     // validate if multi file upload reached max number of files [maxFiles] => 2
1366
-                    if( rgobj( $field, 'maxFiles') && rgobj( $field, 'multipleFiles') ) {
1366
+                    if ( rgobj( $field, 'maxFiles' ) && rgobj( $field, 'multipleFiles' ) ) {
1367 1367
 
1368 1368
                         $input_name = 'input_' . $field->id;
1369 1369
                         //uploaded
1370
-                        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1370
+                        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] : array();
1371 1371
 
1372 1372
                         //existent
1373 1373
                         $entry = $this->get_entry();
1374 1374
                         $value = NULL;
1375
-                        if( isset( $entry[ $field->id ] ) ) {
1375
+                        if ( isset( $entry[ $field->id ] ) ) {
1376 1376
                             $value = json_decode( $entry[ $field->id ], true );
1377 1377
                         }
1378 1378
 
1379 1379
                         // count uploaded files and existent entry files
1380 1380
                         $count_files = count( $file_names ) + count( $value );
1381 1381
 
1382
-                        if( $count_files > $field->maxFiles ) {
1382
+                        if ( $count_files > $field->maxFiles ) {
1383 1383
                             $field->validation_message = __( 'Maximum number of files reached', 'gravityview' );
1384 1384
                             $field->failed_validation = 1;
1385 1385
                             $gv_valid = false;
1386 1386
 
1387 1387
                             // in case of error make sure the newest upload files are removed from the upload input
1388
-                            GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1388
+                            GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ] = null;
1389 1389
                         }
1390 1390
 
1391 1391
                     }
@@ -1396,7 +1396,7 @@  discard block
 block discarded – undo
1396 1396
             }
1397 1397
 
1398 1398
             // This field has failed validation.
1399
-            if( !empty( $field->failed_validation ) ) {
1399
+            if ( ! empty( $field->failed_validation ) ) {
1400 1400
 
1401 1401
                 do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Field is invalid.', array( 'field' => $field, 'value' => $value ) );
1402 1402
 
@@ -1414,32 +1414,32 @@  discard block
 block discarded – undo
1414 1414
                 }
1415 1415
 
1416 1416
                 // You can't continue inside a switch, so we do it after.
1417
-                if( empty( $field->failed_validation ) ) {
1417
+                if ( empty( $field->failed_validation ) ) {
1418 1418
                     continue;
1419 1419
                 }
1420 1420
 
1421 1421
                 // checks if the No Duplicates option is not validating entry against itself, since
1422 1422
                 // we're editing a stored entry, it would also assume it's a duplicate.
1423
-                if( !empty( $field->noDuplicates ) ) {
1423
+                if ( ! empty( $field->noDuplicates ) ) {
1424 1424
 
1425 1425
                     $entry = $this->get_entry();
1426 1426
 
1427 1427
                     // If the value of the entry is the same as the stored value
1428 1428
                     // Then we can assume it's not a duplicate, it's the same.
1429
-                    if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1429
+                    if ( ! empty( $entry ) && $value == $entry[ $field->id ] ) {
1430 1430
                         //if value submitted was not changed, then don't validate
1431 1431
                         $field->failed_validation = false;
1432 1432
 
1433 1433
                         unset( $field->validation_message );
1434 1434
 
1435
-                        do_action('gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', $entry );
1435
+                        do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', $entry );
1436 1436
 
1437 1437
                         continue;
1438 1438
                     }
1439 1439
                 }
1440 1440
 
1441 1441
                 // if here then probably we are facing the validation 'At least one field must be filled out'
1442
-                if( GFFormDisplay::is_empty( $field, $this->form_id  ) && empty( $field->isRequired ) ) {
1442
+                if ( GFFormDisplay::is_empty( $field, $this->form_id ) && empty( $field->isRequired ) ) {
1443 1443
                     unset( $field->validation_message );
1444 1444
 	                $field->validation_message = false;
1445 1445
                     continue;
@@ -1451,12 +1451,12 @@  discard block
 block discarded – undo
1451 1451
 
1452 1452
         }
1453 1453
 
1454
-        $validation_results['is_valid'] = $gv_valid;
1454
+        $validation_results[ 'is_valid' ] = $gv_valid;
1455 1455
 
1456
-        do_action('gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Validation results.', $validation_results );
1456
+        do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Validation results.', $validation_results );
1457 1457
 
1458 1458
         // We'll need this result when rendering the form ( on GFFormDisplay::get_form )
1459
-        $this->form_after_validation = $validation_results['form'];
1459
+        $this->form_after_validation = $validation_results[ 'form' ];
1460 1460
 
1461 1461
         return $validation_results;
1462 1462
     }
@@ -1469,7 +1469,7 @@  discard block
 block discarded – undo
1469 1469
      */
1470 1470
     public function get_entry() {
1471 1471
 
1472
-        if( empty( $this->entry ) ) {
1472
+        if ( empty( $this->entry ) ) {
1473 1473
             // Get the database value of the entry that's being edited
1474 1474
             $this->entry = gravityview_get_entry( GravityView_frontend::is_single_entry() );
1475 1475
         }
@@ -1496,13 +1496,13 @@  discard block
 block discarded – undo
1496 1496
         $properties = GravityView_View_Data::getInstance()->get_fields( $view_id );
1497 1497
 
1498 1498
         // If edit tab not yet configured, show all fields
1499
-        $edit_fields = !empty( $properties['edit_edit-fields'] ) ? $properties['edit_edit-fields'] : NULL;
1499
+        $edit_fields = ! empty( $properties[ 'edit_edit-fields' ] ) ? $properties[ 'edit_edit-fields' ] : NULL;
1500 1500
 
1501 1501
         // Show hidden fields as text fields
1502 1502
         $form = $this->fix_survey_fields( $form );
1503 1503
 
1504 1504
         // Hide fields depending on admin settings
1505
-        $fields = $this->filter_fields( $form['fields'], $edit_fields );
1505
+        $fields = $this->filter_fields( $form[ 'fields' ], $edit_fields );
1506 1506
 
1507 1507
 	    // If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1508 1508
 	    $fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
@@ -1532,7 +1532,7 @@  discard block
 block discarded – undo
1532 1532
     private function fix_survey_fields( $form ) {
1533 1533
 
1534 1534
         /** @var GF_Field $field */
1535
-        foreach( $form['fields'] as &$field ) {
1535
+        foreach ( $form[ 'fields' ] as &$field ) {
1536 1536
             $field->allowsPrepopulate = true;
1537 1537
         }
1538 1538
 
@@ -1553,7 +1553,7 @@  discard block
 block discarded – undo
1553 1553
      */
1554 1554
     private function filter_fields( $fields, $configured_fields ) {
1555 1555
 
1556
-        if( empty( $fields ) || !is_array( $fields ) ) {
1556
+        if ( empty( $fields ) || ! is_array( $fields ) ) {
1557 1557
             return $fields;
1558 1558
         }
1559 1559
 
@@ -1570,13 +1570,13 @@  discard block
 block discarded – undo
1570 1570
 	     */
1571 1571
 	    $hide_product_fields = apply_filters( 'gravityview/edit_entry/hide-product-fields', empty( self::$supports_product_fields ) );
1572 1572
 
1573
-	    if( $hide_product_fields ) {
1574
-		    $field_type_blacklist[] = 'option';
1575
-		    $field_type_blacklist[] = 'quantity';
1576
-            $field_type_blacklist[] = 'product';
1577
-            $field_type_blacklist[] = 'total';
1578
-            $field_type_blacklist[] = 'shipping';
1579
-            $field_type_blacklist[] = 'calculation';
1573
+	    if ( $hide_product_fields ) {
1574
+		    $field_type_blacklist[ ] = 'option';
1575
+		    $field_type_blacklist[ ] = 'quantity';
1576
+            $field_type_blacklist[ ] = 'product';
1577
+            $field_type_blacklist[ ] = 'total';
1578
+            $field_type_blacklist[ ] = 'shipping';
1579
+            $field_type_blacklist[ ] = 'calculation';
1580 1580
 	    }
1581 1581
 
1582 1582
         // First, remove blacklist or calculation fields
@@ -1584,24 +1584,24 @@  discard block
 block discarded – undo
1584 1584
 
1585 1585
             // Remove the fields that have calculation properties and keep them to be used later
1586 1586
             // @since 1.16.2
1587
-            if( $field->has_calculation() ) {
1588
-                $this->fields_with_calculation[] = $field;
1587
+            if ( $field->has_calculation() ) {
1588
+                $this->fields_with_calculation[ ] = $field;
1589 1589
                 // don't remove the calculation fields on form render.
1590 1590
             }
1591 1591
 
1592 1592
             // process total field after all fields have been saved
1593 1593
             if ( $field->type == 'total' ) {
1594
-                $this->total_fields[] = $field;
1594
+                $this->total_fields[ ] = $field;
1595 1595
                 unset( $fields[ $key ] );
1596 1596
             }
1597 1597
 
1598
-            if( in_array( $field->type, $field_type_blacklist ) ) {
1598
+            if ( in_array( $field->type, $field_type_blacklist ) ) {
1599 1599
                 unset( $fields[ $key ] );
1600 1600
             }
1601 1601
         }
1602 1602
 
1603 1603
         // The Edit tab has not been configured, so we return all fields by default.
1604
-        if( empty( $configured_fields ) ) {
1604
+        if ( empty( $configured_fields ) ) {
1605 1605
             return $fields;
1606 1606
         }
1607 1607
 
@@ -1611,8 +1611,8 @@  discard block
 block discarded – undo
1611 1611
 	        /** @var GF_Field $field */
1612 1612
 	        foreach ( $fields as $field ) {
1613 1613
 
1614
-                if( intval( $configured_field['id'] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1615
-                    $edit_fields[] = $this->merge_field_properties( $field, $configured_field );
1614
+                if ( intval( $configured_field[ 'id' ] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1615
+                    $edit_fields[ ] = $this->merge_field_properties( $field, $configured_field );
1616 1616
                     break;
1617 1617
                 }
1618 1618
 
@@ -1635,14 +1635,14 @@  discard block
 block discarded – undo
1635 1635
 
1636 1636
         $return_field = $field;
1637 1637
 
1638
-        if( empty( $field_setting['show_label'] ) ) {
1638
+        if ( empty( $field_setting[ 'show_label' ] ) ) {
1639 1639
             $return_field->label = '';
1640
-        } elseif ( !empty( $field_setting['custom_label'] ) ) {
1641
-            $return_field->label = $field_setting['custom_label'];
1640
+        } elseif ( ! empty( $field_setting[ 'custom_label' ] ) ) {
1641
+            $return_field->label = $field_setting[ 'custom_label' ];
1642 1642
         }
1643 1643
 
1644
-        if( !empty( $field_setting['custom_class'] ) ) {
1645
-            $return_field->cssClass .= ' '. gravityview_sanitize_html_class( $field_setting['custom_class'] );
1644
+        if ( ! empty( $field_setting[ 'custom_class' ] ) ) {
1645
+            $return_field->cssClass .= ' ' . gravityview_sanitize_html_class( $field_setting[ 'custom_class' ] );
1646 1646
         }
1647 1647
 
1648 1648
         /**
@@ -1680,16 +1680,16 @@  discard block
 block discarded – undo
1680 1680
 	     */
1681 1681
 	    $use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
1682 1682
 
1683
-	    if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
1684
-            foreach( $fields as $k => $field ) {
1685
-                if( $field->adminOnly ) {
1683
+	    if ( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry[ 'id' ] ) ) {
1684
+            foreach ( $fields as $k => $field ) {
1685
+                if ( $field->adminOnly ) {
1686 1686
                     unset( $fields[ $k ] );
1687 1687
                 }
1688 1688
             }
1689 1689
             return $fields;
1690 1690
         }
1691 1691
 
1692
-	    foreach( $fields as &$field ) {
1692
+	    foreach ( $fields as &$field ) {
1693 1693
 		    $field->adminOnly = false;
1694 1694
         }
1695 1695
 
@@ -1716,16 +1716,16 @@  discard block
 block discarded – undo
1716 1716
          */
1717 1717
         $use_conditional_logic = apply_filters( 'gravityview/edit_entry/conditional_logic', true, $form );
1718 1718
 
1719
-        if( $use_conditional_logic ) {
1719
+        if ( $use_conditional_logic ) {
1720 1720
             return $form;
1721 1721
         }
1722 1722
 
1723
-        foreach( $form['fields'] as &$field ) {
1723
+        foreach ( $form[ 'fields' ] as &$field ) {
1724 1724
             /* @var GF_Field $field */
1725 1725
             $field->conditionalLogic = null;
1726 1726
         }
1727 1727
 
1728
-        unset( $form['button']['conditionalLogic'] );
1728
+        unset( $form[ 'button' ][ 'conditionalLogic' ] );
1729 1729
 
1730 1730
         return $form;
1731 1731
 
@@ -1742,7 +1742,7 @@  discard block
 block discarded – undo
1742 1742
      */
1743 1743
     function manage_conditional_logic( $has_conditional_logic, $form ) {
1744 1744
 
1745
-        if( ! $this->is_edit_entry() ) {
1745
+        if ( ! $this->is_edit_entry() ) {
1746 1746
             return $has_conditional_logic;
1747 1747
         }
1748 1748
 
@@ -1773,44 +1773,44 @@  discard block
 block discarded – undo
1773 1773
          *  2. There are two entries embedded using oEmbed
1774 1774
          *  3. One of the entries has just been saved
1775 1775
          */
1776
-        if( !empty( $_POST['lid'] ) && !empty( $_GET['entry'] ) && ( $_POST['lid'] !== $_GET['entry'] ) ) {
1776
+        if ( ! empty( $_POST[ 'lid' ] ) && ! empty( $_GET[ 'entry' ] ) && ( $_POST[ 'lid' ] !== $_GET[ 'entry' ] ) ) {
1777 1777
 
1778 1778
             $error = true;
1779 1779
 
1780 1780
         }
1781 1781
 
1782
-        if( !empty( $_GET['entry'] ) && (string)$this->entry['id'] !== $_GET['entry'] ) {
1782
+        if ( ! empty( $_GET[ 'entry' ] ) && (string)$this->entry[ 'id' ] !== $_GET[ 'entry' ] ) {
1783 1783
 
1784 1784
             $error = true;
1785 1785
 
1786
-        } elseif( ! $this->verify_nonce() ) {
1786
+        } elseif ( ! $this->verify_nonce() ) {
1787 1787
 
1788 1788
             /**
1789 1789
              * If the Entry is embedded, there may be two entries on the same page.
1790 1790
              * If that's the case, and one is being edited, the other should fail gracefully and not display an error.
1791 1791
              */
1792
-            if( GravityView_oEmbed::getInstance()->get_entry_id() ) {
1792
+            if ( GravityView_oEmbed::getInstance()->get_entry_id() ) {
1793 1793
                 $error = true;
1794 1794
             } else {
1795
-                $error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview');
1795
+                $error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview' );
1796 1796
             }
1797 1797
 
1798 1798
         }
1799 1799
 
1800
-        if( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
1801
-            $error = __( 'You do not have permission to edit this entry.', 'gravityview');
1800
+        if ( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
1801
+            $error = __( 'You do not have permission to edit this entry.', 'gravityview' );
1802 1802
         }
1803 1803
 
1804
-        if( $this->entry['status'] === 'trash' ) {
1805
-            $error = __('You cannot edit the entry; it is in the trash.', 'gravityview' );
1804
+        if ( $this->entry[ 'status' ] === 'trash' ) {
1805
+            $error = __( 'You cannot edit the entry; it is in the trash.', 'gravityview' );
1806 1806
         }
1807 1807
 
1808 1808
         // No errors; everything's fine here!
1809
-        if( empty( $error ) ) {
1809
+        if ( empty( $error ) ) {
1810 1810
             return true;
1811 1811
         }
1812 1812
 
1813
-        if( $echo && $error !== true ) {
1813
+        if ( $echo && $error !== true ) {
1814 1814
 
1815 1815
 	        $error = esc_html( $error );
1816 1816
 
@@ -1818,13 +1818,13 @@  discard block
 block discarded – undo
1818 1818
 	         * @since 1.9
1819 1819
 	         */
1820 1820
 	        if ( ! empty( $this->entry ) ) {
1821
-		        $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;" ) );
1821
+		        $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;" ) );
1822 1822
 	        }
1823 1823
 
1824
-            echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error');
1824
+            echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error' );
1825 1825
         }
1826 1826
 
1827
-        do_action('gravityview_log_error', 'GravityView_Edit_Entry[user_can_edit_entry]' . $error );
1827
+        do_action( 'gravityview_log_error', 'GravityView_Edit_Entry[user_can_edit_entry]' . $error );
1828 1828
 
1829 1829
         return false;
1830 1830
     }
@@ -1841,20 +1841,20 @@  discard block
 block discarded – undo
1841 1841
 
1842 1842
         $error = NULL;
1843 1843
 
1844
-        if( ! $this->check_user_cap_edit_field( $field ) ) {
1845
-            $error = __( 'You do not have permission to edit this field.', 'gravityview');
1844
+        if ( ! $this->check_user_cap_edit_field( $field ) ) {
1845
+            $error = __( 'You do not have permission to edit this field.', 'gravityview' );
1846 1846
         }
1847 1847
 
1848 1848
         // No errors; everything's fine here!
1849
-        if( empty( $error ) ) {
1849
+        if ( empty( $error ) ) {
1850 1850
             return true;
1851 1851
         }
1852 1852
 
1853
-        if( $echo ) {
1854
-            echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error');
1853
+        if ( $echo ) {
1854
+            echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error' );
1855 1855
         }
1856 1856
 
1857
-        do_action('gravityview_log_error', 'GravityView_Edit_Entry[user_can_edit_field]' . $error );
1857
+        do_action( 'gravityview_log_error', 'GravityView_Edit_Entry[user_can_edit_field]' . $error );
1858 1858
 
1859 1859
         return false;
1860 1860
 
@@ -1872,15 +1872,15 @@  discard block
 block discarded – undo
1872 1872
     private function check_user_cap_edit_field( $field ) {
1873 1873
 
1874 1874
         // If they can edit any entries (as defined in Gravity Forms), we're good.
1875
-        if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
1875
+        if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
1876 1876
             return true;
1877 1877
         }
1878 1878
 
1879
-        $field_cap = isset( $field['allow_edit_cap'] ) ? $field['allow_edit_cap'] : false;
1879
+        $field_cap = isset( $field[ 'allow_edit_cap' ] ) ? $field[ 'allow_edit_cap' ] : false;
1880 1880
 
1881 1881
         // If the field has custom editing capaibilities set, check those
1882
-        if( $field_cap ) {
1883
-            return GVCommon::has_cap( $field['allow_edit_cap'] );
1882
+        if ( $field_cap ) {
1883
+            return GVCommon::has_cap( $field[ 'allow_edit_cap' ] );
1884 1884
         }
1885 1885
 
1886 1886
         return false;
@@ -1894,17 +1894,17 @@  discard block
 block discarded – undo
1894 1894
     public function verify_nonce() {
1895 1895
 
1896 1896
         // Verify form submitted for editing single
1897
-        if( $this->is_edit_entry_submission() ) {
1897
+        if ( $this->is_edit_entry_submission() ) {
1898 1898
             $valid = wp_verify_nonce( $_POST[ self::$nonce_field ], self::$nonce_field );
1899 1899
         }
1900 1900
 
1901 1901
         // Verify
1902
-        else if( ! $this->is_edit_entry() ) {
1902
+        else if ( ! $this->is_edit_entry() ) {
1903 1903
             $valid = false;
1904 1904
         }
1905 1905
 
1906 1906
         else {
1907
-            $valid = wp_verify_nonce( $_GET['edit'], self::$nonce_key );
1907
+            $valid = wp_verify_nonce( $_GET[ 'edit' ], self::$nonce_key );
1908 1908
         }
1909 1909
 
1910 1910
         /**
Please login to merge, or discard this patch.