Completed
Push — master ( 21157a...9cf7be )
by Zack
84:58 queued 65:12
created
includes/fields/class-gravityview-field-post-tags.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 
10 10
 	var $name = 'post_category';
11 11
 
12
-	var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains');
12
+	var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains' );
13 13
 
14 14
 	var $_gf_field_class_name = 'GF_Field_Post_Category';
15 15
 
@@ -22,12 +22,12 @@  discard block
 block discarded – undo
22 22
 
23 23
 	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
24 24
 
25
-		if( 'edit' === $context ) {
25
+		if ( 'edit' === $context ) {
26 26
 			return $field_options;
27 27
 		}
28 28
 
29
-		$this->add_field_support('dynamic_data', $field_options );
30
-		$this->add_field_support('link_to_term', $field_options );
29
+		$this->add_field_support( 'dynamic_data', $field_options );
30
+		$this->add_field_support( 'link_to_term', $field_options );
31 31
 
32 32
 		return $field_options;
33 33
 	}
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-checkbox.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
 
10 10
 	var $name = 'radio';
11 11
 
12
-	var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains');
12
+	var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains' );
13 13
 
14 14
 	var $_gf_field_class_name = 'GF_Field_Radio';
15 15
 
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-multiselect.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
 
10 10
 	var $name = 'radio';
11 11
 
12
-	var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains');
12
+	var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains' );
13 13
 
14 14
 	var $_gf_field_class_name = 'GF_Field_Radio';
15 15
 
Please login to merge, or discard this patch.
includes/extensions/edit-entry/class-edit-entry-render.php 1 patch
Spacing   +185 added lines, -185 removed lines patch added patch discarded remove patch
@@ -91,16 +91,16 @@  discard block
 block discarded – undo
91 91
     function load() {
92 92
 
93 93
         /** @define "GRAVITYVIEW_DIR" "../../../" */
94
-        include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' );
94
+        include_once( GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php' );
95 95
 
96 96
         // Don't display an embedded form when editing an entry
97 97
         add_action( 'wp_head', array( $this, 'prevent_render_form' ) );
98 98
         add_action( 'wp_footer', array( $this, 'prevent_render_form' ) );
99 99
 
100 100
         // Stop Gravity Forms processing what is ours!
101
-        add_filter( 'wp', array( $this, 'prevent_maybe_process_form'), 8 );
101
+        add_filter( 'wp', array( $this, 'prevent_maybe_process_form' ), 8 );
102 102
 
103
-        add_filter( 'gravityview_is_edit_entry', array( $this, 'is_edit_entry') );
103
+        add_filter( 'gravityview_is_edit_entry', array( $this, 'is_edit_entry' ) );
104 104
 
105 105
         add_action( 'gravityview_edit_entry', array( $this, 'init' ) );
106 106
 
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
         add_filter( 'gform_plupload_settings', array( $this, 'modify_fileupload_settings' ), 10, 3 );
112 112
 
113 113
         // Add fields expected by GFFormDisplay::validate()
114
-        add_filter( 'gform_pre_validation', array( $this, 'gform_pre_validation') );
114
+        add_filter( 'gform_pre_validation', array( $this, 'gform_pre_validation' ) );
115 115
 
116 116
     }
117 117
 
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
      * @return void
127 127
      */
128 128
     function prevent_render_form() {
129
-        if( $this->is_edit_entry() ) {
130
-            if( 'wp_head' === current_filter() ) {
129
+        if ( $this->is_edit_entry() ) {
130
+            if ( 'wp_head' === current_filter() ) {
131 131
                 add_filter( 'gform_shortcode_form', '__return_empty_string' );
132 132
             } else {
133 133
                 remove_filter( 'gform_shortcode_form', '__return_empty_string' );
@@ -142,10 +142,10 @@  discard block
 block discarded – undo
142 142
      */
143 143
     function prevent_maybe_process_form() {
144 144
 
145
-        do_action('gravityview_log_debug', 'GravityView_Edit_Entry[prevent_maybe_process_form] $_POSTed data (sanitized): ', esc_html( print_r( $_POST, true ) ) );
145
+        do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[prevent_maybe_process_form] $_POSTed data (sanitized): ', esc_html( print_r( $_POST, true ) ) );
146 146
 
147
-        if( $this->is_edit_entry_submission() && $this->verify_nonce() ) {
148
-            remove_action( 'wp',  array( 'RGForms', 'maybe_process_form'), 9 );
147
+        if ( $this->is_edit_entry_submission() && $this->verify_nonce() ) {
148
+            remove_action( 'wp', array( 'RGForms', 'maybe_process_form' ), 9 );
149 149
         }
150 150
     }
151 151
 
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 
158 158
         $gf_page = ( 'entry' === RGForms::get( 'view' ) );
159 159
 
160
-        return ( $gf_page && isset( $_GET['edit'] ) || RGForms::post( 'action' ) === 'update' );
160
+        return ( $gf_page && isset( $_GET[ 'edit' ] ) || RGForms::post( 'action' ) === 'update' );
161 161
     }
162 162
 
163 163
 	/**
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 	 * @return boolean
167 167
 	 */
168 168
 	public function is_edit_entry_submission() {
169
-		return !empty( $_POST[ self::$nonce_field ] );
169
+		return ! empty( $_POST[ self::$nonce_field ] );
170 170
 	}
171 171
 
172 172
     /**
@@ -177,14 +177,14 @@  discard block
 block discarded – undo
177 177
 
178 178
 
179 179
         $entries = $gravityview_view->getEntries();
180
-        $this->entry = $entries[0];
180
+        $this->entry = $entries[ 0 ];
181 181
 
182 182
 
183 183
         $this->form = $gravityview_view->getForm();
184 184
         $this->form_id = $gravityview_view->getFormId();
185 185
         $this->view_id = $gravityview_view->getViewId();
186 186
 
187
-        self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry['id'] );
187
+        self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry[ 'id' ] );
188 188
     }
189 189
 
190 190
 
@@ -204,12 +204,12 @@  discard block
 block discarded – undo
204 204
         $this->setup_vars();
205 205
 
206 206
         // Multiple Views embedded, don't proceed if nonce fails
207
-        if( $gv_data->has_multiple_views() && ! wp_verify_nonce( $_GET['edit'], self::$nonce_key ) ) {
207
+        if ( $gv_data->has_multiple_views() && ! wp_verify_nonce( $_GET[ 'edit' ], self::$nonce_key ) ) {
208 208
             return;
209 209
         }
210 210
 
211 211
         // Sorry, you're not allowed here.
212
-        if( false === $this->user_can_edit_entry( true ) ) {
212
+        if ( false === $this->user_can_edit_entry( true ) ) {
213 213
             return;
214 214
         }
215 215
 
@@ -229,9 +229,9 @@  discard block
 block discarded – undo
229 229
     function print_scripts() {
230 230
         $gravityview_view = GravityView_View::getInstance();
231 231
 
232
-        wp_register_script( 'gform_gravityforms', GFCommon::get_base_url().'/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) );
232
+        wp_register_script( 'gform_gravityforms', GFCommon::get_base_url() . '/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) );
233 233
 
234
-        GFFormDisplay::enqueue_form_scripts($gravityview_view->getForm(), false);
234
+        GFFormDisplay::enqueue_form_scripts( $gravityview_view->getForm(), false );
235 235
 
236 236
         // Sack is required for images
237 237
         wp_print_scripts( array( 'sack', 'gform_gravityforms' ) );
@@ -243,32 +243,32 @@  discard block
 block discarded – undo
243 243
      */
244 244
     function process_save() {
245 245
 
246
-        if( empty( $_POST ) ) {
246
+        if ( empty( $_POST ) ) {
247 247
             return;
248 248
         }
249 249
 
250 250
         // Make sure the entry, view, and form IDs are all correct
251 251
         $valid = $this->verify_nonce();
252 252
 
253
-        if( !$valid ) {
254
-            do_action('gravityview_log_error', __METHOD__ . ' Nonce validation failed.' );
253
+        if ( ! $valid ) {
254
+            do_action( 'gravityview_log_error', __METHOD__ . ' Nonce validation failed.' );
255 255
             return;
256 256
         }
257 257
 
258
-        if( $this->entry['id'] !== $_POST['lid'] ) {
259
-            do_action('gravityview_log_error', __METHOD__ . ' Entry ID did not match posted entry ID.' );
258
+        if ( $this->entry[ 'id' ] !== $_POST[ 'lid' ] ) {
259
+            do_action( 'gravityview_log_error', __METHOD__ . ' Entry ID did not match posted entry ID.' );
260 260
             return;
261 261
         }
262 262
 
263
-        do_action('gravityview_log_debug', 'GravityView_Edit_Entry[process_save] $_POSTed data (sanitized): ', esc_html( print_r( $_POST, true ) ) );
263
+        do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[process_save] $_POSTed data (sanitized): ', esc_html( print_r( $_POST, true ) ) );
264 264
 
265 265
         $this->process_save_process_files( $this->form_id );
266 266
 
267 267
         $this->validate();
268 268
 
269
-        if( $this->is_valid ) {
269
+        if ( $this->is_valid ) {
270 270
 
271
-            do_action('gravityview_log_debug', 'GravityView_Edit_Entry[process_save] Submission is valid.' );
271
+            do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[process_save] Submission is valid.' );
272 272
 
273 273
             /**
274 274
              * @hack This step is needed to unset the adminOnly from form fields
@@ -278,12 +278,12 @@  discard block
 block discarded – undo
278 278
             /**
279 279
              * @hack to avoid the capability validation of the method save_lead for GF 1.9+
280 280
              */
281
-            unset( $_GET['page'] );
281
+            unset( $_GET[ 'page' ] );
282 282
 
283 283
             GFFormsModel::save_lead( $form, $this->entry );
284 284
 
285 285
             // If there's a post associated with the entry, process post fields
286
-            if( !empty( $this->entry['post_id'] ) ) {
286
+            if ( ! empty( $this->entry[ 'post_id' ] ) ) {
287 287
                 $this->maybe_update_post_fields( $form );
288 288
             }
289 289
 
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
              * @param array $form Gravity Forms form array
296 296
              * @param string $entry_id Numeric ID of the entry that was updated
297 297
              */
298
-            do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry['id'] );
298
+            do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry[ 'id' ] );
299 299
         }
300 300
 
301 301
     } // process_save
@@ -329,11 +329,11 @@  discard block
 block discarded – undo
329 329
      * @return mixed
330 330
      */
331 331
     public function modify_fileupload_settings( $plupload_init, $form_id, $instance ) {
332
-        if( ! $this->is_edit_entry() ) {
332
+        if ( ! $this->is_edit_entry() ) {
333 333
             return $plupload_init;
334 334
         }
335 335
 
336
-        $plupload_init['gf_vars']['max_files'] = 0;
336
+        $plupload_init[ 'gf_vars' ][ 'max_files' ] = 0;
337 337
 
338 338
         return $plupload_init;
339 339
     }
@@ -346,13 +346,13 @@  discard block
 block discarded – undo
346 346
     private function form_prepare_for_save() {
347 347
         $form = $this->form;
348 348
 
349
-        foreach( $form['fields'] as &$field ) {
349
+        foreach ( $form[ 'fields' ] as &$field ) {
350 350
 
351 351
             $field->adminOnly = false;
352 352
 
353
-            if( isset( $field->inputs ) && is_array( $field->inputs ) ) {
354
-                foreach( $field->inputs as $key => $input ) {
355
-                    $field->inputs[ $key ][ 'id' ] = (string)$input['id'];
353
+            if ( isset( $field->inputs ) && is_array( $field->inputs ) ) {
354
+                foreach ( $field->inputs as $key => $input ) {
355
+                    $field->inputs[ $key ][ 'id' ] = (string)$input[ 'id' ];
356 356
                 }
357 357
             }
358 358
         }
@@ -370,11 +370,11 @@  discard block
 block discarded – undo
370 370
      */
371 371
     function maybe_update_post_fields( $form ) {
372 372
 
373
-        $post_id = $this->entry['post_id'];
373
+        $post_id = $this->entry[ 'post_id' ];
374 374
 
375 375
         // Security check
376
-        if( false === GVCommon::has_cap( 'edit_post', $post_id ) ) {
377
-            do_action( 'gravityview_log_error', 'The current user does not have the ability to edit Post #'.$post_id );
376
+        if ( false === GVCommon::has_cap( 'edit_post', $post_id ) ) {
377
+            do_action( 'gravityview_log_error', 'The current user does not have the ability to edit Post #' . $post_id );
378 378
             return;
379 379
         }
380 380
 
@@ -388,11 +388,11 @@  discard block
 block discarded – undo
388 388
 
389 389
             $field = RGFormsModel::get_field( $form, $field_id );
390 390
 
391
-            if( class_exists('GF_Fields') ) {
391
+            if ( class_exists( 'GF_Fields' ) ) {
392 392
                 $field = GF_Fields::create( $field );
393 393
             }
394 394
 
395
-            if( GFCommon::is_post_field( $field ) ) {
395
+            if ( GFCommon::is_post_field( $field ) ) {
396 396
 
397 397
                 // Get the value of the field, including $_POSTed value
398 398
                 $value = RGFormsModel::get_field_value( $field );
@@ -400,12 +400,12 @@  discard block
 block discarded – undo
400 400
                 // Convert the field object in 1.9 to an array for backward compatibility
401 401
                 $field_array = GVCommon::get_field_array( $field );
402 402
 
403
-                switch( $field_array['type'] ) {
403
+                switch ( $field_array[ 'type' ] ) {
404 404
 
405 405
                     case 'post_title':
406 406
                     case 'post_content':
407 407
                     case 'post_excerpt':
408
-                        $updated_post->{$field_array['type']} = $value;
408
+                        $updated_post->{$field_array[ 'type' ]} = $value;
409 409
                         break;
410 410
                     case 'post_tags':
411 411
                         wp_set_post_tags( $post_id, $value, false );
@@ -421,24 +421,24 @@  discard block
 block discarded – undo
421 421
                         $field = GFCommon::add_categories_as_choices( $field, '' );
422 422
 
423 423
                         // if post_category is type checkbox, then value is an array of inputs
424
-                        if( isset( $value[ strval( $field_id ) ] ) ) {
425
-                            foreach( $value as $input_id => $val ) {
424
+                        if ( isset( $value[ strval( $field_id ) ] ) ) {
425
+                            foreach ( $value as $input_id => $val ) {
426 426
                                 $input_name = 'input_' . str_replace( '.', '_', $input_id );
427
-                                $this->entry[ strval( $input_id ) ] = RGFormsModel::prepare_value( $form, $field, $val, $input_name, $this->entry['id'] );
427
+                                $this->entry[ strval( $input_id ) ] = RGFormsModel::prepare_value( $form, $field, $val, $input_name, $this->entry[ 'id' ] );
428 428
                             }
429 429
                         } else {
430 430
                             $input_name = 'input_' . str_replace( '.', '_', $field_id );
431
-                            $this->entry[ strval( $field_id ) ] = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $this->entry['id'] );
431
+                            $this->entry[ strval( $field_id ) ] = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $this->entry[ 'id' ] );
432 432
                         }
433 433
 
434 434
                         break;
435 435
                     case 'post_custom_field':
436 436
 
437 437
                         $input_type = RGFormsModel::get_input_type( $field );
438
-                        $custom_field_name = $field_array['postCustomFieldName'];
438
+                        $custom_field_name = $field_array[ 'postCustomFieldName' ];
439 439
 
440 440
                         // Only certain custom field types are supported
441
-                        if( !in_array( $input_type, array( 'list', 'fileupload' ) ) ) {
441
+                        if ( ! in_array( $input_type, array( 'list', 'fileupload' ) ) ) {
442 442
                             update_post_meta( $post_id, $custom_field_name, $value );
443 443
                         }
444 444
 
@@ -452,12 +452,12 @@  discard block
 block discarded – undo
452 452
                 }
453 453
 
454 454
                 //ignore fields that have not changed
455
-                if ( $value === rgget( (string) $field_id, $this->entry ) ) {
455
+                if ( $value === rgget( (string)$field_id, $this->entry ) ) {
456 456
                     continue;
457 457
                 }
458 458
 
459 459
                 // update entry
460
-                if( 'post_category' !== $field->type ) {
460
+                if ( 'post_category' !== $field->type ) {
461 461
                     $this->entry[ strval( $field_id ) ] = $value;
462 462
                 }
463 463
 
@@ -467,24 +467,24 @@  discard block
 block discarded – undo
467 467
 
468 468
         }
469 469
 
470
-        if( $update_entry ) {
470
+        if ( $update_entry ) {
471 471
 
472 472
             $return_entry = GFAPI::update_entry( $this->entry );
473 473
 
474
-            if( is_wp_error( $return_entry ) ) {
474
+            if ( is_wp_error( $return_entry ) ) {
475 475
                 do_action( 'gravityview_log_error', 'Updating the entry post fields failed', $return_entry );
476 476
             } else {
477
-                do_action( 'gravityview_log_debug', 'Updating the entry post fields for post #'.$post_id.' succeeded' );
477
+                do_action( 'gravityview_log_debug', 'Updating the entry post fields for post #' . $post_id . ' succeeded' );
478 478
             }
479 479
 
480 480
         }
481 481
 
482 482
         $return_post = wp_update_post( $updated_post, true );
483 483
 
484
-        if( is_wp_error( $return_post ) ) {
484
+        if ( is_wp_error( $return_post ) ) {
485 485
             do_action( 'gravityview_log_error', 'Updating the post content failed', $return_post );
486 486
         } else {
487
-            do_action( 'gravityview_log_debug', 'Updating the post content for post #'.$post_id.' succeeded' );
487
+            do_action( 'gravityview_log_debug', 'Updating the post content for post #' . $post_id . ' succeeded' );
488 488
         }
489 489
 
490 490
     }
@@ -500,18 +500,18 @@  discard block
 block discarded – undo
500 500
      */
501 501
     function after_update() {
502 502
 
503
-        do_action( 'gform_after_update_entry', $this->form, $this->entry['id'] );
504
-        do_action( "gform_after_update_entry_{$this->form['id']}", $this->form, $this->entry['id'] );
503
+        do_action( 'gform_after_update_entry', $this->form, $this->entry[ 'id' ] );
504
+        do_action( "gform_after_update_entry_{$this->form[ 'id' ]}", $this->form, $this->entry[ 'id' ] );
505 505
 
506 506
         // Re-define the entry now that we've updated it.
507
-        $entry = RGFormsModel::get_lead( $this->entry['id'] );
507
+        $entry = RGFormsModel::get_lead( $this->entry[ 'id' ] );
508 508
 
509 509
         $entry = GFFormsModel::set_entry_meta( $entry, $this->form );
510 510
 
511 511
         // We need to clear the cache because Gravity Forms caches the field values, which
512 512
         // we have just updated.
513
-        foreach ($this->form['fields'] as $key => $field) {
514
-            GFFormsModel::refresh_lead_field_value( $entry['id'], $field->id );
513
+        foreach ( $this->form[ 'fields' ] as $key => $field ) {
514
+            GFFormsModel::refresh_lead_field_value( $entry[ 'id' ], $field->id );
515 515
         }
516 516
 
517 517
         $this->entry = $entry;
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
 
532 532
         <div class="gv-edit-entry-wrapper"><?php
533 533
 
534
-            $javascript = gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/inline-javascript.php', $this );
534
+            $javascript = gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/inline-javascript.php', $this );
535 535
 
536 536
             /**
537 537
              * Fixes weird wpautop() issue
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
                      * @param string $edit_entry_title Modify the "Edit Entry" title
548 548
                      * @param GravityView_Edit_Entry_Render $this This object
549 549
                      */
550
-                    $edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
550
+                    $edit_entry_title = apply_filters( 'gravityview_edit_entry_title', __( 'Edit Entry', 'gravityview' ), $this );
551 551
 
552 552
                     echo esc_attr( $edit_entry_title );
553 553
             ?></span>
@@ -556,18 +556,18 @@  discard block
 block discarded – undo
556 556
             <?php
557 557
 
558 558
             // Display the success message
559
-            if( rgpost('action') === 'update' ) {
559
+            if ( rgpost( 'action' ) === 'update' ) {
560 560
 
561
-                if( ! $this->is_valid ){
561
+                if ( ! $this->is_valid ) {
562 562
 
563 563
                     // Keeping this compatible with Gravity Forms.
564
-                    $validation_message = "<div class='validation_error'>" . __('There was a problem with your submission.', 'gravityview') . " " . __('Errors have been highlighted below.', 'gravityview') . "</div>";
565
-                    $message = apply_filters("gform_validation_message_{$this->form['id']}", apply_filters("gform_validation_message", $validation_message, $this->form), $this->form);
564
+                    $validation_message = "<div class='validation_error'>" . __( 'There was a problem with your submission.', 'gravityview' ) . " " . __( 'Errors have been highlighted below.', 'gravityview' ) . "</div>";
565
+                    $message = apply_filters( "gform_validation_message_{$this->form[ 'id' ]}", apply_filters( "gform_validation_message", $validation_message, $this->form ), $this->form );
566 566
 
567
-                    echo GVCommon::generate_notice( $message , 'gv-error' );
567
+                    echo GVCommon::generate_notice( $message, 'gv-error' );
568 568
 
569 569
                 } else {
570
-                    $entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturn to Entry%s', 'gravityview'), '<a href="'. $back_link .'">', '</a>' );
570
+                    $entry_updated_message = sprintf( esc_attr__( 'Entry Updated. %sReturn to Entry%s', 'gravityview' ), '<a href="' . $back_link . '">', '</a>' );
571 571
 
572 572
                     /**
573 573
                      * @filter `gravityview/edit_entry/success` Modify the edit entry success message (including the anchor link)
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
                      * @param array $entry Gravity Forms entry array
578 578
                      * @param string $back_link URL to return to the original entry. @since 1.6
579 579
                      */
580
-                    $message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message , $this->view_id, $this->entry, $back_link );
580
+                    $message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message, $this->view_id, $this->entry, $back_link );
581 581
 
582 582
                     echo GVCommon::generate_notice( $message );
583 583
                 }
@@ -634,13 +634,13 @@  discard block
 block discarded – undo
634 634
      */
635 635
     private function render_edit_form() {
636 636
 
637
-        add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields'), 5000, 3 );
638
-        add_filter( 'gform_submit_button', array( $this, 'render_form_buttons') );
637
+        add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000, 3 );
638
+        add_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) );
639 639
         add_filter( 'gform_disable_view_counter', '__return_true' );
640 640
         add_filter( 'gform_field_input', array( $this, 'modify_edit_field_input' ), 10, 5 );
641 641
 
642 642
         // We need to remove the fake $_GET['page'] arg to avoid rendering form as if in admin.
643
-        unset( $_GET['page'] );
643
+        unset( $_GET[ 'page' ] );
644 644
 
645 645
         // TODO: Make sure validation isn't handled by GF
646 646
         // TODO: Include CSS for file upload fields
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
         // TODO: Product fields are not editable
649 649
         // TODO: Check Updated and Error messages
650 650
 
651
-        $html = GFFormDisplay::get_form( $this->form['id'], false, false, true, $this->entry );
651
+        $html = GFFormDisplay::get_form( $this->form[ 'id' ], false, false, true, $this->entry );
652 652
 
653 653
 	    remove_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000 );
654 654
         remove_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) );
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
      * @return string
665 665
      */
666 666
     public function render_form_buttons() {
667
-        return gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/form-buttons.php', $this );
667
+        return gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/form-buttons.php', $this );
668 668
     }
669 669
 
670 670
 
@@ -684,17 +684,17 @@  discard block
 block discarded – undo
684 684
     public function filter_modify_form_fields( $form, $ajax = false, $field_values = '' ) {
685 685
 
686 686
         // In case we have validated the form, use it to inject the validation results into the form render
687
-        if( isset( $this->form_after_validation ) ) {
687
+        if ( isset( $this->form_after_validation ) ) {
688 688
             $form = $this->form_after_validation;
689 689
         } else {
690
-            $form['fields'] = $this->get_configured_edit_fields( $form, $this->view_id );
690
+            $form[ 'fields' ] = $this->get_configured_edit_fields( $form, $this->view_id );
691 691
         }
692 692
 
693 693
         $form = $this->filter_conditional_logic( $form );
694 694
 
695 695
         // for now we don't support Save and Continue feature.
696
-        if( ! self::$supports_save_and_continue ) {
697
-	        unset( $form['save'] );
696
+        if ( ! self::$supports_save_and_continue ) {
697
+	        unset( $form[ 'save' ] );
698 698
         }
699 699
 
700 700
         return $form;
@@ -717,7 +717,7 @@  discard block
 block discarded – undo
717 717
 
718 718
         // If the form has been submitted, then we don't need to pre-fill the values,
719 719
         // Except for fileupload type - run always!!
720
-        if(
720
+        if (
721 721
 	        $this->is_edit_entry_submission() && 'fileupload' !== $field->type
722 722
         ||  GFCommon::is_product_field( $field->type ) // Prevent product fields from appearing editable
723 723
         ) {
@@ -725,8 +725,8 @@  discard block
 block discarded – undo
725 725
         }
726 726
 
727 727
         // Turn on Admin-style display for file upload fields only
728
-        if( 'fileupload' === $field->type ) {
729
-            $_GET['page'] = 'gf_entries';
728
+        if ( 'fileupload' === $field->type ) {
729
+            $_GET[ 'page' ] = 'gf_entries';
730 730
         }
731 731
 
732 732
         // SET SOME FIELD DEFAULTS TO PREVENT ISSUES
@@ -746,7 +746,7 @@  discard block
 block discarded – undo
746 746
         $override_saved_value = apply_filters( 'gravityview/edit_entry/pre_populate/override', false, $field );
747 747
 
748 748
         // We're dealing with multiple inputs (e.g. checkbox) but not time or date (as it doesn't store data in input IDs)
749
-        if( isset( $field->inputs ) && is_array( $field->inputs ) && !in_array( $field->type, array( 'time', 'date' ) ) ) {
749
+        if ( isset( $field->inputs ) && is_array( $field->inputs ) && ! in_array( $field->type, array( 'time', 'date' ) ) ) {
750 750
 
751 751
             $field_value = array();
752 752
 
@@ -755,10 +755,10 @@  discard block
 block discarded – undo
755 755
 
756 756
 	        foreach ( (array)$field->inputs as $input ) {
757 757
 
758
-	            $input_id = strval( $input['id'] );
758
+	            $input_id = strval( $input[ 'id' ] );
759 759
 
760 760
                 if ( ! empty( $this->entry[ $input_id ] ) ) {
761
-                    $field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
761
+                    $field_value[ $input_id ] = 'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
762 762
                     $allow_pre_populated = false;
763 763
                 }
764 764
 
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
 
767 767
             $pre_value = $field->get_value_submission( array(), false );
768 768
 
769
-            $field_value = ! $allow_pre_populated && ! ( $override_saved_value && !empty( $pre_value ) ) ? $field_value : $pre_value;
769
+            $field_value = ! $allow_pre_populated && ! ( $override_saved_value && ! empty( $pre_value ) ) ? $field_value : $pre_value;
770 770
 
771 771
         } else {
772 772
 
@@ -777,13 +777,13 @@  discard block
 block discarded – undo
777 777
 
778 778
             // saved field entry value (if empty, fallback to the pre-populated value, if exists)
779 779
             // or pre-populated value if not empty and set to override saved value
780
-            $field_value = !empty( $this->entry[ $id ] ) && ! ( $override_saved_value && !empty( $pre_value ) ) ? $this->entry[ $id ] : $pre_value;
780
+            $field_value = ! empty( $this->entry[ $id ] ) && ! ( $override_saved_value && ! empty( $pre_value ) ) ? $this->entry[ $id ] : $pre_value;
781 781
 
782 782
             // in case field is post_category but inputType is select, multi-select or radio, convert value into array of category IDs.
783
-            if ( 'post_category' === $field->type && !empty( $field_value ) ) {
783
+            if ( 'post_category' === $field->type && ! empty( $field_value ) ) {
784 784
                 $categories = array();
785 785
                 foreach ( explode( ',', $field_value ) as $cat_string ) {
786
-                    $categories[] = GFCommon::format_post_category( $cat_string, true );
786
+                    $categories[ ] = GFCommon::format_post_category( $cat_string, true );
787 787
                 }
788 788
                 $field_value = 'multiselect' === $field->get_input_type() ? $categories : implode( '', $categories );
789 789
             }
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
 	    // If there was output, it's an error
810 810
 	    $warnings = ob_get_clean();
811 811
 
812
-	    if( !empty( $warnings ) ) {
812
+	    if ( ! empty( $warnings ) ) {
813 813
 		    do_action( 'gravityview_log_error', __METHOD__ . $warnings, $field_value );
814 814
 	    }
815 815
 
@@ -818,7 +818,7 @@  discard block
 block discarded – undo
818 818
          * We need the fileupload html field to render with the proper id
819 819
          *  ( <li id="field_80_16" ... > )
820 820
          */
821
-        unset( $_GET['page'] );
821
+        unset( $_GET[ 'page' ] );
822 822
 
823 823
         return $return;
824 824
     }
@@ -837,7 +837,7 @@  discard block
 block discarded – undo
837 837
     public function get_field_value( $value, $lead, $field ) {
838 838
 
839 839
         // The form's not being edited; use the original value
840
-        if( ! $this->is_edit_entry_submission() ) {
840
+        if ( ! $this->is_edit_entry_submission() ) {
841 841
             return $value;
842 842
         }
843 843
 
@@ -858,12 +858,12 @@  discard block
 block discarded – undo
858 858
      */
859 859
     function gform_pre_validation( $form ) {
860 860
 
861
-        if( ! $this->verify_nonce() ) {
861
+        if ( ! $this->verify_nonce() ) {
862 862
             return $form;
863 863
         }
864 864
 
865 865
         // Fix PHP warning regarding undefined index.
866
-        foreach ( $form['fields'] as &$field) {
866
+        foreach ( $form[ 'fields' ] as &$field ) {
867 867
 
868 868
             // This is because we're doing admin form pretending to be front-end, so Gravity Forms
869 869
             // expects certain field array items to be set.
@@ -876,7 +876,7 @@  discard block
 block discarded – undo
876 876
                 $field['emailConfirmEnabled'] = '';
877 877
             }*/
878 878
 
879
-            switch( RGFormsModel::get_input_type( $field ) ) {
879
+            switch ( RGFormsModel::get_input_type( $field ) ) {
880 880
 
881 881
                 /**
882 882
                  * 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.
@@ -891,38 +891,38 @@  discard block
 block discarded – undo
891 891
                     // Set the previous value
892 892
                     $entry = $this->get_entry();
893 893
 
894
-                    $input_name = 'input_'.$field->id;
895
-                    $form_id = $form['id'];
894
+                    $input_name = 'input_' . $field->id;
895
+                    $form_id = $form[ 'id' ];
896 896
 
897 897
                     $value = NULL;
898 898
 
899 899
                     // Use the previous entry value as the default.
900
-                    if( isset( $entry[ $field->id ] ) ) {
900
+                    if ( isset( $entry[ $field->id ] ) ) {
901 901
                         $value = $entry[ $field->id ];
902 902
                     }
903 903
 
904 904
                     // If this is a single upload file
905
-                    if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
906
-                        $file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
907
-                        $value = $file_path['url'];
905
+                    if ( ! empty( $_FILES[ $input_name ] ) && ! empty( $_FILES[ $input_name ][ 'name' ] ) ) {
906
+                        $file_path = GFFormsModel::get_file_upload_path( $form[ 'id' ], $_FILES[ $input_name ][ 'name' ] );
907
+                        $value = $file_path[ 'url' ];
908 908
 
909 909
                     } else {
910 910
 
911 911
                         // Fix PHP warning on line 1498 of form_display.php for post_image fields
912 912
                         // Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
913
-                        $_FILES[ $input_name ] = array('name' => '', 'size' => '' );
913
+                        $_FILES[ $input_name ] = array( 'name' => '', 'size' => '' );
914 914
 
915 915
                     }
916 916
 
917
-                    if( rgar($field, "multipleFiles") ) {
917
+                    if ( rgar( $field, "multipleFiles" ) ) {
918 918
 
919 919
                         // If there are fresh uploads, process and merge them.
920 920
                         // Otherwise, use the passed values, which should be json-encoded array of URLs
921
-                        if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) {
921
+                        if ( isset( GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] ) ) {
922 922
 
923 923
                             $value = empty( $value ) ? '[]' : $value;
924 924
                             $value = stripslashes_deep( $value );
925
-                            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array());
925
+                            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ], array() );
926 926
                         }
927 927
 
928 928
                     } else {
@@ -938,14 +938,14 @@  discard block
 block discarded – undo
938 938
                     break;
939 939
                 case 'number':
940 940
                     // Fix "undefined index" issue at line 1286 in form_display.php
941
-                    if( !isset( $_POST['input_'.$field->id ] ) ) {
942
-                        $_POST['input_'.$field->id ] = NULL;
941
+                    if ( ! isset( $_POST[ 'input_' . $field->id ] ) ) {
942
+                        $_POST[ 'input_' . $field->id ] = NULL;
943 943
                     }
944 944
                     break;
945 945
                 case 'captcha':
946 946
                     // Fix issue with recaptcha_check_answer() on line 1458 in form_display.php
947
-                    $_POST['recaptcha_challenge_field'] = NULL;
948
-                    $_POST['recaptcha_response_field'] = NULL;
947
+                    $_POST[ 'recaptcha_challenge_field' ] = NULL;
948
+                    $_POST[ 'recaptcha_response_field' ] = NULL;
949 949
                     break;
950 950
             }
951 951
 
@@ -974,7 +974,7 @@  discard block
 block discarded – undo
974 974
          * You can enter whatever you want!
975 975
          * We try validating, and customize the results using `self::custom_validation()`
976 976
          */
977
-        add_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10, 4);
977
+        add_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10, 4 );
978 978
 
979 979
         // Needed by the validate funtion
980 980
         $failed_validation_page = NULL;
@@ -982,14 +982,14 @@  discard block
 block discarded – undo
982 982
 
983 983
         // Prevent entry limit from running when editing an entry, also
984 984
         // prevent form scheduling from preventing editing
985
-        unset( $this->form['limitEntries'], $this->form['scheduleForm'] );
985
+        unset( $this->form[ 'limitEntries' ], $this->form[ 'scheduleForm' ] );
986 986
 
987 987
         // Hide fields depending on Edit Entry settings
988
-        $this->form['fields'] = $this->get_configured_edit_fields( $this->form, $this->view_id );
988
+        $this->form[ 'fields' ] = $this->get_configured_edit_fields( $this->form, $this->view_id );
989 989
 
990 990
         $this->is_valid = GFFormDisplay::validate( $this->form, $field_values, 1, $failed_validation_page );
991 991
 
992
-        remove_filter( 'gform_validation_'.$this->form_id, array( $this, 'custom_validation' ), 10 );
992
+        remove_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10 );
993 993
     }
994 994
 
995 995
 
@@ -1006,13 +1006,13 @@  discard block
 block discarded – undo
1006 1006
      */
1007 1007
     function custom_validation( $validation_results ) {
1008 1008
 
1009
-        do_action('gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Validation results: ', $validation_results );
1009
+        do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Validation results: ', $validation_results );
1010 1010
 
1011
-        do_action('gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] $_POSTed data (sanitized): ', esc_html( print_r( $_POST, true ) ) );
1011
+        do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] $_POSTed data (sanitized): ', esc_html( print_r( $_POST, true ) ) );
1012 1012
 
1013 1013
         $gv_valid = true;
1014 1014
 
1015
-        foreach ( $validation_results['form']['fields'] as $key => &$field ) {
1015
+        foreach ( $validation_results[ 'form' ][ 'fields' ] as $key => &$field ) {
1016 1016
 
1017 1017
             $value = RGFormsModel::get_field_value( $field );
1018 1018
             $field_type = RGFormsModel::get_input_type( $field );
@@ -1024,35 +1024,35 @@  discard block
 block discarded – undo
1024 1024
                 case 'fileupload' :
1025 1025
 
1026 1026
                     // in case nothing is uploaded but there are already files saved
1027
-                    if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) {
1027
+                    if ( ! empty( $field->failed_validation ) && ! empty( $field->isRequired ) && ! empty( $value ) ) {
1028 1028
                         $field->failed_validation = false;
1029 1029
                         unset( $field->validation_message );
1030 1030
                     }
1031 1031
 
1032 1032
                     // validate if multi file upload reached max number of files [maxFiles] => 2
1033
-                    if( rgar( $field, 'maxFiles') && rgar( $field, 'multipleFiles') ) {
1033
+                    if ( rgar( $field, 'maxFiles' ) && rgar( $field, 'multipleFiles' ) ) {
1034 1034
 
1035 1035
                         $input_name = 'input_' . $field->id;
1036 1036
                         //uploaded
1037
-                        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1037
+                        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] : array();
1038 1038
 
1039 1039
                         //existent
1040 1040
                         $entry = $this->get_entry();
1041 1041
                         $value = NULL;
1042
-                        if( isset( $entry[ $field->id ] ) ) {
1042
+                        if ( isset( $entry[ $field->id ] ) ) {
1043 1043
                             $value = json_decode( $entry[ $field->id ], true );
1044 1044
                         }
1045 1045
 
1046 1046
                         // count uploaded files and existent entry files
1047 1047
                         $count_files = count( $file_names ) + count( $value );
1048 1048
 
1049
-                        if( $count_files > $field->maxFiles ) {
1049
+                        if ( $count_files > $field->maxFiles ) {
1050 1050
                             $field->validation_message = __( 'Maximum number of files reached', 'gravityview' );
1051 1051
                             $field->failed_validation = 1;
1052 1052
                             $gv_valid = false;
1053 1053
 
1054 1054
                             // in case of error make sure the newest upload files are removed from the upload input
1055
-                            GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1055
+                            GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ] = null;
1056 1056
                         }
1057 1057
 
1058 1058
                     }
@@ -1063,7 +1063,7 @@  discard block
 block discarded – undo
1063 1063
             }
1064 1064
 
1065 1065
             // This field has failed validation.
1066
-            if( !empty( $field->failed_validation ) ) {
1066
+            if ( ! empty( $field->failed_validation ) ) {
1067 1067
 
1068 1068
                 do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Field is invalid.', array( 'field' => $field, 'value' => $value ) );
1069 1069
 
@@ -1081,32 +1081,32 @@  discard block
 block discarded – undo
1081 1081
                 }
1082 1082
 
1083 1083
                 // You can't continue inside a switch, so we do it after.
1084
-                if( empty( $field->failed_validation ) ) {
1084
+                if ( empty( $field->failed_validation ) ) {
1085 1085
                     continue;
1086 1086
                 }
1087 1087
 
1088 1088
                 // checks if the No Duplicates option is not validating entry against itself, since
1089 1089
                 // we're editing a stored entry, it would also assume it's a duplicate.
1090
-                if( !empty( $field->noDuplicates ) ) {
1090
+                if ( ! empty( $field->noDuplicates ) ) {
1091 1091
 
1092 1092
                     $entry = $this->get_entry();
1093 1093
 
1094 1094
                     // If the value of the entry is the same as the stored value
1095 1095
                     // Then we can assume it's not a duplicate, it's the same.
1096
-                    if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1096
+                    if ( ! empty( $entry ) && $value == $entry[ $field->id ] ) {
1097 1097
                         //if value submitted was not changed, then don't validate
1098 1098
                         $field->failed_validation = false;
1099 1099
 
1100 1100
                         unset( $field->validation_message );
1101 1101
 
1102
-                        do_action('gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', $entry );
1102
+                        do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', $entry );
1103 1103
 
1104 1104
                         continue;
1105 1105
                     }
1106 1106
                 }
1107 1107
 
1108 1108
                 // if here then probably we are facing the validation 'At least one field must be filled out'
1109
-                if( GFFormDisplay::is_empty( $field, $this->form_id  ) && empty( $field->isRequired ) ) {
1109
+                if ( GFFormDisplay::is_empty( $field, $this->form_id ) && empty( $field->isRequired ) ) {
1110 1110
                     unset( $field->validation_message );
1111 1111
 	                $field->validation_message = false;
1112 1112
                     continue;
@@ -1118,12 +1118,12 @@  discard block
 block discarded – undo
1118 1118
 
1119 1119
         }
1120 1120
 
1121
-        $validation_results['is_valid'] = $gv_valid;
1121
+        $validation_results[ 'is_valid' ] = $gv_valid;
1122 1122
 
1123
-        do_action('gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Validation results.', $validation_results );
1123
+        do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Validation results.', $validation_results );
1124 1124
 
1125 1125
         // We'll need this result when rendering the form ( on GFFormDisplay::get_form )
1126
-        $this->form_after_validation = $validation_results['form'];
1126
+        $this->form_after_validation = $validation_results[ 'form' ];
1127 1127
 
1128 1128
         return $validation_results;
1129 1129
     }
@@ -1136,7 +1136,7 @@  discard block
 block discarded – undo
1136 1136
      */
1137 1137
     private function get_entry() {
1138 1138
 
1139
-        if( empty( $this->entry ) ) {
1139
+        if ( empty( $this->entry ) ) {
1140 1140
             // Get the database value of the entry that's being edited
1141 1141
             $this->entry = gravityview_get_entry( GravityView_frontend::is_single_entry() );
1142 1142
         }
@@ -1163,13 +1163,13 @@  discard block
 block discarded – undo
1163 1163
         $properties = GravityView_View_Data::getInstance()->get_fields( $view_id );
1164 1164
 
1165 1165
         // If edit tab not yet configured, show all fields
1166
-        $edit_fields = !empty( $properties['edit_edit-fields'] ) ? $properties['edit_edit-fields'] : NULL;
1166
+        $edit_fields = ! empty( $properties[ 'edit_edit-fields' ] ) ? $properties[ 'edit_edit-fields' ] : NULL;
1167 1167
 
1168 1168
 	    // Show hidden fields as text fields
1169 1169
 	    $form = $this->fix_hidden_fields( $form );
1170 1170
 
1171 1171
         // Hide fields depending on admin settings
1172
-        $fields = $this->filter_fields( $form['fields'], $edit_fields );
1172
+        $fields = $this->filter_fields( $form[ 'fields' ], $edit_fields );
1173 1173
 
1174 1174
 	    // If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1175 1175
 	    $fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
@@ -1187,11 +1187,11 @@  discard block
 block discarded – undo
1187 1187
 	private function fix_hidden_fields( $form ) {
1188 1188
 
1189 1189
 		/** @var GF_Field $field */
1190
-		foreach( $form['fields'] as $key => $field ) {
1191
-			if( 'hidden' === $field->type ) {
1190
+		foreach ( $form[ 'fields' ] as $key => $field ) {
1191
+			if ( 'hidden' === $field->type ) {
1192 1192
 				$text_field = new GF_Field_Text( $field );
1193 1193
 				$text_field->type = 'text';
1194
-				$form['fields'][ $key ] = $text_field;
1194
+				$form[ 'fields' ][ $key ] = $text_field;
1195 1195
 			}
1196 1196
 		}
1197 1197
 
@@ -1211,7 +1211,7 @@  discard block
 block discarded – undo
1211 1211
      */
1212 1212
     private function filter_fields( $fields, $configured_fields ) {
1213 1213
 
1214
-        if( empty( $fields ) || !is_array( $fields ) ) {
1214
+        if ( empty( $fields ) || ! is_array( $fields ) ) {
1215 1215
             return $fields;
1216 1216
         }
1217 1217
 
@@ -1228,24 +1228,24 @@  discard block
 block discarded – undo
1228 1228
 	     */
1229 1229
 	    $hide_product_fields = apply_filters( 'gravityview/edit_entry/hide-product-fields', empty( self::$supports_product_fields ) );
1230 1230
 
1231
-	    if( $hide_product_fields ) {
1232
-		    $field_type_blacklist[] = 'option';
1233
-		    $field_type_blacklist[] = 'quantity';
1234
-            $field_type_blacklist[] = 'product';
1235
-            $field_type_blacklist[] = 'total';
1236
-            $field_type_blacklist[] = 'shipping';
1237
-            $field_type_blacklist[] = 'calculation';
1231
+	    if ( $hide_product_fields ) {
1232
+		    $field_type_blacklist[ ] = 'option';
1233
+		    $field_type_blacklist[ ] = 'quantity';
1234
+            $field_type_blacklist[ ] = 'product';
1235
+            $field_type_blacklist[ ] = 'total';
1236
+            $field_type_blacklist[ ] = 'shipping';
1237
+            $field_type_blacklist[ ] = 'calculation';
1238 1238
 	    }
1239 1239
 
1240 1240
         // First, remove blacklist
1241 1241
         foreach ( $fields as $key => $field ) {
1242
-            if( in_array( $field->type, $field_type_blacklist ) ) {
1242
+            if ( in_array( $field->type, $field_type_blacklist ) ) {
1243 1243
                 unset( $fields[ $key ] );
1244 1244
             }
1245 1245
         }
1246 1246
 
1247 1247
         // The Edit tab has not been configured, so we return all fields by default.
1248
-        if( empty( $configured_fields ) ) {
1248
+        if ( empty( $configured_fields ) ) {
1249 1249
             return $fields;
1250 1250
         }
1251 1251
 
@@ -1255,8 +1255,8 @@  discard block
 block discarded – undo
1255 1255
 	        /** @var GF_Field $field */
1256 1256
 	        foreach ( $fields as $field ) {
1257 1257
 
1258
-                if( intval( $configured_field['id'] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1259
-                    $edit_fields[] = $this->merge_field_properties( $field, $configured_field );
1258
+                if ( intval( $configured_field[ 'id' ] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1259
+                    $edit_fields[ ] = $this->merge_field_properties( $field, $configured_field );
1260 1260
                     break;
1261 1261
                 }
1262 1262
 
@@ -1279,14 +1279,14 @@  discard block
 block discarded – undo
1279 1279
 
1280 1280
         $return_field = $field;
1281 1281
 
1282
-        if( empty( $field_setting['show_label'] ) ) {
1282
+        if ( empty( $field_setting[ 'show_label' ] ) ) {
1283 1283
             $return_field->label = '';
1284
-        } elseif ( !empty( $field_setting['custom_label'] ) ) {
1285
-            $return_field->label = $field_setting['custom_label'];
1284
+        } elseif ( ! empty( $field_setting[ 'custom_label' ] ) ) {
1285
+            $return_field->label = $field_setting[ 'custom_label' ];
1286 1286
         }
1287 1287
 
1288
-        if( !empty( $field_setting['custom_class'] ) ) {
1289
-            $return_field->cssClass .= ' '. gravityview_sanitize_html_class( $field_setting['custom_class'] );
1288
+        if ( ! empty( $field_setting[ 'custom_class' ] ) ) {
1289
+            $return_field->cssClass .= ' ' . gravityview_sanitize_html_class( $field_setting[ 'custom_class' ] );
1290 1290
         }
1291 1291
 
1292 1292
         /**
@@ -1324,11 +1324,11 @@  discard block
 block discarded – undo
1324 1324
 	     */
1325 1325
 	    $use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
1326 1326
 
1327
-	    if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
1327
+	    if ( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry[ 'id' ] ) ) {
1328 1328
             return $fields;
1329 1329
         }
1330 1330
 
1331
-	    foreach( $fields as &$field ) {
1331
+	    foreach ( $fields as &$field ) {
1332 1332
 		    $field->adminOnly = false;
1333 1333
         }
1334 1334
 
@@ -1355,16 +1355,16 @@  discard block
 block discarded – undo
1355 1355
          */
1356 1356
         $use_conditional_logic = apply_filters( 'gravityview/edit_entry/conditional_logic', true, $form );
1357 1357
 
1358
-        if( $use_conditional_logic ) {
1358
+        if ( $use_conditional_logic ) {
1359 1359
             return $form;
1360 1360
         }
1361 1361
 
1362
-        foreach( $form['fields'] as &$field ) {
1362
+        foreach ( $form[ 'fields' ] as &$field ) {
1363 1363
             /* @var GF_Field $field */
1364 1364
             $field->conditionalLogic = null;
1365 1365
         }
1366 1366
 
1367
-        unset( $form['button']['conditionalLogic'] );
1367
+        unset( $form[ 'button' ][ 'conditionalLogic' ] );
1368 1368
 
1369 1369
         return $form;
1370 1370
 
@@ -1381,7 +1381,7 @@  discard block
 block discarded – undo
1381 1381
      */
1382 1382
     function manage_conditional_logic( $has_conditional_logic, $form ) {
1383 1383
 
1384
-        if( ! $this->is_edit_entry() ) {
1384
+        if ( ! $this->is_edit_entry() ) {
1385 1385
             return $has_conditional_logic;
1386 1386
         }
1387 1387
 
@@ -1413,44 +1413,44 @@  discard block
 block discarded – undo
1413 1413
          *  2. There are two entries embedded using oEmbed
1414 1414
          *  3. One of the entries has just been saved
1415 1415
          */
1416
-        if( !empty( $_POST['lid'] ) && !empty( $_GET['entry'] ) && ( $_POST['lid'] !== $_GET['entry'] ) ) {
1416
+        if ( ! empty( $_POST[ 'lid' ] ) && ! empty( $_GET[ 'entry' ] ) && ( $_POST[ 'lid' ] !== $_GET[ 'entry' ] ) ) {
1417 1417
 
1418 1418
             $error = true;
1419 1419
 
1420 1420
         }
1421 1421
 
1422
-        if( !empty( $_GET['entry'] ) && (string)$this->entry['id'] !== $_GET['entry'] ) {
1422
+        if ( ! empty( $_GET[ 'entry' ] ) && (string)$this->entry[ 'id' ] !== $_GET[ 'entry' ] ) {
1423 1423
 
1424 1424
             $error = true;
1425 1425
 
1426
-        } elseif( ! $this->verify_nonce() ) {
1426
+        } elseif ( ! $this->verify_nonce() ) {
1427 1427
 
1428 1428
             /**
1429 1429
              * If the Entry is embedded, there may be two entries on the same page.
1430 1430
              * If that's the case, and one is being edited, the other should fail gracefully and not display an error.
1431 1431
              */
1432
-            if( GravityView_oEmbed::getInstance()->get_entry_id() ) {
1432
+            if ( GravityView_oEmbed::getInstance()->get_entry_id() ) {
1433 1433
                 $error = true;
1434 1434
             } else {
1435
-                $error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview');
1435
+                $error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview' );
1436 1436
             }
1437 1437
 
1438 1438
         }
1439 1439
 
1440
-        if( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
1441
-            $error = __( 'You do not have permission to edit this entry.', 'gravityview');
1440
+        if ( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
1441
+            $error = __( 'You do not have permission to edit this entry.', 'gravityview' );
1442 1442
         }
1443 1443
 
1444
-        if( $this->entry['status'] === 'trash' ) {
1445
-            $error = __('You cannot edit the entry; it is in the trash.', 'gravityview' );
1444
+        if ( $this->entry[ 'status' ] === 'trash' ) {
1445
+            $error = __( 'You cannot edit the entry; it is in the trash.', 'gravityview' );
1446 1446
         }
1447 1447
 
1448 1448
         // No errors; everything's fine here!
1449
-        if( empty( $error ) ) {
1449
+        if ( empty( $error ) ) {
1450 1450
             return true;
1451 1451
         }
1452 1452
 
1453
-        if( $echo && $error !== true ) {
1453
+        if ( $echo && $error !== true ) {
1454 1454
 
1455 1455
 	        $error = esc_html( $error );
1456 1456
 
@@ -1458,13 +1458,13 @@  discard block
 block discarded – undo
1458 1458
 	         * @since 1.9
1459 1459
 	         */
1460 1460
 	        if ( ! empty( $this->entry ) ) {
1461
-		        $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;" ) );
1461
+		        $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;" ) );
1462 1462
 	        }
1463 1463
 
1464
-            echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error');
1464
+            echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error' );
1465 1465
         }
1466 1466
 
1467
-        do_action('gravityview_log_error', 'GravityView_Edit_Entry[user_can_edit_entry]' . $error );
1467
+        do_action( 'gravityview_log_error', 'GravityView_Edit_Entry[user_can_edit_entry]' . $error );
1468 1468
 
1469 1469
         return false;
1470 1470
     }
@@ -1481,20 +1481,20 @@  discard block
 block discarded – undo
1481 1481
 
1482 1482
         $error = NULL;
1483 1483
 
1484
-        if( ! $this->check_user_cap_edit_field( $field ) ) {
1485
-            $error = __( 'You do not have permission to edit this field.', 'gravityview');
1484
+        if ( ! $this->check_user_cap_edit_field( $field ) ) {
1485
+            $error = __( 'You do not have permission to edit this field.', 'gravityview' );
1486 1486
         }
1487 1487
 
1488 1488
         // No errors; everything's fine here!
1489
-        if( empty( $error ) ) {
1489
+        if ( empty( $error ) ) {
1490 1490
             return true;
1491 1491
         }
1492 1492
 
1493
-        if( $echo ) {
1494
-            echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error');
1493
+        if ( $echo ) {
1494
+            echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error' );
1495 1495
         }
1496 1496
 
1497
-        do_action('gravityview_log_error', 'GravityView_Edit_Entry[user_can_edit_field]' . $error );
1497
+        do_action( 'gravityview_log_error', 'GravityView_Edit_Entry[user_can_edit_field]' . $error );
1498 1498
 
1499 1499
         return false;
1500 1500
 
@@ -1512,15 +1512,15 @@  discard block
 block discarded – undo
1512 1512
     private function check_user_cap_edit_field( $field ) {
1513 1513
 
1514 1514
         // If they can edit any entries (as defined in Gravity Forms), we're good.
1515
-        if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
1515
+        if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
1516 1516
             return true;
1517 1517
         }
1518 1518
 
1519
-        $field_cap = isset( $field['allow_edit_cap'] ) ? $field['allow_edit_cap'] : false;
1519
+        $field_cap = isset( $field[ 'allow_edit_cap' ] ) ? $field[ 'allow_edit_cap' ] : false;
1520 1520
 
1521 1521
         // If the field has custom editing capaibilities set, check those
1522
-        if( $field_cap ) {
1523
-            return GVCommon::has_cap( $field['allow_edit_cap'] );
1522
+        if ( $field_cap ) {
1523
+            return GVCommon::has_cap( $field[ 'allow_edit_cap' ] );
1524 1524
         }
1525 1525
 
1526 1526
         return false;
@@ -1534,17 +1534,17 @@  discard block
 block discarded – undo
1534 1534
     public function verify_nonce() {
1535 1535
 
1536 1536
         // Verify form submitted for editing single
1537
-        if( $this->is_edit_entry_submission() ) {
1537
+        if ( $this->is_edit_entry_submission() ) {
1538 1538
             $valid = wp_verify_nonce( $_POST[ self::$nonce_field ], self::$nonce_field );
1539 1539
         }
1540 1540
 
1541 1541
         // Verify
1542
-        else if( ! $this->is_edit_entry() ) {
1542
+        else if ( ! $this->is_edit_entry() ) {
1543 1543
             $valid = false;
1544 1544
         }
1545 1545
 
1546 1546
         else {
1547
-            $valid = wp_verify_nonce( $_GET['edit'], self::$nonce_key );
1547
+            $valid = wp_verify_nonce( $_GET[ 'edit' ], self::$nonce_key );
1548 1548
         }
1549 1549
 
1550 1550
         /**
Please login to merge, or discard this patch.