Completed
Push — develop ( ec61b1...89c7bd )
by Zack
20:07
created
future/includes/class-gv-settings-addon.php 2 patches
Indentation   +121 added lines, -121 removed lines patch added patch discarded remove patch
@@ -134,28 +134,28 @@  discard block
 block discarded – undo
134 134
 	 */
135 135
 	public function add_network_menu() {
136 136
 
137
-	    if ( ! gravityview()->plugin->is_network_activated() ) {
137
+		if ( ! gravityview()->plugin->is_network_activated() ) {
138 138
 			return;
139 139
 		}
140 140
 
141
-        add_menu_page( __( 'Settings', 'gravityview' ), __( 'GravityView', 'gravityview' ), $this->_capabilities_app_settings, "{$this->_slug}_settings", array( $this, 'app_tab_page' ), 'none' );
141
+		add_menu_page( __( 'Settings', 'gravityview' ), __( 'GravityView', 'gravityview' ), $this->_capabilities_app_settings, "{$this->_slug}_settings", array( $this, 'app_tab_page' ), 'none' );
142 142
 	}
143 143
 
144 144
 	/**
145
-     * Uninstall all traces of GravityView
146
-     *
147
-     * Note: method is public because parent method is public
148
-     *
145
+	 * Uninstall all traces of GravityView
146
+	 *
147
+	 * Note: method is public because parent method is public
148
+	 *
149 149
 	 * @return bool
150 150
 	 */
151 151
 	public function uninstall() {
152 152
 		gravityview()->plugin->uninstall();
153 153
 
154 154
 		/**
155
-         * Set the path so that Gravity Forms can de-activate GravityView
156
-         * @see GFAddOn::uninstall_addon
157
-         * @uses deactivate_plugins()
158
-         */
155
+		 * Set the path so that Gravity Forms can de-activate GravityView
156
+		 * @see GFAddOn::uninstall_addon
157
+		 * @uses deactivate_plugins()
158
+		 */
159 159
 		$this->_path = GRAVITYVIEW_FILE;
160 160
 
161 161
 		return true;
@@ -185,42 +185,42 @@  discard block
 block discarded – undo
185 185
 	}
186 186
 
187 187
 	/**
188
-     * Get an array of reasons why the plugin might be uninstalled
189
-     *
190
-     * @since 1.17.5
191
-     *
188
+	 * Get an array of reasons why the plugin might be uninstalled
189
+	 *
190
+	 * @since 1.17.5
191
+	 *
192 192
 	 * @return array Array of reasons with the label and followup questions for each uninstall reason
193 193
 	 */
194 194
 	private function get_uninstall_reasons() {
195 195
 		$reasons = array(
196 196
 			'will-continue' => array(
197
-                'label' => esc_html__( 'I am going to continue using GravityView', 'gravityview' ),
198
-            ),
197
+				'label' => esc_html__( 'I am going to continue using GravityView', 'gravityview' ),
198
+			),
199 199
 			'no-longer-need' => array(
200
-                'label' => esc_html__( 'I no longer need GravityView', 'gravityview' ),
201
-            ),
200
+				'label' => esc_html__( 'I no longer need GravityView', 'gravityview' ),
201
+			),
202 202
 			'doesnt-work' => array(
203
-                'label' => esc_html__( 'The plugin doesn\'t work', 'gravityview' ),
204
-            ),
203
+				'label' => esc_html__( 'The plugin doesn\'t work', 'gravityview' ),
204
+			),
205 205
 			'found-other' => array(
206
-                'label' => esc_html__( 'I found a better plugin', 'gravityview' ),
207
-                'followup' => esc_attr__( 'What plugin you are using, and why?', 'gravityview' ),
208
-            ),
206
+				'label' => esc_html__( 'I found a better plugin', 'gravityview' ),
207
+				'followup' => esc_attr__( 'What plugin you are using, and why?', 'gravityview' ),
208
+			),
209 209
 			'other' => array(
210
-                'label' => esc_html__( 'Other', 'gravityview' ),
211
-            ),
210
+				'label' => esc_html__( 'Other', 'gravityview' ),
211
+			),
212 212
 		);
213 213
 
214 214
 		shuffle( $reasons );
215 215
 
216 216
 		return $reasons;
217
-    }
217
+	}
218 218
 
219 219
 	/**
220
-     * Display a feedback form when the plugin is uninstalled
221
-     *
222
-     * @since 1.17.5
223
-     *
220
+	 * Display a feedback form when the plugin is uninstalled
221
+	 *
222
+	 * @since 1.17.5
223
+	 *
224 224
 	 * @return string HTML of the uninstallation form
225 225
 	 */
226 226
 	public function uninstall_form() {
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
             <h2><?php esc_html_e( 'Why did you uninstall GravityView?', 'gravityview' ); ?></h2>
301 301
             <ul>
302 302
 				<?php
303
-                $reasons = $this->get_uninstall_reasons();
303
+				$reasons = $this->get_uninstall_reasons();
304 304
 				foreach ( $reasons as $reason ) {
305 305
 					printf( '<li><label><input name="reason" type="radio" value="other" data-followup="%s"> %s</label></li>', Utils::get( $reason, 'followup' ), Utils::get( $reason, 'label' ) );
306 306
 				}
@@ -394,12 +394,12 @@  discard block
 block discarded – undo
394 394
 	}
395 395
 
396 396
 	public function app_settings_tab() {
397
-	    parent::app_settings_tab();
397
+		parent::app_settings_tab();
398 398
 
399 399
 		if ( $this->maybe_uninstall() ) {
400
-            echo $this->uninstall_form();
400
+			echo $this->uninstall_form();
401 401
 		}
402
-    }
402
+	}
403 403
 
404 404
 	/**
405 405
 	 * The Settings title
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
 	 * @return array The settings.
485 485
 	 */
486 486
 	public function all() {
487
-	    return wp_parse_args( get_option( 'gravityformsaddon_' . $this->_slug . '_app_settings', array() ), $this->defaults() );
487
+		return wp_parse_args( get_option( 'gravityformsaddon_' . $this->_slug . '_app_settings', array() ), $this->defaults() );
488 488
 	}
489 489
 
490 490
 	/**
@@ -553,8 +553,8 @@  discard block
 block discarded – undo
553 553
                     type="' . $field['type'] . '"
554 554
                     name="' . esc_attr( $name ) . '"
555 555
                     value="' . $value . '" ' .
556
-		        implode( ' ', $attributes ) .
557
-		        ' />';
556
+				implode( ' ', $attributes ) .
557
+				' />';
558 558
 
559 559
 		if ( $echo ) {
560 560
 			echo $html;
@@ -572,12 +572,12 @@  discard block
 block discarded – undo
572 572
 	}
573 573
 
574 574
 	/**
575
-     * Check whether GravityView is being saved
576
-     *
577
-     * The generic is_save_postback() is true for all addons
578
-     *
579
-     * @since 2.0.8
580
-     *
575
+	 * Check whether GravityView is being saved
576
+	 *
577
+	 * The generic is_save_postback() is true for all addons
578
+	 *
579
+	 * @since 2.0.8
580
+	 *
581 581
 	 * @return bool
582 582
 	 */
583 583
 	public function is_save_postback() {
@@ -591,16 +591,16 @@  discard block
 block discarded – undo
591 591
 	 */
592 592
 	public function license_key_notice() {
593 593
 
594
-	    if( $this->is_save_postback() ) {
595
-		    $settings = $this->get_posted_settings();
596
-		    $license_key = \GV\Utils::get( $settings, 'license_key' );
597
-		    $license_status = \GV\Utils::get( $settings, 'license_key_status', 'inactive' );
598
-        } else {
599
-		    $license_status = $this->get( 'license_key_status', 'inactive' );
600
-		    $license_key    = $this->get( 'license_key' );
601
-	    }
594
+		if( $this->is_save_postback() ) {
595
+			$settings = $this->get_posted_settings();
596
+			$license_key = \GV\Utils::get( $settings, 'license_key' );
597
+			$license_status = \GV\Utils::get( $settings, 'license_key_status', 'inactive' );
598
+		} else {
599
+			$license_status = $this->get( 'license_key_status', 'inactive' );
600
+			$license_key    = $this->get( 'license_key' );
601
+		}
602 602
 
603
-	    $license_id = empty( $license_key ) ? 'license' : $license_key;
603
+		$license_id = empty( $license_key ) ? 'license' : $license_key;
604 604
 
605 605
 		$message = esc_html__( 'Your GravityView license %s. This means you&rsquo;re missing out on updates and support! %sActivate your license%s or %sget a license here%s.', 'gravityview' );
606 606
 
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
 		$update_below = false;
618 618
 		$primary_button_link = admin_url( 'edit.php?post_type=gravityview&amp;page=gravityview_settings' );
619 619
 
620
-        switch ( $license_status ) {
620
+		switch ( $license_status ) {
621 621
 			/** @since 1.17 */
622 622
 			case 'expired':
623 623
 				$title = __( 'Expired License', 'gravityview' );
@@ -655,13 +655,13 @@  discard block
 block discarded – undo
655 655
 			return;
656 656
 		}
657 657
 
658
-        \GravityView_Admin_Notices::add_notice( array(
659
-            'message' => $message,
660
-            'class'   => 'notice notice-warning',
661
-            'title'   => $title,
662
-            'cap'     => 'gravityview_edit_settings',
663
-            'dismiss' => sha1( $license_status . '_' . $license_id . '_' . date( 'z' ) ), // Show every day, instead of every 8 weeks (which is the default)
664
-        ) );
658
+		\GravityView_Admin_Notices::add_notice( array(
659
+			'message' => $message,
660
+			'class'   => 'notice notice-warning',
661
+			'title'   => $title,
662
+			'cap'     => 'gravityview_edit_settings',
663
+			'dismiss' => sha1( $license_status . '_' . $license_id . '_' . date( 'z' ) ), // Show every day, instead of every 8 weeks (which is the default)
664
+		) );
665 665
 	}
666 666
 
667 667
 	/**
@@ -675,12 +675,12 @@  discard block
 block discarded – undo
675 675
 	}
676 676
 
677 677
 	/**
678
-     * Add tooltip script to app settings page. Not enqueued by Gravity Forms for some reason.
679
-     *
680
-     * @since 1.21.5
681
-     *
682
-     * @see GFAddOn::scripts()
683
-     *
678
+	 * Add tooltip script to app settings page. Not enqueued by Gravity Forms for some reason.
679
+	 *
680
+	 * @since 1.21.5
681
+	 *
682
+	 * @see GFAddOn::scripts()
683
+	 *
684 684
 	 * @return array Array of scripts
685 685
 	 */
686 686
 	public function scripts() {
@@ -689,10 +689,10 @@  discard block
 block discarded – undo
689 689
 		$scripts[] = array(
690 690
 			'handle'  => 'gform_tooltip_init',
691 691
 			'enqueue' => array(
692
-                array(
693
-			        'admin_page' => array( 'app_settings' )
694
-                )
695
-            )
692
+				array(
693
+					'admin_page' => array( 'app_settings' )
694
+				)
695
+			)
696 696
 		);
697 697
 
698 698
 		return $scripts;
@@ -710,10 +710,10 @@  discard block
 block discarded – undo
710 710
 			'src'     => plugins_url( 'assets/css/admin-settings.css', GRAVITYVIEW_FILE ),
711 711
 			'version' => Plugin::$version,
712 712
 			'deps' => array(
713
-                'gform_admin',
713
+				'gform_admin',
714 714
 				'gaddon_form_settings_css',
715
-                'gform_tooltip',
716
-                'gform_font_awesome',
715
+				'gform_tooltip',
716
+				'gform_font_awesome',
717 717
 			),
718 718
 			'enqueue' => array(
719 719
 				array( 'admin_page' => array(
@@ -881,7 +881,7 @@  discard block
 block discarded – undo
881 881
 					array(
882 882
 						'label' => _x( 'Show me beta versions if they are available.', 'gravityview' ),
883 883
 						'value' => '1',
884
-                        'name'  => 'beta',
884
+						'name'  => 'beta',
885 885
 					),
886 886
 				),
887 887
 				'description'   => __( 'You will have early access to the latest GravityView features and improvements. There may be bugs! If you encounter an issue, help make GravityView better by reporting it!', 'gravityview' ),
@@ -919,38 +919,38 @@  discard block
 block discarded – undo
919 919
 
920 920
 			if ( empty( $field['disabled'] ) ) {
921 921
 				unset( $field['disabled'] );
922
-            }
922
+			}
923 923
 		}
924 924
 
925
-        $sections = array(
926
-            array(
927
-                'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __( 'You are running GravityView version %s', 'gravityview' ), Plugin::$version ) ),
928
-                'fields'      => $fields,
929
-            )
930
-        );
925
+		$sections = array(
926
+			array(
927
+				'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __( 'You are running GravityView version %s', 'gravityview' ), Plugin::$version ) ),
928
+				'fields'      => $fields,
929
+			)
930
+		);
931 931
 
932
-        // custom 'update settings' button
933
-        $button = array(
934
-            'class' => 'button button-primary button-hero',
935
-            'type' => 'save',
936
-        );
932
+		// custom 'update settings' button
933
+		$button = array(
934
+			'class' => 'button button-primary button-hero',
935
+			'type' => 'save',
936
+		);
937 937
 
938 938
 		if ( $disabled_attribute ) {
939 939
 			$button['disabled'] = $disabled_attribute;
940 940
 		}
941 941
 
942
-        /**
943
-         * @filter `gravityview/settings/extension/sections` Modify the GravityView settings page
944
-         * Extensions can tap in here to insert their own section and settings.
945
-         * <code>
946
-         *   $sections[] = array(
947
-         *      'title' => __( 'GravityView My Extension Settings', 'gravityview' ),
948
-         *      'fields' => $settings,
949
-         *   );
950
-         * </code>
951
-         * @param array $extension_settings Empty array, ready for extension settings!
952
-         */
953
-        $extension_sections = apply_filters( 'gravityview/settings/extension/sections', array() );
942
+		/**
943
+		 * @filter `gravityview/settings/extension/sections` Modify the GravityView settings page
944
+		 * Extensions can tap in here to insert their own section and settings.
945
+		 * <code>
946
+		 *   $sections[] = array(
947
+		 *      'title' => __( 'GravityView My Extension Settings', 'gravityview' ),
948
+		 *      'fields' => $settings,
949
+		 *   );
950
+		 * </code>
951
+		 * @param array $extension_settings Empty array, ready for extension settings!
952
+		 */
953
+		$extension_sections = apply_filters( 'gravityview/settings/extension/sections', array() );
954 954
 
955 955
 		// If there are extensions, add a section for them
956 956
 		if ( ! empty( $extension_sections ) ) {
@@ -963,13 +963,13 @@  discard block
 block discarded – undo
963 963
 				}
964 964
 			}
965 965
 
966
-            $k = count( $extension_sections ) - 1 ;
967
-            $extension_sections[ $k ]['fields'][] = $button;
966
+			$k = count( $extension_sections ) - 1 ;
967
+			$extension_sections[ $k ]['fields'][] = $button;
968 968
 			$sections = array_merge( $sections, $extension_sections );
969 969
 		} else {
970
-            // add the 'update settings' button to the general section
971
-            $sections[0]['fields'][] = $button;
972
-        }
970
+			// add the 'update settings' button to the general section
971
+			$sections[0]['fields'][] = $button;
972
+		}
973 973
 
974 974
 		return $sections;
975 975
 	}
@@ -1023,9 +1023,9 @@  discard block
 block discarded – undo
1023 1023
 	 */
1024 1024
 	protected function settings_edd_license( $field, $echo = true ) {
1025 1025
 
1026
-	    if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) {
1027
-		    $field['input_type'] = 'password';
1028
-        }
1026
+		if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) {
1027
+			$field['input_type'] = 'password';
1028
+		}
1029 1029
 
1030 1030
 		$text = $this->settings_text( $field, false );
1031 1031
 
@@ -1042,9 +1042,9 @@  discard block
 block discarded – undo
1042 1042
 
1043 1043
 	/**
1044 1044
 	 * Allow pure HTML settings row
1045
-     *
1046
-     * @since 2.0.6
1047
-     *
1045
+	 *
1046
+	 * @since 2.0.6
1047
+	 *
1048 1048
 	 * @param array $field
1049 1049
 	 * @param bool $echo Whether to echo the
1050 1050
 	 *
@@ -1110,19 +1110,19 @@  discard block
 block discarded – undo
1110 1110
 	}
1111 1111
 
1112 1112
 	/**
1113
-     * Keep GravityView styling for `$field['description']`, even though Gravity Forms added support for it
1114
-     *
1115
-     * Converts `$field['description']` to `$field['gv_description']`
1116
-     * Converts `$field['subtitle']` to `$field['description']`
1117
-     *
1118
-     * @see \GV\Addon_Settings::single_setting_label Converts `gv_description` back to `description`
1119
-     * @see http://share.gravityview.co/P28uGp/2OIRKxog for image that shows subtitle vs description
1120
-     *
1121
-     * @since 1.21.5.2
1122
-     *
1113
+	 * Keep GravityView styling for `$field['description']`, even though Gravity Forms added support for it
1114
+	 *
1115
+	 * Converts `$field['description']` to `$field['gv_description']`
1116
+	 * Converts `$field['subtitle']` to `$field['description']`
1117
+	 *
1118
+	 * @see \GV\Addon_Settings::single_setting_label Converts `gv_description` back to `description`
1119
+	 * @see http://share.gravityview.co/P28uGp/2OIRKxog for image that shows subtitle vs description
1120
+	 *
1121
+	 * @since 1.21.5.2
1122
+	 *
1123 1123
 	 * @param array $field
1124
-     *
1125
-     * @return void
1124
+	 *
1125
+	 * @return void
1126 1126
 	 */
1127 1127
 	public function single_setting_row( $field ) {
1128 1128
 		$field['gv_description'] = Utils::get( $field, 'description' );
Please login to merge, or discard this patch.
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	 * @return array
103 103
 	 */
104 104
 	public function modify_app_settings_menu_title( $setting_tabs ) {
105
-		$setting_tabs[0]['label'] = __( 'GravityView Settings', 'gravityview' );
105
+		$setting_tabs[ 0 ][ 'label' ] = __( 'GravityView Settings', 'gravityview' );
106 106
 		return $setting_tabs;
107 107
 	}
108 108
 
@@ -308,15 +308,15 @@  discard block
 block discarded – undo
308 308
             </ul>
309 309
             <div class="gv-followup widefat">
310 310
                 <p><strong><label for="gv-reason-details"><?php esc_html_e( 'Comments', 'gravityview' ); ?></label></strong></p>
311
-                <textarea id="gv-reason-details" name="reason_details" data-default="<?php esc_attr_e('Please share your thoughts about GravityView', 'gravityview') ?>" placeholder="<?php esc_attr_e('Please share your thoughts about GravityView', 'gravityview'); ?>" class="large-text"></textarea>
311
+                <textarea id="gv-reason-details" name="reason_details" data-default="<?php esc_attr_e( 'Please share your thoughts about GravityView', 'gravityview' ) ?>" placeholder="<?php esc_attr_e( 'Please share your thoughts about GravityView', 'gravityview' ); ?>" class="large-text"></textarea>
312 312
             </div>
313 313
             <div class="scale-description">
314 314
                 <p><strong><?php esc_html_e( 'How likely are you to recommend GravityView?', 'gravityview' ); ?></strong></p>
315 315
                 <ul class="inline">
316 316
 					<?php
317 317
 					$i = 0;
318
-					while( $i < 11 ) {
319
-						echo '<li class="inline number-scale"><label><input name="likely_to_refer" id="likely_to_refer_'.$i.'" value="'.$i.'" type="radio"> '.$i.'</label></li>';
318
+					while ( $i < 11 ) {
319
+						echo '<li class="inline number-scale"><label><input name="likely_to_refer" id="likely_to_refer_' . $i . '" value="' . $i . '" type="radio"> ' . $i . '</label></li>';
320 320
 						$i++;
321 321
 					}
322 322
 					?>
@@ -533,15 +533,15 @@  discard block
 block discarded – undo
533 533
 	 * @return string The HTML
534 534
 	 */
535 535
 	public function as_html( $field, $echo = true ) {
536
-		$field['type']  = ( isset( $field['type'] ) && in_array( $field['type'], array( 'submit','reset','button' ) ) ) ? $field['type'] : 'submit';
536
+		$field[ 'type' ] = ( isset( $field[ 'type' ] ) && in_array( $field[ 'type' ], array( 'submit', 'reset', 'button' ) ) ) ? $field[ 'type' ] : 'submit';
537 537
 
538 538
 		$attributes    = $this->get_field_attributes( $field );
539 539
 		$default_value = Utils::get( $field, 'value', Utils::get( $field, 'default_value' ) );
540
-		$value         = $this->get( $field['name'], $default_value );
540
+		$value         = $this->get( $field[ 'name' ], $default_value );
541 541
 
542 542
 
543
-		$attributes['class'] = isset( $attributes['class'] ) ? esc_attr( $attributes['class'] ) : 'button-primary gfbutton';
544
-		$name    = ( $field['name'] === 'gform-settings-save' ) ? $field['name'] : '_gaddon_setting_' . $field['name'];
543
+		$attributes[ 'class' ] = isset( $attributes[ 'class' ] ) ? esc_attr( $attributes[ 'class' ] ) : 'button-primary gfbutton';
544
+		$name = ( $field[ 'name' ] === 'gform-settings-save' ) ? $field[ 'name' ] : '_gaddon_setting_' . $field[ 'name' ];
545 545
 
546 546
 		if ( empty( $value ) ) {
547 547
 			$value = __( 'Update Settings', 'gravityview' );
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
 		$attributes = $this->get_field_attributes( $field );
551 551
 
552 552
 		$html = '<input
553
-                    type="' . $field['type'] . '"
553
+                    type="' . $field[ 'type' ] . '"
554 554
                     name="' . esc_attr( $name ) . '"
555 555
                     value="' . $value . '" ' .
556 556
 		        implode( ' ', $attributes ) .
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
 	 * @return bool
582 582
 	 */
583 583
 	public function is_save_postback() {
584
-		return isset( $_POST['gform-settings-save'] ) && isset( $_POST['_gravityview_save_settings_nonce'] );
584
+		return isset( $_POST[ 'gform-settings-save' ] ) && isset( $_POST[ '_gravityview_save_settings_nonce' ] );
585 585
 	}
586 586
 
587 587
 	/**
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
 	 */
592 592
 	public function license_key_notice() {
593 593
 
594
-	    if( $this->is_save_postback() ) {
594
+	    if ( $this->is_save_postback() ) {
595 595
 		    $settings = $this->get_posted_settings();
596 596
 		    $license_key = \GV\Utils::get( $settings, 'license_key' );
597 597
 		    $license_status = \GV\Utils::get( $settings, 'license_key_status', 'inactive' );
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
 		 * but didn't want to mess up the translation strings for the translators.
613 613
 		 */
614 614
 		$message = mb_substr( $message, 0, mb_strlen( $message ) - 1 );
615
-		$title = __( 'Inactive License', 'gravityview');
615
+		$title = __( 'Inactive License', 'gravityview' );
616 616
 		$status = '';
617 617
 		$update_below = false;
618 618
 		$primary_button_link = admin_url( 'edit.php?post_type=gravityview&amp;page=gravityview_settings' );
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
 				$update_below = __( 'Activate your license key below.', 'gravityview' );
643 643
 				break;
644 644
 		}
645
-		$url = 'https://gravityview.co/pricing/?utm_source=admin_notice&utm_medium=admin&utm_content='.$license_status.'&utm_campaign=Admin%20Notice';
645
+		$url = 'https://gravityview.co/pricing/?utm_source=admin_notice&utm_medium=admin&utm_content=' . $license_status . '&utm_campaign=Admin%20Notice';
646 646
 
647 647
 		// Show a different notice on settings page for inactive licenses (hide the buttons)
648 648
 		if ( $update_below && gravityview()->request->is_admin( '', 'settings' ) ) {
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
 	public function scripts() {
687 687
 		$scripts = parent::scripts();
688 688
 
689
-		$scripts[] = array(
689
+		$scripts[ ] = array(
690 690
 			'handle'  => 'gform_tooltip_init',
691 691
 			'enqueue' => array(
692 692
                 array(
@@ -705,7 +705,7 @@  discard block
 block discarded – undo
705 705
 	public function styles() {
706 706
 		$styles = parent::styles();
707 707
 
708
-		$styles[] = array(
708
+		$styles[ ] = array(
709 709
 			'handle'  => 'gravityview_settings',
710 710
 			'src'     => plugins_url( 'assets/css/admin-settings.css', GRAVITYVIEW_FILE ),
711 711
 			'version' => Plugin::$version,
@@ -736,7 +736,7 @@  discard block
 block discarded – undo
736 736
 		 * If multisite and not network admin, we don't want the settings to show.
737 737
 		 * @since 1.7.6
738 738
 		 */
739
-		$show_submenu = ( ! is_multisite() ) ||  is_main_site() || ( ! gravityview()->plugin->is_network_activated() ) || ( is_network_admin() && gravityview()->plugin->is_network_activated() );
739
+		$show_submenu = ( ! is_multisite() ) || is_main_site() || ( ! gravityview()->plugin->is_network_activated() ) || ( is_network_admin() && gravityview()->plugin->is_network_activated() );
740 740
 
741 741
 		/**
742 742
 		 * Override whether to show the Settings menu on a per-blog basis.
@@ -784,26 +784,26 @@  discard block
 block discarded – undo
784 784
 				'label' => __( 'License Key', 'gravityview' ),
785 785
 				'description' => __( 'Enter the license key that was sent to you on purchase. This enables plugin updates &amp; support.', 'gravityview' ) . $this->get_license_handler()->license_details( $this->get_app_setting( 'license_key_response' ) ),
786 786
 				'type' => 'edd_license',
787
-				'disabled' => ( defined( 'GRAVITYVIEW_LICENSE_KEY' )  && GRAVITYVIEW_LICENSE_KEY ),
787
+				'disabled' => ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ),
788 788
 				'data-pending-text' => __( 'Verifying license&hellip;', 'gravityview' ),
789
-				'default_value' => $default_settings['license_key'],
789
+				'default_value' => $default_settings[ 'license_key' ],
790 790
 				'class' => ( '' == $this->get( 'license_key' ) ) ? 'activate code regular-text edd-license-key' : 'deactivate code regular-text edd-license-key',
791 791
 			),
792 792
 			array(
793 793
 				'name' => 'license_key_response',
794
-				'default_value' => $default_settings['license_key_response'],
794
+				'default_value' => $default_settings[ 'license_key_response' ],
795 795
 				'type' => 'hidden',
796 796
 			),
797 797
 			array(
798 798
 				'name' => 'license_key_status',
799
-				'default_value' => $default_settings['license_key_status'],
799
+				'default_value' => $default_settings[ 'license_key_status' ],
800 800
 				'type' => 'hidden',
801 801
 			),
802 802
 			array(
803 803
 				'name' => 'support-email',
804 804
 				'type' => 'text',
805 805
 				'validate' => 'email',
806
-				'default_value' => $default_settings['support-email'],
806
+				'default_value' => $default_settings[ 'support-email' ],
807 807
 				'label' => __( 'Support Email', 'gravityview' ),
808 808
 				'description' => __( 'In order to provide responses to your support requests, please provide your email address.', 'gravityview' ),
809 809
 				'class' => 'code regular-text',
@@ -815,7 +815,7 @@  discard block
 block discarded – undo
815 815
 				'name' => 'support_port',
816 816
 				'type' => 'radio',
817 817
 				'label' => __( 'Show Support Port?', 'gravityview' ),
818
-				'default_value' => $default_settings['support_port'],
818
+				'default_value' => $default_settings[ 'support_port' ],
819 819
 				'horizontal' => 1,
820 820
 				'choices' => array(
821 821
 					array(
@@ -834,7 +834,7 @@  discard block
 block discarded – undo
834 834
 				'name' => 'no-conflict-mode',
835 835
 				'type' => 'radio',
836 836
 				'label' => __( 'No-Conflict Mode', 'gravityview' ),
837
-				'default_value' => $default_settings['no-conflict-mode'],
837
+				'default_value' => $default_settings[ 'no-conflict-mode' ],
838 838
 				'horizontal' => 1,
839 839
 				'choices' => array(
840 840
 					array(
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
 					'name' => 'rest_api',
857 857
 					'type' => 'radio',
858 858
 					'label' => __( 'REST API', 'gravityview' ),
859
-					'default_value' => $default_settings['rest_api'],
859
+					'default_value' => $default_settings[ 'rest_api' ],
860 860
 					'horizontal' => 1,
861 861
 					'choices' => array(
862 862
 						array(
@@ -875,7 +875,7 @@  discard block
 block discarded – undo
875 875
 				'name' => 'beta',
876 876
 				'type' => 'checkbox',
877 877
 				'label' => __( 'Become a Beta Tester', 'gravityview' ),
878
-				'default_value' => $default_settings['beta'],
878
+				'default_value' => $default_settings[ 'beta' ],
879 879
 				'horizontal' => 1,
880 880
 				'choices' => array(
881 881
 					array(
@@ -908,17 +908,17 @@  discard block
 block discarded – undo
908 908
 		 * @since 1.7.4
909 909
 		 */
910 910
 		foreach ( $fields as &$field ) {
911
-			$field['name']          = isset( $field['name'] ) ? $field['name'] : Utils::get( $field, 'id' );
912
-			$field['label']         = isset( $field['label'] ) ? $field['label'] : Utils::get( $field, 'title' );
913
-			$field['default_value'] = isset( $field['default_value'] ) ? $field['default_value'] : Utils::get( $field, 'default' );
914
-			$field['description']   = isset( $field['description'] ) ? $field['description'] : Utils::get( $field, 'subtitle' );
911
+			$field[ 'name' ]          = isset( $field[ 'name' ] ) ? $field[ 'name' ] : Utils::get( $field, 'id' );
912
+			$field[ 'label' ]         = isset( $field[ 'label' ] ) ? $field[ 'label' ] : Utils::get( $field, 'title' );
913
+			$field[ 'default_value' ] = isset( $field[ 'default_value' ] ) ? $field[ 'default_value' ] : Utils::get( $field, 'default' );
914
+			$field[ 'description' ]   = isset( $field[ 'description' ] ) ? $field[ 'description' ] : Utils::get( $field, 'subtitle' );
915 915
 
916 916
 			if ( $disabled_attribute ) {
917
-				$field['disabled']  = $disabled_attribute;
917
+				$field[ 'disabled' ] = $disabled_attribute;
918 918
 			}
919 919
 
920
-			if ( empty( $field['disabled'] ) ) {
921
-				unset( $field['disabled'] );
920
+			if ( empty( $field[ 'disabled' ] ) ) {
921
+				unset( $field[ 'disabled' ] );
922 922
             }
923 923
 		}
924 924
 
@@ -936,7 +936,7 @@  discard block
 block discarded – undo
936 936
         );
937 937
 
938 938
 		if ( $disabled_attribute ) {
939
-			$button['disabled'] = $disabled_attribute;
939
+			$button[ 'disabled' ] = $disabled_attribute;
940 940
 		}
941 941
 
942 942
         /**
@@ -955,20 +955,20 @@  discard block
 block discarded – undo
955 955
 		// If there are extensions, add a section for them
956 956
 		if ( ! empty( $extension_sections ) ) {
957 957
 
958
-			if( $disabled_attribute ) {
958
+			if ( $disabled_attribute ) {
959 959
 				foreach ( $extension_sections as &$section ) {
960
-					foreach ( $section['fields'] as &$field ) {
961
-						$field['disabled'] = $disabled_attribute;
960
+					foreach ( $section[ 'fields' ] as &$field ) {
961
+						$field[ 'disabled' ] = $disabled_attribute;
962 962
 					}
963 963
 				}
964 964
 			}
965 965
 
966
-            $k = count( $extension_sections ) - 1 ;
967
-            $extension_sections[ $k ]['fields'][] = $button;
966
+            $k = count( $extension_sections ) - 1;
967
+            $extension_sections[ $k ][ 'fields' ][ ] = $button;
968 968
 			$sections = array_merge( $sections, $extension_sections );
969 969
 		} else {
970 970
             // add the 'update settings' button to the general section
971
-            $sections[0]['fields'][] = $button;
971
+            $sections[ 0 ][ 'fields' ][ ] = $button;
972 972
         }
973 973
 
974 974
 		return $sections;
@@ -1024,7 +1024,7 @@  discard block
 block discarded – undo
1024 1024
 	protected function settings_edd_license( $field, $echo = true ) {
1025 1025
 
1026 1026
 	    if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) {
1027
-		    $field['input_type'] = 'password';
1027
+		    $field[ 'input_type' ] = 'password';
1028 1028
         }
1029 1029
 
1030 1030
 		$text = $this->settings_text( $field, false );
@@ -1073,7 +1073,7 @@  discard block
 block discarded – undo
1073 1073
 	public function single_setting_row_html( $field ) {
1074 1074
 		?>
1075 1075
 
1076
-        <tr id="gaddon-setting-row-<?php echo esc_attr( $field['name'] ); ?>">
1076
+        <tr id="gaddon-setting-row-<?php echo esc_attr( $field[ 'name' ] ); ?>">
1077 1077
             <td colspan="2">
1078 1078
 				<?php $this->single_setting( $field ); ?>
1079 1079
             </td>
@@ -1091,10 +1091,10 @@  discard block
 block discarded – undo
1091 1091
 	 * @return string
1092 1092
 	 */
1093 1093
 	public function settings_save( $field, $echo = true ) {
1094
-		$field['type']  = 'submit';
1095
-		$field['name']  = 'gform-settings-save';
1096
-		$field['class'] = isset( $field['class'] ) ? $field['class'] : 'button-primary gfbutton';
1097
-		$field['value'] = Utils::get( $field, 'value', __( 'Update Settings', 'gravityview' ) );
1094
+		$field[ 'type' ]  = 'submit';
1095
+		$field[ 'name' ]  = 'gform-settings-save';
1096
+		$field[ 'class' ] = isset( $field[ 'class' ] ) ? $field[ 'class' ] : 'button-primary gfbutton';
1097
+		$field[ 'value' ] = Utils::get( $field, 'value', __( 'Update Settings', 'gravityview' ) );
1098 1098
 
1099 1099
 		$output = $this->settings_submit( $field, false );
1100 1100
 
@@ -1125,8 +1125,8 @@  discard block
 block discarded – undo
1125 1125
      * @return void
1126 1126
 	 */
1127 1127
 	public function single_setting_row( $field ) {
1128
-		$field['gv_description'] = Utils::get( $field, 'description' );
1129
-		$field['description']    = Utils::get( $field, 'subtitle' );
1128
+		$field[ 'gv_description' ] = Utils::get( $field, 'description' );
1129
+		$field[ 'description' ]    = Utils::get( $field, 'subtitle' );
1130 1130
 		parent::single_setting_row( $field );
1131 1131
 	}
1132 1132
 
@@ -1138,7 +1138,7 @@  discard block
 block discarded – undo
1138 1138
 	public function single_setting_label( $field ) {
1139 1139
 		parent::single_setting_label( $field );
1140 1140
 		if ( $description = Utils::get( $field, 'gv_description' ) ) {
1141
-			echo '<span class="description">'. $description .'</span>';
1141
+			echo '<span class="description">' . $description . '</span>';
1142 1142
 		}
1143 1143
 	}
1144 1144
 
@@ -1175,9 +1175,9 @@  discard block
 block discarded – undo
1175 1175
 		// If the posted key doesn't match the activated/deactivated key (set using the Activate License button, AJAX response),
1176 1176
 		// then we assume it's changed. If it's changed, unset the status and the previous response.
1177 1177
 		if ( $local_key !== $response_key ) {
1178
-			unset( $posted_settings['license_key_response'] );
1179
-			unset( $posted_settings['license_key_status'] );
1180
-			\GFCommon::add_error_message( __('The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) );
1178
+			unset( $posted_settings[ 'license_key_response' ] );
1179
+			unset( $posted_settings[ 'license_key_status' ] );
1180
+			\GFCommon::add_error_message( __( 'The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) );
1181 1181
 		}
1182 1182
 		return $posted_settings;
1183 1183
 	}
Please login to merge, or discard this patch.
future/includes/rest/class-gv-rest-route.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 
133 133
 		$format = '(?:\.(?P<format>html|json))?';
134 134
 
135
-		register_rest_route( $namespace, sprintf( '/%s/(?P<id>[\d]+)/%s/(?P<s_id>[\w-]+)%s', $base, $sub_type, $format ) , array(
135
+		register_rest_route( $namespace, sprintf( '/%s/(?P<id>[\d]+)/%s/(?P<s_id>[\w-]+)%s', $base, $sub_type, $format ), array(
136 136
 			array(
137 137
 				'methods'         => \WP_REST_Server::READABLE,
138 138
 				'callback'        => array( $this, 'get_sub_item' ),
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 	 * @return \WP_REST_Response
384 384
 	 */
385 385
 	protected function not_implemented(  ) {
386
-		$error = new \WP_Error( 'not-implemented-yet', __( 'Endpoint Not Yet Implemented.', 'gravityview' )  );
386
+		$error = new \WP_Error( 'not-implemented-yet', __( 'Endpoint Not Yet Implemented.', 'gravityview' ) );
387 387
 		return new \WP_REST_Response( $error, 501 );
388 388
 	}
389 389
 
Please login to merge, or discard this patch.
includes/extensions/edit-entry/class-edit-entry-render.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -282,7 +282,7 @@
 block discarded – undo
282 282
 	/**
283 283
 	 * Process edit entry form save
284 284
 	 *
285
-	 * @param array $gv_data The View data.
285
+	 * @param GravityView_View_Data $gv_data The View data.
286 286
 	 */
287 287
 	private function process_save( $gv_data ) {
288 288
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -976,7 +976,7 @@  discard block
 block discarded – undo
976 976
 
977 977
 			$back_link = remove_query_arg( array( 'page', 'view', 'edit' ) );
978 978
 
979
-			if( ! $this->is_valid ){
979
+			if( ! $this->is_valid ) {
980 980
 
981 981
 				// Keeping this compatible with Gravity Forms.
982 982
 				$validation_message = "<div class='validation_error'>" . __('There was a problem with your submission.', 'gravityview') . " " . __('Errors have been highlighted below.', 'gravityview') . "</div>";
@@ -2058,9 +2058,7 @@  discard block
 block discarded – undo
2058 2058
 		// Verify
2059 2059
 		else if( ! $this->is_edit_entry() ) {
2060 2060
 			$valid = false;
2061
-		}
2062
-
2063
-		else {
2061
+		} else {
2064 2062
 			$valid = wp_verify_nonce( $_GET['edit'], self::$nonce_key );
2065 2063
 		}
2066 2064
 
Please login to merge, or discard this patch.
Indentation   +288 added lines, -288 removed lines patch added patch discarded remove patch
@@ -94,10 +94,10 @@  discard block
 block discarded – undo
94 94
 
95 95
 	/**
96 96
 	 * ID of the current post. May also be ID of the current View.
97
-     *
98
-     * @since 2.0.13
99
-     * 
100
-     * @var int
97
+	 *
98
+	 * @since 2.0.13
99
+	 * 
100
+	 * @var int
101 101
 	 */
102 102
 	public $post_id;
103 103
 
@@ -169,12 +169,12 @@  discard block
 block discarded – undo
169 169
 	public function prevent_maybe_process_form() {
170 170
 
171 171
 		if( ! empty( $_POST ) ) {
172
-	        gravityview()->log->debug( 'GravityView_Edit_Entry[prevent_maybe_process_form] $_POSTed data (sanitized): ', array( 'data' => esc_html( print_r( $_POST, true ) ) ) );
172
+			gravityview()->log->debug( 'GravityView_Edit_Entry[prevent_maybe_process_form] $_POSTed data (sanitized): ', array( 'data' => esc_html( print_r( $_POST, true ) ) ) );
173 173
 		}
174 174
 
175 175
 		if( $this->is_edit_entry_submission() ) {
176 176
 			remove_action( 'wp',  array( 'RGForms', 'maybe_process_form'), 9 );
177
-	        remove_action( 'wp',  array( 'GFForms', 'maybe_process_form'), 9 );
177
+			remove_action( 'wp',  array( 'GFForms', 'maybe_process_form'), 9 );
178 178
 		}
179 179
 	}
180 180
 
@@ -202,14 +202,14 @@  discard block
 block discarded – undo
202 202
 	 * When Edit entry view is requested setup the vars
203 203
 	 */
204 204
 	private function setup_vars() {
205
-        global $post;
205
+		global $post;
206 206
 
207 207
 		$gravityview_view = GravityView_View::getInstance();
208 208
 
209 209
 
210 210
 		$entries = $gravityview_view->getEntries();
211
-	    self::$original_entry = $entries[0];
212
-	    $this->entry = $entries[0];
211
+		self::$original_entry = $entries[0];
212
+		$this->entry = $entries[0];
213 213
 
214 214
 		self::$original_form = $gravityview_view->getForm();
215 215
 		$this->form = $gravityview_view->getForm();
@@ -333,8 +333,8 @@  discard block
 block discarded – undo
333 333
 
334 334
 			GFFormsModel::save_lead( $form, $this->entry );
335 335
 
336
-	        // Delete the values for hidden inputs
337
-	        $this->unset_hidden_field_values();
336
+			// Delete the values for hidden inputs
337
+			$this->unset_hidden_field_values();
338 338
 			
339 339
 			$this->entry['date_created'] = $date_created;
340 340
 
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 			// Perform actions normally performed after updating a lead
345 345
 			$this->after_update();
346 346
 
347
-	        /**
347
+			/**
348 348
 			 * Must be AFTER after_update()!
349 349
 			 * @see https://github.com/gravityview/GravityView/issues/764
350 350
 			 */
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 
353 353
 			/**
354 354
 			 * @action `gravityview/edit_entry/after_update` Perform an action after the entry has been updated using Edit Entry
355
-             * @since 2.1 Added $gv_data parameter
355
+			 * @since 2.1 Added $gv_data parameter
356 356
 			 * @param array $form Gravity Forms form array
357 357
 			 * @param string $entry_id Numeric ID of the entry that was updated
358 358
 			 * @param GravityView_Edit_Entry_Render $this This object
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 	 * @return void
377 377
 	 */
378 378
 	private function unset_hidden_field_values() {
379
-	    global $wpdb;
379
+		global $wpdb;
380 380
 
381 381
 		/**
382 382
 		 * @filter `gravityview/edit_entry/unset_hidden_field_values` Whether to delete values of fields hidden by conditional logic
@@ -398,29 +398,29 @@  discard block
 block discarded – undo
398 398
 			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $lead_detail_table WHERE lead_id=%d", $this->entry['id'] ) );
399 399
 		}
400 400
 
401
-	    foreach ( $this->entry as $input_id => $field_value ) {
401
+		foreach ( $this->entry as $input_id => $field_value ) {
402 402
 
403
-		    $field = RGFormsModel::get_field( $this->form, $input_id );
403
+			$field = RGFormsModel::get_field( $this->form, $input_id );
404 404
 
405
-		    // Reset fields that are hidden
406
-		    // Don't pass $entry as fourth parameter; force using $_POST values to calculate conditional logic
407
-		    if ( GFFormsModel::is_field_hidden( $this->form, $field, array(), NULL ) ) {
405
+			// Reset fields that are hidden
406
+			// Don't pass $entry as fourth parameter; force using $_POST values to calculate conditional logic
407
+			if ( GFFormsModel::is_field_hidden( $this->form, $field, array(), NULL ) ) {
408 408
 
409 409
 				$empty_value = $field->get_value_save_entry(
410 410
 					is_array( $field->get_entry_inputs() ) ? array() : '',
411 411
 					$this->form, '', $this->entry['id'], $this->entry
412 412
 				);
413 413
 
414
-			    $lead_detail_id = GFFormsModel::get_lead_detail_id( $current_fields, $input_id );
414
+				$lead_detail_id = GFFormsModel::get_lead_detail_id( $current_fields, $input_id );
415 415
 
416
-			    GFFormsModel::update_lead_field_value( $this->form, $this->entry, $field, $lead_detail_id, $input_id, $empty_value );
416
+				GFFormsModel::update_lead_field_value( $this->form, $this->entry, $field, $lead_detail_id, $input_id, $empty_value );
417 417
 
418
-			    // Prevent the $_POST values of hidden fields from being used as default values when rendering the form
418
+				// Prevent the $_POST values of hidden fields from being used as default values when rendering the form
419 419
 				// after submission
420
-			    $post_input_id = 'input_' . str_replace( '.', '_', $input_id );
421
-			    $_POST[ $post_input_id ] = '';
422
-		    }
423
-	    }
420
+				$post_input_id = 'input_' . str_replace( '.', '_', $input_id );
421
+				$_POST[ $post_input_id ] = '';
422
+			}
423
+		}
424 424
 	}
425 425
 
426 426
 	/**
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
 
515 515
 		$form = $this->form;
516 516
 
517
-	    /** @var GF_Field $field */
517
+		/** @var GF_Field $field */
518 518
 		foreach( $form['fields'] as $k => &$field ) {
519 519
 
520 520
 			/**
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
 
531 531
 			if( isset( $field->inputs ) && is_array( $field->inputs ) ) {
532 532
 				foreach( $field->inputs as $key => $input ) {
533
-				    $field->inputs[ $key ][ 'id' ] = (string)$input['id'];
533
+					$field->inputs[ $key ][ 'id' ] = (string)$input['id'];
534 534
 				}
535 535
 			}
536 536
 		}
@@ -563,9 +563,9 @@  discard block
 block discarded – undo
563 563
 			foreach ( $this->fields_with_calculation as $field ) {
564 564
 				$inputs = $field->get_entry_inputs();
565 565
 				if ( is_array( $inputs ) ) {
566
-				    foreach ( $inputs as $input ) {
566
+					foreach ( $inputs as $input ) {
567 567
 						GFFormsModel::save_input( $form, $field, $entry, $current_fields, $input['id'] );
568
-				    }
568
+					}
569 569
 				} else {
570 570
 					GFFormsModel::save_input( $form, $field, $entry, $current_fields, $field->id );
571 571
 				}
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
 			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'] );
608 608
 
609 609
 			$ary = ! empty( $value ) ? explode( '|:|', $value ) : array();
610
-	        $ary = stripslashes_deep( $ary );
610
+			$ary = stripslashes_deep( $ary );
611 611
 			$img_url = \GV\Utils::get( $ary, 0 );
612 612
 
613 613
 			$img_title       = count( $ary ) > 1 ? $ary[1] : '';
@@ -680,7 +680,7 @@  discard block
 block discarded – undo
680 680
 	private function maybe_update_post_fields( $form ) {
681 681
 
682 682
 		if( empty( $this->entry['post_id'] ) ) {
683
-	        gravityview()->log->debug( 'This entry has no post fields. Continuing...' );
683
+			gravityview()->log->debug( 'This entry has no post fields. Continuing...' );
684 684
 			return;
685 685
 		}
686 686
 
@@ -715,49 +715,49 @@  discard block
 block discarded – undo
715 715
 
716 716
 				switch( $field->type ) {
717 717
 
718
-				    case 'post_title':
719
-				        $post_title = $value;
720
-				        if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) {
721
-				            $post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
722
-				        }
723
-				        $updated_post->post_title = $post_title;
724
-				        $updated_post->post_name  = $post_title;
725
-				        unset( $post_title );
726
-				        break;
727
-
728
-				    case 'post_content':
729
-				        $post_content = $value;
730
-				        if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) {
731
-				            $post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
732
-				        }
733
-				        $updated_post->post_content = $post_content;
734
-				        unset( $post_content );
735
-				        break;
736
-				    case 'post_excerpt':
737
-				        $updated_post->post_excerpt = $value;
738
-				        break;
739
-				    case 'post_tags':
740
-				        wp_set_post_tags( $post_id, $value, false );
741
-				        break;
742
-				    case 'post_category':
743
-				        break;
744
-				    case 'post_custom_field':
718
+					case 'post_title':
719
+						$post_title = $value;
720
+						if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) {
721
+							$post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
722
+						}
723
+						$updated_post->post_title = $post_title;
724
+						$updated_post->post_name  = $post_title;
725
+						unset( $post_title );
726
+						break;
727
+
728
+					case 'post_content':
729
+						$post_content = $value;
730
+						if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) {
731
+							$post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
732
+						}
733
+						$updated_post->post_content = $post_content;
734
+						unset( $post_content );
735
+						break;
736
+					case 'post_excerpt':
737
+						$updated_post->post_excerpt = $value;
738
+						break;
739
+					case 'post_tags':
740
+						wp_set_post_tags( $post_id, $value, false );
741
+						break;
742
+					case 'post_category':
743
+						break;
744
+					case 'post_custom_field':
745 745
 						if ( is_array( $value ) && ( floatval( $field_id ) !== floatval( $field->id ) ) ) {
746 746
 							$value = $value[ $field_id ];
747 747
 						}
748 748
 
749
-				        if( ! empty( $field->customFieldTemplateEnabled ) ) {
750
-				            $value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
751
-				        }
749
+						if( ! empty( $field->customFieldTemplateEnabled ) ) {
750
+							$value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
751
+						}
752 752
 
753 753
 						$value = $field->get_value_save_entry( $value, $form, '', $this->entry['id'], $this->entry );
754 754
 
755
-				        update_post_meta( $post_id, $field->postCustomFieldName, $value );
756
-				        break;
755
+						update_post_meta( $post_id, $field->postCustomFieldName, $value );
756
+						break;
757 757
 
758
-				    case 'post_image':
759
-				        $value = $this->update_post_image( $form, $field, $field_id, $value, $this->entry, $post_id );
760
-				        break;
758
+					case 'post_image':
759
+						$value = $this->update_post_image( $form, $field, $field_id, $value, $this->entry, $post_id );
760
+						break;
761 761
 
762 762
 				}
763 763
 
@@ -880,14 +880,14 @@  discard block
 block discarded – undo
880 880
 			?><h2 class="gv-edit-entry-title">
881 881
 				<span><?php
882 882
 
883
-				    /**
884
-				     * @filter `gravityview_edit_entry_title` Modify the edit entry title
885
-				     * @param string $edit_entry_title Modify the "Edit Entry" title
886
-				     * @param GravityView_Edit_Entry_Render $this This object
887
-				     */
888
-				    $edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
883
+					/**
884
+					 * @filter `gravityview_edit_entry_title` Modify the edit entry title
885
+					 * @param string $edit_entry_title Modify the "Edit Entry" title
886
+					 * @param GravityView_Edit_Entry_Render $this This object
887
+					 */
888
+					$edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
889 889
 
890
-				    echo esc_attr( $edit_entry_title );
890
+					echo esc_attr( $edit_entry_title );
891 891
 			?></span>
892 892
 			</h2>
893 893
 
@@ -950,26 +950,26 @@  discard block
 block discarded – undo
950 950
 
951 951
 				switch ( $edit_redirect ) {
952 952
 
953
-                    case '0':
954
-	                    $redirect_url = $back_link;
955
-	                    $entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sReturning to Entry%s', 'Replacements are HTML', 'gravityview'), '<a href="'. esc_url( $redirect_url ) .'">', '</a>' );
956
-                        break;
957
-
958
-                    case '1':
959
-	                    $redirect_url = $directory_link = GravityView_API::directory_link();
960
-	                    $entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sReturning to %s%s', 'Replacement 1 is HTML. Replacement 2 is the title of the page where the user will be taken. Replacement 3 is HTML.','gravityview'), '<a href="'. esc_url( $redirect_url ) . '">', esc_html( $view->post_title ), '</a>' );
961
-	                    break;
962
-
963
-                    case '2':
964
-	                    $redirect_url = $edit_redirect_url;
965
-	                    $redirect_url = GFCommon::replace_variables( $redirect_url, $this->form, $this->entry, false, false, false, 'text' );
966
-	                    $entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sRedirecting to %s%s', 'Replacement 1 is HTML. Replacement 2 is the URL where the user will be taken. Replacement 3 is HTML.','gravityview'), '<a href="'. esc_url( $redirect_url ) . '">', esc_html( $edit_redirect_url ), '</a>' );
967
-                        break;
968
-
969
-                    case '':
970
-                    default:
971
-					    $entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturn to Entry%s', 'gravityview'), '<a href="'. esc_url( $back_link ) .'">', '</a>' );
972
-                        break;
953
+					case '0':
954
+						$redirect_url = $back_link;
955
+						$entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sReturning to Entry%s', 'Replacements are HTML', 'gravityview'), '<a href="'. esc_url( $redirect_url ) .'">', '</a>' );
956
+						break;
957
+
958
+					case '1':
959
+						$redirect_url = $directory_link = GravityView_API::directory_link();
960
+						$entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sReturning to %s%s', 'Replacement 1 is HTML. Replacement 2 is the title of the page where the user will be taken. Replacement 3 is HTML.','gravityview'), '<a href="'. esc_url( $redirect_url ) . '">', esc_html( $view->post_title ), '</a>' );
961
+						break;
962
+
963
+					case '2':
964
+						$redirect_url = $edit_redirect_url;
965
+						$redirect_url = GFCommon::replace_variables( $redirect_url, $this->form, $this->entry, false, false, false, 'text' );
966
+						$entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sRedirecting to %s%s', 'Replacement 1 is HTML. Replacement 2 is the URL where the user will be taken. Replacement 3 is HTML.','gravityview'), '<a href="'. esc_url( $redirect_url ) . '">', esc_html( $edit_redirect_url ), '</a>' );
967
+						break;
968
+
969
+					case '':
970
+					default:
971
+						$entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturn to Entry%s', 'gravityview'), '<a href="'. esc_url( $back_link ) .'">', '</a>' );
972
+						break;
973 973
 				}
974 974
 
975 975
 				if ( isset( $redirect_url ) ) {
@@ -1026,7 +1026,7 @@  discard block
 block discarded – undo
1026 1026
 
1027 1027
 		ob_get_clean();
1028 1028
 
1029
-	    remove_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000 );
1029
+		remove_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000 );
1030 1030
 		remove_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) );
1031 1031
 		remove_filter( 'gform_disable_view_counter', '__return_true' );
1032 1032
 		remove_filter( 'gform_field_input', array( $this, 'verify_user_can_edit_post' ), 5 );
@@ -1080,7 +1080,7 @@  discard block
 block discarded – undo
1080 1080
 
1081 1081
 		// for now we don't support Save and Continue feature.
1082 1082
 		if( ! self::$supports_save_and_continue ) {
1083
-	        unset( $form['save'] );
1083
+			unset( $form['save'] );
1084 1084
 		}
1085 1085
 
1086 1086
 		$form = $this->unselect_default_values( $form );
@@ -1107,30 +1107,30 @@  discard block
 block discarded – undo
1107 1107
 			return $field_content;
1108 1108
 		}
1109 1109
 
1110
-        $message = null;
1110
+		$message = null;
1111 1111
 
1112
-        // First, make sure they have the capability to edit the post.
1113
-        if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) {
1112
+		// First, make sure they have the capability to edit the post.
1113
+		if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) {
1114 1114
 
1115
-            /**
1116
-             * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post
1117
-             * @param string $message The existing "You don't have permission..." text
1118
-             */
1119
-            $message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don&rsquo;t have permission to edit this post.', 'gravityview') );
1115
+			/**
1116
+			 * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post
1117
+			 * @param string $message The existing "You don't have permission..." text
1118
+			 */
1119
+			$message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don&rsquo;t have permission to edit this post.', 'gravityview') );
1120 1120
 
1121
-        } elseif( null === get_post( $this->entry['post_id'] ) ) {
1122
-            /**
1123
-             * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists
1124
-             * @param string $message The existing "This field is not editable; the post no longer exists." text
1125
-             */
1126
-            $message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) );
1127
-        }
1121
+		} elseif( null === get_post( $this->entry['post_id'] ) ) {
1122
+			/**
1123
+			 * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists
1124
+			 * @param string $message The existing "This field is not editable; the post no longer exists." text
1125
+			 */
1126
+			$message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) );
1127
+		}
1128 1128
 
1129
-        if( $message ) {
1130
-            $field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1131
-        }
1129
+		if( $message ) {
1130
+			$field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1131
+		}
1132 1132
 
1133
-        return $field_content;
1133
+		return $field_content;
1134 1134
 	}
1135 1135
 
1136 1136
 	/**
@@ -1158,7 +1158,7 @@  discard block
 block discarded – undo
1158 1158
 			|| ! empty( $field_content )
1159 1159
 			|| in_array( $field->type, array( 'honeypot' ) )
1160 1160
 		) {
1161
-	        return $field_content;
1161
+			return $field_content;
1162 1162
 		}
1163 1163
 
1164 1164
 		// SET SOME FIELD DEFAULTS TO PREVENT ISSUES
@@ -1166,24 +1166,24 @@  discard block
 block discarded – undo
1166 1166
 
1167 1167
 		$field_value = $this->get_field_value( $field );
1168 1168
 
1169
-	    // Prevent any PHP warnings, like undefined index
1170
-	    ob_start();
1169
+		// Prevent any PHP warnings, like undefined index
1170
+		ob_start();
1171 1171
 
1172
-	    $return = null;
1172
+		$return = null;
1173 1173
 
1174 1174
 		/** @var GravityView_Field $gv_field */
1175 1175
 		if( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1176 1176
 			$return = $gv_field->get_field_input( $this->form, $field_value, $this->entry, $field );
1177 1177
 		} else {
1178
-	        $return = $field->get_field_input( $this->form, $field_value, $this->entry );
1179
-	    }
1178
+			$return = $field->get_field_input( $this->form, $field_value, $this->entry );
1179
+		}
1180 1180
 
1181
-	    // If there was output, it's an error
1182
-	    $warnings = ob_get_clean();
1181
+		// If there was output, it's an error
1182
+		$warnings = ob_get_clean();
1183 1183
 
1184
-	    if( !empty( $warnings ) ) {
1185
-		    gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1186
-	    }
1184
+		if( !empty( $warnings ) ) {
1185
+			gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1186
+		}
1187 1187
 
1188 1188
 		return $return;
1189 1189
 	}
@@ -1218,8 +1218,8 @@  discard block
 block discarded – undo
1218 1218
 				$input_id = strval( $input['id'] );
1219 1219
 
1220 1220
 				if ( isset( $this->entry[ $input_id ] ) && ! gv_empty( $this->entry[ $input_id ], false, false ) ) {
1221
-				    $field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1222
-				    $allow_pre_populated = false;
1221
+					$field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1222
+					$allow_pre_populated = false;
1223 1223
 				}
1224 1224
 
1225 1225
 			}
@@ -1243,7 +1243,7 @@  discard block
 block discarded – undo
1243 1243
 			if ( 'post_category' === $field->type && !gv_empty( $field_value, false, false ) ) {
1244 1244
 				$categories = array();
1245 1245
 				foreach ( explode( ',', $field_value ) as $cat_string ) {
1246
-				    $categories[] = GFCommon::format_post_category( $cat_string, true );
1246
+					$categories[] = GFCommon::format_post_category( $cat_string, true );
1247 1247
 				}
1248 1248
 				$field_value = 'multiselect' === $field->get_input_type() ? $categories : implode( '', $categories );
1249 1249
 			}
@@ -1253,25 +1253,25 @@  discard block
 block discarded – undo
1253 1253
 		// if value is empty get the default value if defined
1254 1254
 		$field_value = $field->get_value_default_if_empty( $field_value );
1255 1255
 
1256
-	    /**
1257
-	     * @filter `gravityview/edit_entry/field_value` Change the value of an Edit Entry field, if needed
1258
-	     * @since 1.11
1259
-	     * @since 1.20 Added third param
1260
-	     * @param mixed $field_value field value used to populate the input
1261
-	     * @param object $field Gravity Forms field object ( Class GF_Field )
1262
-	     * @param GravityView_Edit_Entry_Render $this Current object
1263
-	     */
1264
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value', $field_value, $field, $this );
1265
-
1266
-	    /**
1267
-	     * @filter `gravityview/edit_entry/field_value_{field_type}` Change the value of an Edit Entry field for a specific field type
1268
-	     * @since 1.17
1269
-	     * @since 1.20 Added third param
1270
-	     * @param mixed $field_value field value used to populate the input
1271
-	     * @param GF_Field $field Gravity Forms field object
1272
-	     * @param GravityView_Edit_Entry_Render $this Current object
1273
-	     */
1274
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1256
+		/**
1257
+		 * @filter `gravityview/edit_entry/field_value` Change the value of an Edit Entry field, if needed
1258
+		 * @since 1.11
1259
+		 * @since 1.20 Added third param
1260
+		 * @param mixed $field_value field value used to populate the input
1261
+		 * @param object $field Gravity Forms field object ( Class GF_Field )
1262
+		 * @param GravityView_Edit_Entry_Render $this Current object
1263
+		 */
1264
+		$field_value = apply_filters( 'gravityview/edit_entry/field_value', $field_value, $field, $this );
1265
+
1266
+		/**
1267
+		 * @filter `gravityview/edit_entry/field_value_{field_type}` Change the value of an Edit Entry field for a specific field type
1268
+		 * @since 1.17
1269
+		 * @since 1.20 Added third param
1270
+		 * @param mixed $field_value field value used to populate the input
1271
+		 * @param GF_Field $field Gravity Forms field object
1272
+		 * @param GravityView_Edit_Entry_Render $this Current object
1273
+		 */
1274
+		$field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1275 1275
 
1276 1276
 		return $field_value;
1277 1277
 	}
@@ -1298,7 +1298,7 @@  discard block
 block discarded – undo
1298 1298
 			// This is because we're doing admin form pretending to be front-end, so Gravity Forms
1299 1299
 			// expects certain field array items to be set.
1300 1300
 			foreach ( array( 'noDuplicates', 'adminOnly', 'inputType', 'isRequired', 'enablePrice', 'inputs', 'allowedExtensions' ) as $key ) {
1301
-	            $field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1301
+				$field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1302 1302
 			}
1303 1303
 
1304 1304
 			switch( RGFormsModel::get_input_type( $field ) ) {
@@ -1312,61 +1312,61 @@  discard block
 block discarded – undo
1312 1312
 				 */
1313 1313
 				case 'fileupload':
1314 1314
 
1315
-				    // Set the previous value
1316
-				    $entry = $this->get_entry();
1315
+					// Set the previous value
1316
+					$entry = $this->get_entry();
1317 1317
 
1318
-				    $input_name = 'input_'.$field->id;
1319
-				    $form_id = $form['id'];
1318
+					$input_name = 'input_'.$field->id;
1319
+					$form_id = $form['id'];
1320 1320
 
1321
-				    $value = NULL;
1321
+					$value = NULL;
1322 1322
 
1323
-				    // Use the previous entry value as the default.
1324
-				    if( isset( $entry[ $field->id ] ) ) {
1325
-				        $value = $entry[ $field->id ];
1326
-				    }
1323
+					// Use the previous entry value as the default.
1324
+					if( isset( $entry[ $field->id ] ) ) {
1325
+						$value = $entry[ $field->id ];
1326
+					}
1327 1327
 
1328
-				    // If this is a single upload file
1329
-				    if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1330
-				        $file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1331
-				        $value = $file_path['url'];
1328
+					// If this is a single upload file
1329
+					if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1330
+						$file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1331
+						$value = $file_path['url'];
1332 1332
 
1333
-				    } else {
1333
+					} else {
1334 1334
 
1335
-				        // Fix PHP warning on line 1498 of form_display.php for post_image fields
1336
-				        // Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1337
-				        $_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1335
+						// Fix PHP warning on line 1498 of form_display.php for post_image fields
1336
+						// Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1337
+						$_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1338 1338
 
1339
-				    }
1339
+					}
1340 1340
 
1341
-				    if ( \GV\Utils::get( $field, "multipleFiles" ) ) {
1341
+					if ( \GV\Utils::get( $field, "multipleFiles" ) ) {
1342 1342
 
1343
-				        // If there are fresh uploads, process and merge them.
1344
-				        // Otherwise, use the passed values, which should be json-encoded array of URLs
1345
-				        if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) {
1346
-				            $value = empty( $value ) ? '[]' : $value;
1347
-				            $value = stripslashes_deep( $value );
1348
-				            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array());
1349
-				        }
1343
+						// If there are fresh uploads, process and merge them.
1344
+						// Otherwise, use the passed values, which should be json-encoded array of URLs
1345
+						if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) {
1346
+							$value = empty( $value ) ? '[]' : $value;
1347
+							$value = stripslashes_deep( $value );
1348
+							$value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array());
1349
+						}
1350 1350
 
1351
-				    } else {
1351
+					} else {
1352 1352
 
1353
-				        // A file already exists when editing an entry
1354
-				        // We set this to solve issue when file upload fields are required.
1355
-				        GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] = $value;
1353
+						// A file already exists when editing an entry
1354
+						// We set this to solve issue when file upload fields are required.
1355
+						GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] = $value;
1356 1356
 
1357
-				    }
1357
+					}
1358 1358
 
1359
-				    $this->entry[ $input_name ] = $value;
1360
-				    $_POST[ $input_name ] = $value;
1359
+					$this->entry[ $input_name ] = $value;
1360
+					$_POST[ $input_name ] = $value;
1361 1361
 
1362
-				    break;
1362
+					break;
1363 1363
 
1364 1364
 				case 'number':
1365
-				    // Fix "undefined index" issue at line 1286 in form_display.php
1366
-				    if( !isset( $_POST['input_'.$field->id ] ) ) {
1367
-				        $_POST['input_'.$field->id ] = NULL;
1368
-				    }
1369
-				    break;
1365
+					// Fix "undefined index" issue at line 1286 in form_display.php
1366
+					if( !isset( $_POST['input_'.$field->id ] ) ) {
1367
+						$_POST['input_'.$field->id ] = NULL;
1368
+					}
1369
+					break;
1370 1370
 			}
1371 1371
 
1372 1372
 		}
@@ -1451,42 +1451,42 @@  discard block
 block discarded – undo
1451 1451
 				case 'fileupload' :
1452 1452
 				case 'post_image':
1453 1453
 
1454
-				    // in case nothing is uploaded but there are already files saved
1455
-				    if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) {
1456
-				        $field->failed_validation = false;
1457
-				        unset( $field->validation_message );
1458
-				    }
1454
+					// in case nothing is uploaded but there are already files saved
1455
+					if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) {
1456
+						$field->failed_validation = false;
1457
+						unset( $field->validation_message );
1458
+					}
1459 1459
 
1460
-				    // validate if multi file upload reached max number of files [maxFiles] => 2
1461
-				    if( \GV\Utils::get( $field, 'maxFiles') && \GV\Utils::get( $field, 'multipleFiles') ) {
1460
+					// validate if multi file upload reached max number of files [maxFiles] => 2
1461
+					if( \GV\Utils::get( $field, 'maxFiles') && \GV\Utils::get( $field, 'multipleFiles') ) {
1462 1462
 
1463
-				        $input_name = 'input_' . $field->id;
1464
-				        //uploaded
1465
-				        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1463
+						$input_name = 'input_' . $field->id;
1464
+						//uploaded
1465
+						$file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1466 1466
 
1467
-				        //existent
1468
-				        $entry = $this->get_entry();
1469
-				        $value = NULL;
1470
-				        if( isset( $entry[ $field->id ] ) ) {
1471
-				            $value = json_decode( $entry[ $field->id ], true );
1472
-				        }
1467
+						//existent
1468
+						$entry = $this->get_entry();
1469
+						$value = NULL;
1470
+						if( isset( $entry[ $field->id ] ) ) {
1471
+							$value = json_decode( $entry[ $field->id ], true );
1472
+						}
1473 1473
 
1474
-				        // count uploaded files and existent entry files
1475
-				        $count_files = count( $file_names ) + count( $value );
1474
+						// count uploaded files and existent entry files
1475
+						$count_files = count( $file_names ) + count( $value );
1476 1476
 
1477
-				        if( $count_files > $field->maxFiles ) {
1478
-				            $field->validation_message = __( 'Maximum number of files reached', 'gravityview' );
1479
-				            $field->failed_validation = 1;
1480
-				            $gv_valid = false;
1477
+						if( $count_files > $field->maxFiles ) {
1478
+							$field->validation_message = __( 'Maximum number of files reached', 'gravityview' );
1479
+							$field->failed_validation = 1;
1480
+							$gv_valid = false;
1481 1481
 
1482
-				            // in case of error make sure the newest upload files are removed from the upload input
1483
-				            GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1484
-				        }
1482
+							// in case of error make sure the newest upload files are removed from the upload input
1483
+							GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1484
+						}
1485 1485
 
1486
-				    }
1486
+					}
1487 1487
 
1488 1488
 
1489
-				    break;
1489
+					break;
1490 1490
 
1491 1491
 			}
1492 1492
 
@@ -1497,47 +1497,47 @@  discard block
 block discarded – undo
1497 1497
 
1498 1498
 				switch ( $field_type ) {
1499 1499
 
1500
-				    // Captchas don't need to be re-entered.
1501
-				    case 'captcha':
1500
+					// Captchas don't need to be re-entered.
1501
+					case 'captcha':
1502 1502
 
1503
-				        // Post Image fields aren't editable, so we un-fail them.
1504
-				    case 'post_image':
1505
-				        $field->failed_validation = false;
1506
-				        unset( $field->validation_message );
1507
-				        break;
1503
+						// Post Image fields aren't editable, so we un-fail them.
1504
+					case 'post_image':
1505
+						$field->failed_validation = false;
1506
+						unset( $field->validation_message );
1507
+						break;
1508 1508
 
1509 1509
 				}
1510 1510
 
1511 1511
 				// You can't continue inside a switch, so we do it after.
1512 1512
 				if( empty( $field->failed_validation ) ) {
1513
-				    continue;
1513
+					continue;
1514 1514
 				}
1515 1515
 
1516 1516
 				// checks if the No Duplicates option is not validating entry against itself, since
1517 1517
 				// we're editing a stored entry, it would also assume it's a duplicate.
1518 1518
 				if( !empty( $field->noDuplicates ) ) {
1519 1519
 
1520
-				    $entry = $this->get_entry();
1520
+					$entry = $this->get_entry();
1521 1521
 
1522
-				    // If the value of the entry is the same as the stored value
1523
-				    // Then we can assume it's not a duplicate, it's the same.
1524
-				    if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1525
-				        //if value submitted was not changed, then don't validate
1526
-				        $field->failed_validation = false;
1522
+					// If the value of the entry is the same as the stored value
1523
+					// Then we can assume it's not a duplicate, it's the same.
1524
+					if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1525
+						//if value submitted was not changed, then don't validate
1526
+						$field->failed_validation = false;
1527 1527
 
1528
-				        unset( $field->validation_message );
1528
+						unset( $field->validation_message );
1529 1529
 
1530
-				        gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', array( 'data' => $entry ) );
1530
+						gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', array( 'data' => $entry ) );
1531 1531
 
1532
-				        continue;
1533
-				    }
1532
+						continue;
1533
+					}
1534 1534
 				}
1535 1535
 
1536 1536
 				// if here then probably we are facing the validation 'At least one field must be filled out'
1537 1537
 				if( GFFormDisplay::is_empty( $field, $this->form_id  ) && empty( $field->isRequired ) ) {
1538
-				    unset( $field->validation_message );
1539
-	                $field->validation_message = false;
1540
-				    continue;
1538
+					unset( $field->validation_message );
1539
+					$field->validation_message = false;
1540
+					continue;
1541 1541
 				}
1542 1542
 
1543 1543
 				$gv_valid = false;
@@ -1601,8 +1601,8 @@  discard block
 block discarded – undo
1601 1601
 		// Hide fields depending on admin settings
1602 1602
 		$fields = $this->filter_fields( $form['fields'], $edit_fields );
1603 1603
 
1604
-	    // If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1605
-	    $fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
1604
+		// If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1605
+		$fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
1606 1606
 
1607 1607
 		/**
1608 1608
 		 * @filter `gravityview/edit_entry/form_fields` Modify the fields displayed in Edit Entry form
@@ -1662,11 +1662,11 @@  discard block
 block discarded – undo
1662 1662
 		// The edit tab has been configured, so we loop through to configured settings
1663 1663
 		foreach ( $configured_fields as $configured_field ) {
1664 1664
 
1665
-	        /** @var GF_Field $field */
1666
-	        foreach ( $fields as $field ) {
1665
+			/** @var GF_Field $field */
1666
+			foreach ( $fields as $field ) {
1667 1667
 				if( intval( $configured_field['id'] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1668
-				    $edit_fields[] = $this->merge_field_properties( $field, $configured_field );
1669
-				    break;
1668
+					$edit_fields[] = $this->merge_field_properties( $field, $configured_field );
1669
+					break;
1670 1670
 				}
1671 1671
 
1672 1672
 			}
@@ -1722,28 +1722,28 @@  discard block
 block discarded – undo
1722 1722
 	 */
1723 1723
 	private function filter_admin_only_fields( $fields = array(), $edit_fields = null, $form = array(), $view_id = 0 ) {
1724 1724
 
1725
-	    /**
1725
+		/**
1726 1726
 		 * @filter `gravityview/edit_entry/use_gf_admin_only_setting` When Edit tab isn't configured, should the Gravity Forms "Admin Only" field settings be used to control field display to non-admins? Default: true
1727
-	     * If the Edit Entry tab is not configured, adminOnly fields will not be shown to non-administrators.
1728
-	     * If the Edit Entry tab *is* configured, adminOnly fields will be shown to non-administrators, using the configured GV permissions
1729
-	     * @since 1.9.1
1730
-	     * @param boolean $use_gf_adminonly_setting True: Hide field if set to Admin Only in GF and the user is not an admin. False: show field based on GV permissions, ignoring GF permissions.
1731
-	     * @param array $form GF Form array
1732
-	     * @param int $view_id View ID
1733
-	     */
1734
-	    $use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
1735
-
1736
-	    if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
1727
+		 * If the Edit Entry tab is not configured, adminOnly fields will not be shown to non-administrators.
1728
+		 * If the Edit Entry tab *is* configured, adminOnly fields will be shown to non-administrators, using the configured GV permissions
1729
+		 * @since 1.9.1
1730
+		 * @param boolean $use_gf_adminonly_setting True: Hide field if set to Admin Only in GF and the user is not an admin. False: show field based on GV permissions, ignoring GF permissions.
1731
+		 * @param array $form GF Form array
1732
+		 * @param int $view_id View ID
1733
+		 */
1734
+		$use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
1735
+
1736
+		if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
1737 1737
 			foreach( $fields as $k => $field ) {
1738 1738
 				if( $field->adminOnly ) {
1739
-				    unset( $fields[ $k ] );
1739
+					unset( $fields[ $k ] );
1740 1740
 				}
1741 1741
 			}
1742 1742
 			return array_values( $fields );
1743 1743
 		}
1744 1744
 
1745
-	    foreach( $fields as &$field ) {
1746
-		    $field->adminOnly = false;
1745
+		foreach( $fields as &$field ) {
1746
+			$field->adminOnly = false;
1747 1747
 		}
1748 1748
 
1749 1749
 		return $fields;
@@ -1763,13 +1763,13 @@  discard block
 block discarded – undo
1763 1763
 	 */
1764 1764
 	private function unselect_default_values( $form ) {
1765 1765
 
1766
-	    foreach ( $form['fields'] as &$field ) {
1766
+		foreach ( $form['fields'] as &$field ) {
1767 1767
 
1768 1768
 			if ( empty( $field->choices ) ) {
1769
-                continue;
1769
+				continue;
1770 1770
 			}
1771 1771
 
1772
-            foreach ( $field->choices as &$choice ) {
1772
+			foreach ( $field->choices as &$choice ) {
1773 1773
 				if ( \GV\Utils::get( $choice, 'isSelected' ) ) {
1774 1774
 					$choice['isSelected'] = false;
1775 1775
 				}
@@ -1806,36 +1806,36 @@  discard block
 block discarded – undo
1806 1806
 
1807 1807
 			if( 'checkbox' === $field->type ) {
1808 1808
 				foreach ( $field->get_entry_inputs() as $key => $input ) {
1809
-				    $input_id = $input['id'];
1810
-				    $choice = $field->choices[ $key ];
1811
-				    $value = \GV\Utils::get( $this->entry, $input_id );
1812
-				    $match = RGFormsModel::choice_value_match( $field, $choice, $value );
1813
-				    if( $match ) {
1814
-				        $field->choices[ $key ]['isSelected'] = true;
1815
-				    }
1809
+					$input_id = $input['id'];
1810
+					$choice = $field->choices[ $key ];
1811
+					$value = \GV\Utils::get( $this->entry, $input_id );
1812
+					$match = RGFormsModel::choice_value_match( $field, $choice, $value );
1813
+					if( $match ) {
1814
+						$field->choices[ $key ]['isSelected'] = true;
1815
+					}
1816 1816
 				}
1817 1817
 			} else {
1818 1818
 
1819 1819
 				// We need to run through each field to set the default values
1820 1820
 				foreach ( $this->entry as $field_id => $field_value ) {
1821 1821
 
1822
-				    if( floatval( $field_id ) === floatval( $field->id ) ) {
1822
+					if( floatval( $field_id ) === floatval( $field->id ) ) {
1823 1823
 
1824
-				        if( 'list' === $field->type ) {
1825
-				            $list_rows = maybe_unserialize( $field_value );
1824
+						if( 'list' === $field->type ) {
1825
+							$list_rows = maybe_unserialize( $field_value );
1826 1826
 
1827
-				            $list_field_value = array();
1828
-				            foreach ( (array) $list_rows as $row ) {
1829
-				                foreach ( (array) $row as $column ) {
1830
-				                    $list_field_value[] = $column;
1831
-				                }
1832
-				            }
1827
+							$list_field_value = array();
1828
+							foreach ( (array) $list_rows as $row ) {
1829
+								foreach ( (array) $row as $column ) {
1830
+									$list_field_value[] = $column;
1831
+								}
1832
+							}
1833 1833
 
1834
-				            $field->defaultValue = serialize( $list_field_value );
1835
-				        } else {
1836
-				            $field->defaultValue = $field_value;
1837
-				        }
1838
-				    }
1834
+							$field->defaultValue = serialize( $list_field_value );
1835
+						} else {
1836
+							$field->defaultValue = $field_value;
1837
+						}
1838
+					}
1839 1839
 				}
1840 1840
 			}
1841 1841
 		}
@@ -1892,7 +1892,7 @@  discard block
 block discarded – undo
1892 1892
 			return $has_conditional_logic;
1893 1893
 		}
1894 1894
 
1895
-	    /** @see GravityView_Edit_Entry_Render::filter_conditional_logic for filter documentation */
1895
+		/** @see GravityView_Edit_Entry_Render::filter_conditional_logic for filter documentation */
1896 1896
 		return apply_filters( 'gravityview/edit_entry/conditional_logic', $has_conditional_logic, $form );
1897 1897
 	}
1898 1898
 
@@ -1959,14 +1959,14 @@  discard block
 block discarded – undo
1959 1959
 
1960 1960
 		if( $echo && $error !== true ) {
1961 1961
 
1962
-	        $error = esc_html( $error );
1962
+			$error = esc_html( $error );
1963 1963
 
1964
-	        /**
1965
-	         * @since 1.9
1966
-	         */
1967
-	        if ( ! empty( $this->entry ) ) {
1968
-		        $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;" ) );
1969
-	        }
1964
+			/**
1965
+			 * @since 1.9
1966
+			 */
1967
+			if ( ! empty( $this->entry ) ) {
1968
+				$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;" ) );
1969
+			}
1970 1970
 
1971 1971
 			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error');
1972 1972
 		}
Please login to merge, or discard this patch.
Spacing   +203 added lines, -203 removed lines patch added patch discarded remove patch
@@ -115,16 +115,16 @@  discard block
 block discarded – undo
115 115
 	function load() {
116 116
 
117 117
 		/** @define "GRAVITYVIEW_DIR" "../../../" */
118
-		include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' );
118
+		include_once( GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php' );
119 119
 
120 120
 		// Don't display an embedded form when editing an entry
121 121
 		add_action( 'wp_head', array( $this, 'prevent_render_form' ) );
122 122
 		add_action( 'wp_footer', array( $this, 'prevent_render_form' ) );
123 123
 
124 124
 		// Stop Gravity Forms processing what is ours!
125
-		add_filter( 'wp', array( $this, 'prevent_maybe_process_form'), 8 );
125
+		add_filter( 'wp', array( $this, 'prevent_maybe_process_form' ), 8 );
126 126
 
127
-		add_filter( 'gravityview_is_edit_entry', array( $this, 'is_edit_entry') );
127
+		add_filter( 'gravityview_is_edit_entry', array( $this, 'is_edit_entry' ) );
128 128
 
129 129
 		add_action( 'gravityview_edit_entry', array( $this, 'init' ) );
130 130
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 		add_filter( 'gform_plupload_settings', array( $this, 'modify_fileupload_settings' ), 10, 3 );
136 136
 
137 137
 		// Add fields expected by GFFormDisplay::validate()
138
-		add_filter( 'gform_pre_validation', array( $this, 'gform_pre_validation') );
138
+		add_filter( 'gform_pre_validation', array( $this, 'gform_pre_validation' ) );
139 139
 
140 140
 		// Fix multiselect value for GF 2.2
141 141
 		add_filter( 'gravityview/edit_entry/field_value_multiselect', array( $this, 'fix_multiselect_value_serialization' ), 10, 3 );
@@ -152,8 +152,8 @@  discard block
 block discarded – undo
152 152
 	 * @return void
153 153
 	 */
154 154
 	public function prevent_render_form() {
155
-		if( $this->is_edit_entry() ) {
156
-			if( 'wp_head' === current_filter() ) {
155
+		if ( $this->is_edit_entry() ) {
156
+			if ( 'wp_head' === current_filter() ) {
157 157
 				add_filter( 'gform_shortcode_form', '__return_empty_string' );
158 158
 			} else {
159 159
 				remove_filter( 'gform_shortcode_form', '__return_empty_string' );
@@ -168,13 +168,13 @@  discard block
 block discarded – undo
168 168
 	 */
169 169
 	public function prevent_maybe_process_form() {
170 170
 
171
-		if( ! empty( $_POST ) ) {
171
+		if ( ! empty( $_POST ) ) {
172 172
 	        gravityview()->log->debug( 'GravityView_Edit_Entry[prevent_maybe_process_form] $_POSTed data (sanitized): ', array( 'data' => esc_html( print_r( $_POST, true ) ) ) );
173 173
 		}
174 174
 
175
-		if( $this->is_edit_entry_submission() ) {
176
-			remove_action( 'wp',  array( 'RGForms', 'maybe_process_form'), 9 );
177
-	        remove_action( 'wp',  array( 'GFForms', 'maybe_process_form'), 9 );
175
+		if ( $this->is_edit_entry_submission() ) {
176
+			remove_action( 'wp', array( 'RGForms', 'maybe_process_form' ), 9 );
177
+	        remove_action( 'wp', array( 'GFForms', 'maybe_process_form' ), 9 );
178 178
 		}
179 179
 	}
180 180
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 	 */
185 185
 	public function is_edit_entry() {
186 186
 
187
-		$is_edit_entry = GravityView_frontend::is_single_entry() && ! empty( $_GET['edit'] );
187
+		$is_edit_entry = GravityView_frontend::is_single_entry() && ! empty( $_GET[ 'edit' ] );
188 188
 
189 189
 		return ( $is_edit_entry || $this->is_edit_entry_submission() );
190 190
 	}
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	 * @return boolean
196 196
 	 */
197 197
 	public function is_edit_entry_submission() {
198
-		return !empty( $_POST[ self::$nonce_field ] );
198
+		return ! empty( $_POST[ self::$nonce_field ] );
199 199
 	}
200 200
 
201 201
 	/**
@@ -208,8 +208,8 @@  discard block
 block discarded – undo
208 208
 
209 209
 
210 210
 		$entries = $gravityview_view->getEntries();
211
-	    self::$original_entry = $entries[0];
212
-	    $this->entry = $entries[0];
211
+	    self::$original_entry = $entries[ 0 ];
212
+	    $this->entry = $entries[ 0 ];
213 213
 
214 214
 		self::$original_form = $gravityview_view->getForm();
215 215
 		$this->form = $gravityview_view->getForm();
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 		$this->view_id = $gravityview_view->getViewId();
218 218
 		$this->post_id = \GV\Utils::get( $post, 'ID', null );
219 219
 
220
-		self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry['id'] );
220
+		self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry[ 'id' ] );
221 221
 	}
222 222
 
223 223
 
@@ -268,9 +268,9 @@  discard block
 block discarded – undo
268 268
 	private function print_scripts() {
269 269
 		$gravityview_view = GravityView_View::getInstance();
270 270
 
271
-		wp_register_script( 'gform_gravityforms', GFCommon::get_base_url().'/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) );
271
+		wp_register_script( 'gform_gravityforms', GFCommon::get_base_url() . '/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) );
272 272
 
273
-		GFFormDisplay::enqueue_form_scripts( $gravityview_view->getForm(), false);
273
+		GFFormDisplay::enqueue_form_scripts( $gravityview_view->getForm(), false );
274 274
 
275 275
 		wp_localize_script( 'gravityview-fe-view', 'gvGlobals', array( 'cookiepath' => COOKIEPATH ) );
276 276
 
@@ -286,19 +286,19 @@  discard block
 block discarded – undo
286 286
 	 */
287 287
 	private function process_save( $gv_data ) {
288 288
 
289
-		if ( empty( $_POST ) || ! isset( $_POST['lid'] ) ) {
289
+		if ( empty( $_POST ) || ! isset( $_POST[ 'lid' ] ) ) {
290 290
 			return;
291 291
 		}
292 292
 
293 293
 		// Make sure the entry, view, and form IDs are all correct
294 294
 		$valid = $this->verify_nonce();
295 295
 
296
-		if ( !$valid ) {
296
+		if ( ! $valid ) {
297 297
 			gravityview()->log->error( 'Nonce validation failed.' );
298 298
 			return;
299 299
 		}
300 300
 
301
-		if ( $this->entry['id'] !== $_POST['lid'] ) {
301
+		if ( $this->entry[ 'id' ] !== $_POST[ 'lid' ] ) {
302 302
 			gravityview()->log->error( 'Entry ID did not match posted entry ID.' );
303 303
 			return;
304 304
 		}
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 
310 310
 		$this->validate();
311 311
 
312
-		if( $this->is_valid ) {
312
+		if ( $this->is_valid ) {
313 313
 
314 314
 			gravityview()->log->debug( 'Submission is valid.' );
315 315
 
@@ -321,22 +321,22 @@  discard block
 block discarded – undo
321 321
 			/**
322 322
 			 * @hack to avoid the capability validation of the method save_lead for GF 1.9+
323 323
 			 */
324
-			unset( $_GET['page'] );
324
+			unset( $_GET[ 'page' ] );
325 325
 
326
-			$date_created = $this->entry['date_created'];
326
+			$date_created = $this->entry[ 'date_created' ];
327 327
 
328 328
 			/**
329 329
 			 * @hack to force Gravity Forms to use $read_value_from_post in GFFormsModel::save_lead()
330 330
 			 * @since 1.17.2
331 331
 			 */
332
-			unset( $this->entry['date_created'] );
332
+			unset( $this->entry[ 'date_created' ] );
333 333
 
334 334
 			GFFormsModel::save_lead( $form, $this->entry );
335 335
 
336 336
 	        // Delete the values for hidden inputs
337 337
 	        $this->unset_hidden_field_values();
338 338
 			
339
-			$this->entry['date_created'] = $date_created;
339
+			$this->entry[ 'date_created' ] = $date_created;
340 340
 
341 341
 			// Process calculation fields
342 342
 			$this->update_calculation_fields();
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 			 * @param GravityView_Edit_Entry_Render $this This object
359 359
 			 * @param GravityView_View_Data $gv_data The View data
360 360
 			 */
361
-			do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry['id'], $this, $gv_data );
361
+			do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry[ 'id' ], $this, $gv_data );
362 362
 
363 363
 		} else {
364 364
 			gravityview()->log->error( 'Submission is NOT valid.', array( 'entry' => $this->entry ) );
@@ -386,16 +386,16 @@  discard block
 block discarded – undo
386 386
 		 */
387 387
 		$unset_hidden_field_values = apply_filters( 'gravityview/edit_entry/unset_hidden_field_values', true, $this );
388 388
 
389
-		if( ! $unset_hidden_field_values ) {
389
+		if ( ! $unset_hidden_field_values ) {
390 390
 			return;
391 391
 		}
392 392
 
393 393
 		if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_meta_table_name' ) ) {
394 394
 			$entry_meta_table = GFFormsModel::get_entry_meta_table_name();
395
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $entry_meta_table WHERE entry_id=%d", $this->entry['id'] ) );
395
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $entry_meta_table WHERE entry_id=%d", $this->entry[ 'id' ] ) );
396 396
 		} else {
397 397
 			$lead_detail_table = GFFormsModel::get_lead_details_table_name();
398
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $lead_detail_table WHERE lead_id=%d", $this->entry['id'] ) );
398
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $lead_detail_table WHERE lead_id=%d", $this->entry[ 'id' ] ) );
399 399
 		}
400 400
 
401 401
 	    foreach ( $this->entry as $input_id => $field_value ) {
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
 
409 409
 				$empty_value = $field->get_value_save_entry(
410 410
 					is_array( $field->get_entry_inputs() ) ? array() : '',
411
-					$this->form, '', $this->entry['id'], $this->entry
411
+					$this->form, '', $this->entry[ 'id' ], $this->entry
412 412
 				);
413 413
 
414 414
 			    $lead_detail_id = GFFormsModel::get_lead_detail_id( $current_fields, $input_id );
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
 		}
479 479
 
480 480
 		/** No file is being uploaded. */
481
-		if ( empty( $_FILES[ $input_name ]['name'] ) ) {
481
+		if ( empty( $_FILES[ $input_name ][ 'name' ] ) ) {
482 482
 			/** So return the original upload */
483 483
 			return $entry[ $input_id ];
484 484
 		}
@@ -496,11 +496,11 @@  discard block
 block discarded – undo
496 496
 	 * @return mixed
497 497
 	 */
498 498
 	public function modify_fileupload_settings( $plupload_init, $form_id, $instance ) {
499
-		if( ! $this->is_edit_entry() ) {
499
+		if ( ! $this->is_edit_entry() ) {
500 500
 			return $plupload_init;
501 501
 		}
502 502
 
503
-		$plupload_init['gf_vars']['max_files'] = 0;
503
+		$plupload_init[ 'gf_vars' ][ 'max_files' ] = 0;
504 504
 
505 505
 		return $plupload_init;
506 506
 	}
@@ -515,27 +515,27 @@  discard block
 block discarded – undo
515 515
 		$form = $this->form;
516 516
 
517 517
 	    /** @var GF_Field $field */
518
-		foreach( $form['fields'] as $k => &$field ) {
518
+		foreach ( $form[ 'fields' ] as $k => &$field ) {
519 519
 
520 520
 			/**
521 521
 			 * Remove the fields with calculation formulas before save to avoid conflicts with GF logic
522 522
 			 * @since 1.16.3
523 523
 			 * @var GF_Field $field
524 524
 			 */
525
-			if( $field->has_calculation() ) {
526
-				unset( $form['fields'][ $k ] );
525
+			if ( $field->has_calculation() ) {
526
+				unset( $form[ 'fields' ][ $k ] );
527 527
 			}
528 528
 
529 529
 			$field->adminOnly = false;
530 530
 
531
-			if( isset( $field->inputs ) && is_array( $field->inputs ) ) {
532
-				foreach( $field->inputs as $key => $input ) {
533
-				    $field->inputs[ $key ][ 'id' ] = (string)$input['id'];
531
+			if ( isset( $field->inputs ) && is_array( $field->inputs ) ) {
532
+				foreach ( $field->inputs as $key => $input ) {
533
+				    $field->inputs[ $key ][ 'id' ] = (string)$input[ 'id' ];
534 534
 				}
535 535
 			}
536 536
 		}
537 537
 
538
-		$form['fields'] = array_values( $form['fields'] );
538
+		$form[ 'fields' ] = array_values( $form[ 'fields' ] );
539 539
 
540 540
 		return $form;
541 541
 	}
@@ -547,14 +547,14 @@  discard block
 block discarded – undo
547 547
 		$update = false;
548 548
 
549 549
 		// get the most up to date entry values
550
-		$entry = GFAPI::get_entry( $this->entry['id'] );
550
+		$entry = GFAPI::get_entry( $this->entry[ 'id' ] );
551 551
 
552 552
 		if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_meta_table_name' ) ) {
553 553
 			$entry_meta_table = GFFormsModel::get_entry_meta_table_name();
554
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $entry_meta_table WHERE entry_id=%d", $entry['id'] ) );
554
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $entry_meta_table WHERE entry_id=%d", $entry[ 'id' ] ) );
555 555
 		} else {
556 556
 			$lead_detail_table = GFFormsModel::get_lead_details_table_name();
557
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $lead_detail_table WHERE lead_id=%d", $entry['id'] ) );
557
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $lead_detail_table WHERE lead_id=%d", $entry[ 'id' ] ) );
558 558
 		}
559 559
 
560 560
 
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
 				$inputs = $field->get_entry_inputs();
565 565
 				if ( is_array( $inputs ) ) {
566 566
 				    foreach ( $inputs as $input ) {
567
-						GFFormsModel::save_input( $form, $field, $entry, $current_fields, $input['id'] );
567
+						GFFormsModel::save_input( $form, $field, $entry, $current_fields, $input[ 'id' ] );
568 568
 				    }
569 569
 				} else {
570 570
 					GFFormsModel::save_input( $form, $field, $entry, $current_fields, $field->id );
@@ -600,19 +600,19 @@  discard block
 block discarded – undo
600 600
 
601 601
 		$input_name = 'input_' . $field_id;
602 602
 
603
-		if ( !empty( $_FILES[ $input_name ]['name'] ) ) {
603
+		if ( ! empty( $_FILES[ $input_name ][ 'name' ] ) ) {
604 604
 
605 605
 			// We have a new image
606 606
 
607
-			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'] );
607
+			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ] );
608 608
 
609 609
 			$ary = ! empty( $value ) ? explode( '|:|', $value ) : array();
610 610
 	        $ary = stripslashes_deep( $ary );
611 611
 			$img_url = \GV\Utils::get( $ary, 0 );
612 612
 
613
-			$img_title       = count( $ary ) > 1 ? $ary[1] : '';
614
-			$img_caption     = count( $ary ) > 2 ? $ary[2] : '';
615
-			$img_description = count( $ary ) > 3 ? $ary[3] : '';
613
+			$img_title       = count( $ary ) > 1 ? $ary[ 1 ] : '';
614
+			$img_caption     = count( $ary ) > 2 ? $ary[ 2 ] : '';
615
+			$img_description = count( $ary ) > 3 ? $ary[ 3 ] : '';
616 616
 
617 617
 			$image_meta = array(
618 618
 				'post_excerpt' => $img_caption,
@@ -621,7 +621,7 @@  discard block
 block discarded – undo
621 621
 
622 622
 			//adding title only if it is not empty. It will default to the file name if it is not in the array
623 623
 			if ( ! empty( $img_title ) ) {
624
-				$image_meta['post_title'] = $img_title;
624
+				$image_meta[ 'post_title' ] = $img_title;
625 625
 			}
626 626
 
627 627
 			/**
@@ -679,15 +679,15 @@  discard block
 block discarded – undo
679 679
 	 */
680 680
 	private function maybe_update_post_fields( $form ) {
681 681
 
682
-		if( empty( $this->entry['post_id'] ) ) {
682
+		if ( empty( $this->entry[ 'post_id' ] ) ) {
683 683
 	        gravityview()->log->debug( 'This entry has no post fields. Continuing...' );
684 684
 			return;
685 685
 		}
686 686
 
687
-		$post_id = $this->entry['post_id'];
687
+		$post_id = $this->entry[ 'post_id' ];
688 688
 
689 689
 		// Security check
690
-		if( false === GVCommon::has_cap( 'edit_post', $post_id ) ) {
690
+		if ( false === GVCommon::has_cap( 'edit_post', $post_id ) ) {
691 691
 			gravityview()->log->error( 'The current user does not have the ability to edit Post #{post_id}', array( 'post_id' => $post_id ) );
692 692
 			return;
693 693
 		}
@@ -700,25 +700,25 @@  discard block
 block discarded – undo
700 700
 
701 701
 			$field = RGFormsModel::get_field( $form, $field_id );
702 702
 
703
-			if( ! $field ) {
703
+			if ( ! $field ) {
704 704
 				continue;
705 705
 			}
706 706
 
707
-			if( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) {
707
+			if ( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) {
708 708
 
709 709
 				// Get the value of the field, including $_POSTed value
710 710
 				$value = RGFormsModel::get_field_value( $field );
711 711
 
712 712
 				// Use temporary entry variable, to make values available to fill_post_template() and update_post_image()
713 713
 				$entry_tmp = $this->entry;
714
-				$entry_tmp["{$field_id}"] = $value;
714
+				$entry_tmp[ "{$field_id}" ] = $value;
715 715
 
716
-				switch( $field->type ) {
716
+				switch ( $field->type ) {
717 717
 
718 718
 				    case 'post_title':
719 719
 				        $post_title = $value;
720 720
 				        if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) {
721
-				            $post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
721
+				            $post_title = $this->fill_post_template( $form[ 'postTitleTemplate' ], $form, $entry_tmp );
722 722
 				        }
723 723
 				        $updated_post->post_title = $post_title;
724 724
 				        $updated_post->post_name  = $post_title;
@@ -728,7 +728,7 @@  discard block
 block discarded – undo
728 728
 				    case 'post_content':
729 729
 				        $post_content = $value;
730 730
 				        if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) {
731
-				            $post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
731
+				            $post_content = $this->fill_post_template( $form[ 'postContentTemplate' ], $form, $entry_tmp, true );
732 732
 				        }
733 733
 				        $updated_post->post_content = $post_content;
734 734
 				        unset( $post_content );
@@ -746,11 +746,11 @@  discard block
 block discarded – undo
746 746
 							$value = $value[ $field_id ];
747 747
 						}
748 748
 
749
-				        if( ! empty( $field->customFieldTemplateEnabled ) ) {
749
+				        if ( ! empty( $field->customFieldTemplateEnabled ) ) {
750 750
 				            $value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
751 751
 				        }
752 752
 
753
-						$value = $field->get_value_save_entry( $value, $form, '', $this->entry['id'], $this->entry );
753
+						$value = $field->get_value_save_entry( $value, $form, '', $this->entry[ 'id' ], $this->entry );
754 754
 
755 755
 				        update_post_meta( $post_id, $field->postCustomFieldName, $value );
756 756
 				        break;
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
 				}
763 763
 
764 764
 				// update entry after
765
-				$this->entry["{$field_id}"] = $value;
765
+				$this->entry[ "{$field_id}" ] = $value;
766 766
 
767 767
 				$update_entry = true;
768 768
 
@@ -771,11 +771,11 @@  discard block
 block discarded – undo
771 771
 
772 772
 		}
773 773
 
774
-		if( $update_entry ) {
774
+		if ( $update_entry ) {
775 775
 
776 776
 			$return_entry = GFAPI::update_entry( $this->entry );
777 777
 
778
-			if( is_wp_error( $return_entry ) ) {
778
+			if ( is_wp_error( $return_entry ) ) {
779 779
 				gravityview()->log->error( 'Updating the entry post fields failed', array( 'data' => array( '$this->entry' => $this->entry, '$return_entry' => $return_entry ) ) );
780 780
 			} else {
781 781
 				gravityview()->log->debug( 'Updating the entry post fields for post #{post_id} succeeded', array( 'post_id' => $post_id ) );
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
 
786 786
 		$return_post = wp_update_post( $updated_post, true );
787 787
 
788
-		if( is_wp_error( $return_post ) ) {
788
+		if ( is_wp_error( $return_post ) ) {
789 789
 			$return_post->add_data( $updated_post, '$updated_post' );
790 790
 			gravityview()->log->error( 'Updating the post content failed', array( 'data' => compact( 'updated_post', 'return_post' ) ) );
791 791
 		} else {
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
 		$output = GFCommon::replace_variables( $output, $form, $entry, false, false, false );
820 820
 
821 821
 		// replace conditional shortcodes
822
-		if( $do_shortcode ) {
822
+		if ( $do_shortcode ) {
823 823
 			$output = do_shortcode( $output );
824 824
 		}
825 825
 
@@ -838,19 +838,19 @@  discard block
 block discarded – undo
838 838
 	 */
839 839
 	private function after_update() {
840 840
 
841
-		do_action( 'gform_after_update_entry', $this->form, $this->entry['id'], self::$original_entry );
842
-		do_action( "gform_after_update_entry_{$this->form['id']}", $this->form, $this->entry['id'], self::$original_entry );
841
+		do_action( 'gform_after_update_entry', $this->form, $this->entry[ 'id' ], self::$original_entry );
842
+		do_action( "gform_after_update_entry_{$this->form[ 'id' ]}", $this->form, $this->entry[ 'id' ], self::$original_entry );
843 843
 
844 844
 		// Re-define the entry now that we've updated it.
845
-		$entry = RGFormsModel::get_lead( $this->entry['id'] );
845
+		$entry = RGFormsModel::get_lead( $this->entry[ 'id' ] );
846 846
 
847 847
 		$entry = GFFormsModel::set_entry_meta( $entry, self::$original_form );
848 848
 
849 849
 		if ( version_compare( GFFormsModel::get_database_version(), '2.3-dev-1', '<' ) ) {
850 850
 			// We need to clear the cache because Gravity Forms caches the field values, which
851 851
 			// we have just updated.
852
-			foreach ($this->form['fields'] as $key => $field) {
853
-				GFFormsModel::refresh_lead_field_value( $entry['id'], $field->id );
852
+			foreach ( $this->form[ 'fields' ] as $key => $field ) {
853
+				GFFormsModel::refresh_lead_field_value( $entry[ 'id' ], $field->id );
854 854
 			}
855 855
 		}
856 856
 
@@ -869,7 +869,7 @@  discard block
 block discarded – undo
869 869
 
870 870
 		<div class="gv-edit-entry-wrapper"><?php
871 871
 
872
-			$javascript = gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/inline-javascript.php', $this );
872
+			$javascript = gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/inline-javascript.php', $this );
873 873
 
874 874
 			/**
875 875
 			 * Fixes weird wpautop() issue
@@ -885,7 +885,7 @@  discard block
 block discarded – undo
885 885
 				     * @param string $edit_entry_title Modify the "Edit Entry" title
886 886
 				     * @param GravityView_Edit_Entry_Render $this This object
887 887
 				     */
888
-				    $edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
888
+				    $edit_entry_title = apply_filters( 'gravityview_edit_entry_title', __( 'Edit Entry', 'gravityview' ), $this );
889 889
 
890 890
 				    echo esc_attr( $edit_entry_title );
891 891
 			?></span>
@@ -935,13 +935,13 @@  discard block
 block discarded – undo
935 935
 
936 936
 			$back_link = remove_query_arg( array( 'page', 'view', 'edit' ) );
937 937
 
938
-			if( ! $this->is_valid ){
938
+			if ( ! $this->is_valid ) {
939 939
 
940 940
 				// Keeping this compatible with Gravity Forms.
941
-				$validation_message = "<div class='validation_error'>" . __('There was a problem with your submission.', 'gravityview') . " " . __('Errors have been highlighted below.', 'gravityview') . "</div>";
942
-				$message = apply_filters("gform_validation_message_{$this->form['id']}", apply_filters("gform_validation_message", $validation_message, $this->form), $this->form);
941
+				$validation_message = "<div class='validation_error'>" . __( 'There was a problem with your submission.', 'gravityview' ) . " " . __( 'Errors have been highlighted below.', 'gravityview' ) . "</div>";
942
+				$message = apply_filters( "gform_validation_message_{$this->form[ 'id' ]}", apply_filters( "gform_validation_message", $validation_message, $this->form ), $this->form );
943 943
 
944
-				echo GVCommon::generate_notice( $message , 'gv-error' );
944
+				echo GVCommon::generate_notice( $message, 'gv-error' );
945 945
 
946 946
 			} else {
947 947
 				$view = \GV\View::by_id( $this->view_id );
@@ -952,23 +952,23 @@  discard block
 block discarded – undo
952 952
 
953 953
                     case '0':
954 954
 	                    $redirect_url = $back_link;
955
-	                    $entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sReturning to Entry%s', 'Replacements are HTML', 'gravityview'), '<a href="'. esc_url( $redirect_url ) .'">', '</a>' );
955
+	                    $entry_updated_message = sprintf( esc_attr_x( 'Entry Updated. %sReturning to Entry%s', 'Replacements are HTML', 'gravityview' ), '<a href="' . esc_url( $redirect_url ) . '">', '</a>' );
956 956
                         break;
957 957
 
958 958
                     case '1':
959 959
 	                    $redirect_url = $directory_link = GravityView_API::directory_link();
960
-	                    $entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sReturning to %s%s', 'Replacement 1 is HTML. Replacement 2 is the title of the page where the user will be taken. Replacement 3 is HTML.','gravityview'), '<a href="'. esc_url( $redirect_url ) . '">', esc_html( $view->post_title ), '</a>' );
960
+	                    $entry_updated_message = sprintf( esc_attr_x( 'Entry Updated. %sReturning to %s%s', 'Replacement 1 is HTML. Replacement 2 is the title of the page where the user will be taken. Replacement 3 is HTML.', 'gravityview' ), '<a href="' . esc_url( $redirect_url ) . '">', esc_html( $view->post_title ), '</a>' );
961 961
 	                    break;
962 962
 
963 963
                     case '2':
964 964
 	                    $redirect_url = $edit_redirect_url;
965 965
 	                    $redirect_url = GFCommon::replace_variables( $redirect_url, $this->form, $this->entry, false, false, false, 'text' );
966
-	                    $entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sRedirecting to %s%s', 'Replacement 1 is HTML. Replacement 2 is the URL where the user will be taken. Replacement 3 is HTML.','gravityview'), '<a href="'. esc_url( $redirect_url ) . '">', esc_html( $edit_redirect_url ), '</a>' );
966
+	                    $entry_updated_message = sprintf( esc_attr_x( 'Entry Updated. %sRedirecting to %s%s', 'Replacement 1 is HTML. Replacement 2 is the URL where the user will be taken. Replacement 3 is HTML.', 'gravityview' ), '<a href="' . esc_url( $redirect_url ) . '">', esc_html( $edit_redirect_url ), '</a>' );
967 967
                         break;
968 968
 
969 969
                     case '':
970 970
                     default:
971
-					    $entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturn to Entry%s', 'gravityview'), '<a href="'. esc_url( $back_link ) .'">', '</a>' );
971
+					    $entry_updated_message = sprintf( esc_attr__( 'Entry Updated. %sReturn to Entry%s', 'gravityview' ), '<a href="' . esc_url( $back_link ) . '">', '</a>' );
972 972
                         break;
973 973
 				}
974 974
 
@@ -984,7 +984,7 @@  discard block
 block discarded – undo
984 984
 				 * @param array $entry Gravity Forms entry array
985 985
 				 * @param string $back_link URL to return to the original entry. @since 1.6
986 986
 				 */
987
-				$message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message , $this->view_id, $this->entry, $back_link );
987
+				$message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message, $this->view_id, $this->entry, $back_link );
988 988
 
989 989
 				echo GVCommon::generate_notice( $message );
990 990
 			}
@@ -1008,21 +1008,21 @@  discard block
 block discarded – undo
1008 1008
 		 */
1009 1009
 		do_action( 'gravityview/edit-entry/render/before', $this );
1010 1010
 
1011
-		add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields'), 5000, 3 );
1012
-		add_filter( 'gform_submit_button', array( $this, 'render_form_buttons') );
1011
+		add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000, 3 );
1012
+		add_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) );
1013 1013
 		add_filter( 'gform_disable_view_counter', '__return_true' );
1014 1014
 
1015 1015
 		add_filter( 'gform_field_input', array( $this, 'verify_user_can_edit_post' ), 5, 5 );
1016 1016
 		add_filter( 'gform_field_input', array( $this, 'modify_edit_field_input' ), 10, 5 );
1017 1017
 
1018 1018
 		// We need to remove the fake $_GET['page'] arg to avoid rendering form as if in admin.
1019
-		unset( $_GET['page'] );
1019
+		unset( $_GET[ 'page' ] );
1020 1020
 
1021 1021
 		// TODO: Verify multiple-page forms
1022 1022
 
1023 1023
 		ob_start(); // Prevent PHP warnings possibly caused by prefilling list fields for conditional logic
1024 1024
 
1025
-		$html = GFFormDisplay::get_form( $this->form['id'], false, false, true, $this->entry );
1025
+		$html = GFFormDisplay::get_form( $this->form[ 'id' ], false, false, true, $this->entry );
1026 1026
 
1027 1027
 		ob_get_clean();
1028 1028
 
@@ -1048,7 +1048,7 @@  discard block
 block discarded – undo
1048 1048
 	 * @return string
1049 1049
 	 */
1050 1050
 	public function render_form_buttons() {
1051
-		return gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/form-buttons.php', $this );
1051
+		return gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/form-buttons.php', $this );
1052 1052
 	}
1053 1053
 
1054 1054
 
@@ -1068,10 +1068,10 @@  discard block
 block discarded – undo
1068 1068
 	public function filter_modify_form_fields( $form, $ajax = false, $field_values = '' ) {
1069 1069
 
1070 1070
 		// In case we have validated the form, use it to inject the validation results into the form render
1071
-		if( isset( $this->form_after_validation ) ) {
1071
+		if ( isset( $this->form_after_validation ) ) {
1072 1072
 			$form = $this->form_after_validation;
1073 1073
 		} else {
1074
-			$form['fields'] = $this->get_configured_edit_fields( $form, $this->view_id );
1074
+			$form[ 'fields' ] = $this->get_configured_edit_fields( $form, $this->view_id );
1075 1075
 		}
1076 1076
 
1077 1077
 		$form = $this->filter_conditional_logic( $form );
@@ -1079,8 +1079,8 @@  discard block
 block discarded – undo
1079 1079
 		$form = $this->prefill_conditional_logic( $form );
1080 1080
 
1081 1081
 		// for now we don't support Save and Continue feature.
1082
-		if( ! self::$supports_save_and_continue ) {
1083
-	        unset( $form['save'] );
1082
+		if ( ! self::$supports_save_and_continue ) {
1083
+	        unset( $form[ 'save' ] );
1084 1084
 		}
1085 1085
 
1086 1086
 		$form = $this->unselect_default_values( $form );
@@ -1103,31 +1103,31 @@  discard block
 block discarded – undo
1103 1103
 	 */
1104 1104
 	public function verify_user_can_edit_post( $field_content = '', $field, $value, $lead_id = 0, $form_id ) {
1105 1105
 
1106
-		if( ! GFCommon::is_post_field( $field ) ) {
1106
+		if ( ! GFCommon::is_post_field( $field ) ) {
1107 1107
 			return $field_content;
1108 1108
 		}
1109 1109
 
1110 1110
         $message = null;
1111 1111
 
1112 1112
         // First, make sure they have the capability to edit the post.
1113
-        if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) {
1113
+        if ( false === current_user_can( 'edit_post', $this->entry[ 'post_id' ] ) ) {
1114 1114
 
1115 1115
             /**
1116 1116
              * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post
1117 1117
              * @param string $message The existing "You don't have permission..." text
1118 1118
              */
1119
-            $message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don&rsquo;t have permission to edit this post.', 'gravityview') );
1119
+            $message = apply_filters( 'gravityview/edit_entry/unsupported_post_field_text', __( 'You don&rsquo;t have permission to edit this post.', 'gravityview' ) );
1120 1120
 
1121
-        } elseif( null === get_post( $this->entry['post_id'] ) ) {
1121
+        } elseif ( null === get_post( $this->entry[ 'post_id' ] ) ) {
1122 1122
             /**
1123 1123
              * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists
1124 1124
              * @param string $message The existing "This field is not editable; the post no longer exists." text
1125 1125
              */
1126
-            $message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) );
1126
+            $message = apply_filters( 'gravityview/edit_entry/no_post_text', __( 'This field is not editable; the post no longer exists.', 'gravityview' ) );
1127 1127
         }
1128 1128
 
1129
-        if( $message ) {
1130
-            $field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1129
+        if ( $message ) {
1130
+            $field_content = sprintf( '<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1131 1131
         }
1132 1132
 
1133 1133
         return $field_content;
@@ -1151,8 +1151,8 @@  discard block
 block discarded – undo
1151 1151
 
1152 1152
 		// If the form has been submitted, then we don't need to pre-fill the values,
1153 1153
 		// Except for fileupload type and when a field input is overridden- run always!!
1154
-		if(
1155
-			( $this->is_edit_entry_submission() && !in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
1154
+		if (
1155
+			( $this->is_edit_entry_submission() && ! in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
1156 1156
 			&& false === ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) )
1157 1157
 			&& ! GFCommon::is_product_field( $field->type )
1158 1158
 			|| ! empty( $field_content )
@@ -1172,7 +1172,7 @@  discard block
 block discarded – undo
1172 1172
 	    $return = null;
1173 1173
 
1174 1174
 		/** @var GravityView_Field $gv_field */
1175
-		if( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1175
+		if ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1176 1176
 			$return = $gv_field->get_field_input( $this->form, $field_value, $this->entry, $field );
1177 1177
 		} else {
1178 1178
 	        $return = $field->get_field_input( $this->form, $field_value, $this->entry );
@@ -1181,7 +1181,7 @@  discard block
 block discarded – undo
1181 1181
 	    // If there was output, it's an error
1182 1182
 	    $warnings = ob_get_clean();
1183 1183
 
1184
-	    if( !empty( $warnings ) ) {
1184
+	    if ( ! empty( $warnings ) ) {
1185 1185
 		    gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1186 1186
 	    }
1187 1187
 
@@ -1206,7 +1206,7 @@  discard block
 block discarded – undo
1206 1206
 		$override_saved_value = apply_filters( 'gravityview/edit_entry/pre_populate/override', false, $field );
1207 1207
 
1208 1208
 		// We're dealing with multiple inputs (e.g. checkbox) but not time or date (as it doesn't store data in input IDs)
1209
-		if( isset( $field->inputs ) && is_array( $field->inputs ) && !in_array( $field->type, array( 'time', 'date' ) ) ) {
1209
+		if ( isset( $field->inputs ) && is_array( $field->inputs ) && ! in_array( $field->type, array( 'time', 'date' ) ) ) {
1210 1210
 
1211 1211
 			$field_value = array();
1212 1212
 
@@ -1215,10 +1215,10 @@  discard block
 block discarded – undo
1215 1215
 
1216 1216
 			foreach ( (array)$field->inputs as $input ) {
1217 1217
 
1218
-				$input_id = strval( $input['id'] );
1218
+				$input_id = strval( $input[ 'id' ] );
1219 1219
 
1220 1220
 				if ( isset( $this->entry[ $input_id ] ) && ! gv_empty( $this->entry[ $input_id ], false, false ) ) {
1221
-				    $field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1221
+				    $field_value[ $input_id ] = 'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1222 1222
 				    $allow_pre_populated = false;
1223 1223
 				}
1224 1224
 
@@ -1226,7 +1226,7 @@  discard block
 block discarded – undo
1226 1226
 
1227 1227
 			$pre_value = $field->get_value_submission( array(), false );
1228 1228
 
1229
-			$field_value = ! $allow_pre_populated && ! ( $override_saved_value && !gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
1229
+			$field_value = ! $allow_pre_populated && ! ( $override_saved_value && ! gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
1230 1230
 
1231 1231
 		} else {
1232 1232
 
@@ -1237,13 +1237,13 @@  discard block
 block discarded – undo
1237 1237
 
1238 1238
 			// saved field entry value (if empty, fallback to the pre-populated value, if exists)
1239 1239
 			// or pre-populated value if not empty and set to override saved value
1240
-			$field_value = isset( $this->entry[ $id ] ) && ! gv_empty( $this->entry[ $id ], false, false ) && ! ( $override_saved_value && !gv_empty( $pre_value, false, false ) ) ? $this->entry[ $id ] : $pre_value;
1240
+			$field_value = isset( $this->entry[ $id ] ) && ! gv_empty( $this->entry[ $id ], false, false ) && ! ( $override_saved_value && ! gv_empty( $pre_value, false, false ) ) ? $this->entry[ $id ] : $pre_value;
1241 1241
 
1242 1242
 			// in case field is post_category but inputType is select, multi-select or radio, convert value into array of category IDs.
1243
-			if ( 'post_category' === $field->type && !gv_empty( $field_value, false, false ) ) {
1243
+			if ( 'post_category' === $field->type && ! gv_empty( $field_value, false, false ) ) {
1244 1244
 				$categories = array();
1245 1245
 				foreach ( explode( ',', $field_value ) as $cat_string ) {
1246
-				    $categories[] = GFCommon::format_post_category( $cat_string, true );
1246
+				    $categories[ ] = GFCommon::format_post_category( $cat_string, true );
1247 1247
 				}
1248 1248
 				$field_value = 'multiselect' === $field->get_input_type() ? $categories : implode( '', $categories );
1249 1249
 			}
@@ -1271,7 +1271,7 @@  discard block
 block discarded – undo
1271 1271
 	     * @param GF_Field $field Gravity Forms field object
1272 1272
 	     * @param GravityView_Edit_Entry_Render $this Current object
1273 1273
 	     */
1274
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1274
+	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type, $field_value, $field, $this );
1275 1275
 
1276 1276
 		return $field_value;
1277 1277
 	}
@@ -1288,12 +1288,12 @@  discard block
 block discarded – undo
1288 1288
 	 */
1289 1289
 	public function gform_pre_validation( $form ) {
1290 1290
 
1291
-		if( ! $this->verify_nonce() ) {
1291
+		if ( ! $this->verify_nonce() ) {
1292 1292
 			return $form;
1293 1293
 		}
1294 1294
 
1295 1295
 		// Fix PHP warning regarding undefined index.
1296
-		foreach ( $form['fields'] as &$field) {
1296
+		foreach ( $form[ 'fields' ] as &$field ) {
1297 1297
 
1298 1298
 			// This is because we're doing admin form pretending to be front-end, so Gravity Forms
1299 1299
 			// expects certain field array items to be set.
@@ -1301,7 +1301,7 @@  discard block
 block discarded – undo
1301 1301
 	            $field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1302 1302
 			}
1303 1303
 
1304
-			switch( RGFormsModel::get_input_type( $field ) ) {
1304
+			switch ( RGFormsModel::get_input_type( $field ) ) {
1305 1305
 
1306 1306
 				/**
1307 1307
 				 * 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.
@@ -1315,26 +1315,26 @@  discard block
 block discarded – undo
1315 1315
 				    // Set the previous value
1316 1316
 				    $entry = $this->get_entry();
1317 1317
 
1318
-				    $input_name = 'input_'.$field->id;
1319
-				    $form_id = $form['id'];
1318
+				    $input_name = 'input_' . $field->id;
1319
+				    $form_id = $form[ 'id' ];
1320 1320
 
1321 1321
 				    $value = NULL;
1322 1322
 
1323 1323
 				    // Use the previous entry value as the default.
1324
-				    if( isset( $entry[ $field->id ] ) ) {
1324
+				    if ( isset( $entry[ $field->id ] ) ) {
1325 1325
 				        $value = $entry[ $field->id ];
1326 1326
 				    }
1327 1327
 
1328 1328
 				    // If this is a single upload file
1329
-				    if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1330
-				        $file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1331
-				        $value = $file_path['url'];
1329
+				    if ( ! empty( $_FILES[ $input_name ] ) && ! empty( $_FILES[ $input_name ][ 'name' ] ) ) {
1330
+				        $file_path = GFFormsModel::get_file_upload_path( $form[ 'id' ], $_FILES[ $input_name ][ 'name' ] );
1331
+				        $value = $file_path[ 'url' ];
1332 1332
 
1333 1333
 				    } else {
1334 1334
 
1335 1335
 				        // Fix PHP warning on line 1498 of form_display.php for post_image fields
1336 1336
 				        // Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1337
-				        $_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1337
+				        $_FILES[ $input_name ] = array( 'name' => '', 'size' => '' );
1338 1338
 
1339 1339
 				    }
1340 1340
 
@@ -1342,10 +1342,10 @@  discard block
 block discarded – undo
1342 1342
 
1343 1343
 				        // If there are fresh uploads, process and merge them.
1344 1344
 				        // Otherwise, use the passed values, which should be json-encoded array of URLs
1345
-				        if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) {
1345
+				        if ( isset( GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] ) ) {
1346 1346
 				            $value = empty( $value ) ? '[]' : $value;
1347 1347
 				            $value = stripslashes_deep( $value );
1348
-				            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array());
1348
+				            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ], array() );
1349 1349
 				        }
1350 1350
 
1351 1351
 				    } else {
@@ -1363,8 +1363,8 @@  discard block
 block discarded – undo
1363 1363
 
1364 1364
 				case 'number':
1365 1365
 				    // Fix "undefined index" issue at line 1286 in form_display.php
1366
-				    if( !isset( $_POST['input_'.$field->id ] ) ) {
1367
-				        $_POST['input_'.$field->id ] = NULL;
1366
+				    if ( ! isset( $_POST[ 'input_' . $field->id ] ) ) {
1367
+				        $_POST[ 'input_' . $field->id ] = NULL;
1368 1368
 				    }
1369 1369
 				    break;
1370 1370
 			}
@@ -1401,7 +1401,7 @@  discard block
 block discarded – undo
1401 1401
 		 * You can enter whatever you want!
1402 1402
 		 * We try validating, and customize the results using `self::custom_validation()`
1403 1403
 		 */
1404
-		add_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10, 4);
1404
+		add_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10, 4 );
1405 1405
 
1406 1406
 		// Needed by the validate funtion
1407 1407
 		$failed_validation_page = NULL;
@@ -1409,14 +1409,14 @@  discard block
 block discarded – undo
1409 1409
 
1410 1410
 		// Prevent entry limit from running when editing an entry, also
1411 1411
 		// prevent form scheduling from preventing editing
1412
-		unset( $this->form['limitEntries'], $this->form['scheduleForm'] );
1412
+		unset( $this->form[ 'limitEntries' ], $this->form[ 'scheduleForm' ] );
1413 1413
 
1414 1414
 		// Hide fields depending on Edit Entry settings
1415
-		$this->form['fields'] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1415
+		$this->form[ 'fields' ] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1416 1416
 
1417 1417
 		$this->is_valid = GFFormDisplay::validate( $this->form, $field_values, 1, $failed_validation_page );
1418 1418
 
1419
-		remove_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10 );
1419
+		remove_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10 );
1420 1420
 	}
1421 1421
 
1422 1422
 
@@ -1439,7 +1439,7 @@  discard block
 block discarded – undo
1439 1439
 
1440 1440
 		$gv_valid = true;
1441 1441
 
1442
-		foreach ( $validation_results['form']['fields'] as $key => &$field ) {
1442
+		foreach ( $validation_results[ 'form' ][ 'fields' ] as $key => &$field ) {
1443 1443
 
1444 1444
 			$value = RGFormsModel::get_field_value( $field );
1445 1445
 			$field_type = RGFormsModel::get_input_type( $field );
@@ -1452,35 +1452,35 @@  discard block
 block discarded – undo
1452 1452
 				case 'post_image':
1453 1453
 
1454 1454
 				    // in case nothing is uploaded but there are already files saved
1455
-				    if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) {
1455
+				    if ( ! empty( $field->failed_validation ) && ! empty( $field->isRequired ) && ! empty( $value ) ) {
1456 1456
 				        $field->failed_validation = false;
1457 1457
 				        unset( $field->validation_message );
1458 1458
 				    }
1459 1459
 
1460 1460
 				    // validate if multi file upload reached max number of files [maxFiles] => 2
1461
-				    if( \GV\Utils::get( $field, 'maxFiles') && \GV\Utils::get( $field, 'multipleFiles') ) {
1461
+				    if ( \GV\Utils::get( $field, 'maxFiles' ) && \GV\Utils::get( $field, 'multipleFiles' ) ) {
1462 1462
 
1463 1463
 				        $input_name = 'input_' . $field->id;
1464 1464
 				        //uploaded
1465
-				        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1465
+				        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] : array();
1466 1466
 
1467 1467
 				        //existent
1468 1468
 				        $entry = $this->get_entry();
1469 1469
 				        $value = NULL;
1470
-				        if( isset( $entry[ $field->id ] ) ) {
1470
+				        if ( isset( $entry[ $field->id ] ) ) {
1471 1471
 				            $value = json_decode( $entry[ $field->id ], true );
1472 1472
 				        }
1473 1473
 
1474 1474
 				        // count uploaded files and existent entry files
1475 1475
 				        $count_files = count( $file_names ) + count( $value );
1476 1476
 
1477
-				        if( $count_files > $field->maxFiles ) {
1477
+				        if ( $count_files > $field->maxFiles ) {
1478 1478
 				            $field->validation_message = __( 'Maximum number of files reached', 'gravityview' );
1479 1479
 				            $field->failed_validation = 1;
1480 1480
 				            $gv_valid = false;
1481 1481
 
1482 1482
 				            // in case of error make sure the newest upload files are removed from the upload input
1483
-				            GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1483
+				            GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ] = null;
1484 1484
 				        }
1485 1485
 
1486 1486
 				    }
@@ -1491,7 +1491,7 @@  discard block
 block discarded – undo
1491 1491
 			}
1492 1492
 
1493 1493
 			// This field has failed validation.
1494
-			if( !empty( $field->failed_validation ) ) {
1494
+			if ( ! empty( $field->failed_validation ) ) {
1495 1495
 
1496 1496
 				gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field is invalid.', array( 'data' => array( 'field' => $field, 'value' => $value ) ) );
1497 1497
 
@@ -1509,19 +1509,19 @@  discard block
 block discarded – undo
1509 1509
 				}
1510 1510
 
1511 1511
 				// You can't continue inside a switch, so we do it after.
1512
-				if( empty( $field->failed_validation ) ) {
1512
+				if ( empty( $field->failed_validation ) ) {
1513 1513
 				    continue;
1514 1514
 				}
1515 1515
 
1516 1516
 				// checks if the No Duplicates option is not validating entry against itself, since
1517 1517
 				// we're editing a stored entry, it would also assume it's a duplicate.
1518
-				if( !empty( $field->noDuplicates ) ) {
1518
+				if ( ! empty( $field->noDuplicates ) ) {
1519 1519
 
1520 1520
 				    $entry = $this->get_entry();
1521 1521
 
1522 1522
 				    // If the value of the entry is the same as the stored value
1523 1523
 				    // Then we can assume it's not a duplicate, it's the same.
1524
-				    if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1524
+				    if ( ! empty( $entry ) && $value == $entry[ $field->id ] ) {
1525 1525
 				        //if value submitted was not changed, then don't validate
1526 1526
 				        $field->failed_validation = false;
1527 1527
 
@@ -1534,7 +1534,7 @@  discard block
 block discarded – undo
1534 1534
 				}
1535 1535
 
1536 1536
 				// if here then probably we are facing the validation 'At least one field must be filled out'
1537
-				if( GFFormDisplay::is_empty( $field, $this->form_id  ) && empty( $field->isRequired ) ) {
1537
+				if ( GFFormDisplay::is_empty( $field, $this->form_id ) && empty( $field->isRequired ) ) {
1538 1538
 				    unset( $field->validation_message );
1539 1539
 	                $field->validation_message = false;
1540 1540
 				    continue;
@@ -1546,12 +1546,12 @@  discard block
 block discarded – undo
1546 1546
 
1547 1547
 		}
1548 1548
 
1549
-		$validation_results['is_valid'] = $gv_valid;
1549
+		$validation_results[ 'is_valid' ] = $gv_valid;
1550 1550
 
1551 1551
 		gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Validation results.', array( 'data' => $validation_results ) );
1552 1552
 
1553 1553
 		// We'll need this result when rendering the form ( on GFFormDisplay::get_form )
1554
-		$this->form_after_validation = $validation_results['form'];
1554
+		$this->form_after_validation = $validation_results[ 'form' ];
1555 1555
 
1556 1556
 		return $validation_results;
1557 1557
 	}
@@ -1564,7 +1564,7 @@  discard block
 block discarded – undo
1564 1564
 	 */
1565 1565
 	public function get_entry() {
1566 1566
 
1567
-		if( empty( $this->entry ) ) {
1567
+		if ( empty( $this->entry ) ) {
1568 1568
 			// Get the database value of the entry that's being edited
1569 1569
 			$this->entry = gravityview_get_entry( GravityView_frontend::is_single_entry() );
1570 1570
 		}
@@ -1596,10 +1596,10 @@  discard block
 block discarded – undo
1596 1596
 		}
1597 1597
 
1598 1598
 		// If edit tab not yet configured, show all fields
1599
-		$edit_fields = !empty( $properties['edit_edit-fields'] ) ? $properties['edit_edit-fields'] : NULL;
1599
+		$edit_fields = ! empty( $properties[ 'edit_edit-fields' ] ) ? $properties[ 'edit_edit-fields' ] : NULL;
1600 1600
 
1601 1601
 		// Hide fields depending on admin settings
1602
-		$fields = $this->filter_fields( $form['fields'], $edit_fields );
1602
+		$fields = $this->filter_fields( $form[ 'fields' ], $edit_fields );
1603 1603
 
1604 1604
 	    // If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1605 1605
 	    $fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
@@ -1631,7 +1631,7 @@  discard block
 block discarded – undo
1631 1631
 	 */
1632 1632
 	private function filter_fields( $fields, $configured_fields ) {
1633 1633
 
1634
-		if( empty( $fields ) || !is_array( $fields ) ) {
1634
+		if ( empty( $fields ) || ! is_array( $fields ) ) {
1635 1635
 			return $fields;
1636 1636
 		}
1637 1637
 
@@ -1644,18 +1644,18 @@  discard block
 block discarded – undo
1644 1644
 
1645 1645
 			// Remove the fields that have calculation properties and keep them to be used later
1646 1646
 			// @since 1.16.2
1647
-			if( $field->has_calculation() ) {
1648
-				$this->fields_with_calculation[] = $field;
1647
+			if ( $field->has_calculation() ) {
1648
+				$this->fields_with_calculation[ ] = $field;
1649 1649
 				// don't remove the calculation fields on form render.
1650 1650
 			}
1651 1651
 
1652
-			if( in_array( $field->type, $field_type_blacklist ) ) {
1652
+			if ( in_array( $field->type, $field_type_blacklist ) ) {
1653 1653
 				unset( $fields[ $key ] );
1654 1654
 			}
1655 1655
 		}
1656 1656
 
1657 1657
 		// The Edit tab has not been configured, so we return all fields by default.
1658
-		if( empty( $configured_fields ) ) {
1658
+		if ( empty( $configured_fields ) ) {
1659 1659
 			return array_values( $fields );
1660 1660
 		}
1661 1661
 
@@ -1664,8 +1664,8 @@  discard block
 block discarded – undo
1664 1664
 
1665 1665
 	        /** @var GF_Field $field */
1666 1666
 	        foreach ( $fields as $field ) {
1667
-				if( intval( $configured_field['id'] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1668
-				    $edit_fields[] = $this->merge_field_properties( $field, $configured_field );
1667
+				if ( intval( $configured_field[ 'id' ] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1668
+				    $edit_fields[ ] = $this->merge_field_properties( $field, $configured_field );
1669 1669
 				    break;
1670 1670
 				}
1671 1671
 
@@ -1688,14 +1688,14 @@  discard block
 block discarded – undo
1688 1688
 
1689 1689
 		$return_field = $field;
1690 1690
 
1691
-		if( empty( $field_setting['show_label'] ) ) {
1691
+		if ( empty( $field_setting[ 'show_label' ] ) ) {
1692 1692
 			$return_field->label = '';
1693
-		} elseif ( !empty( $field_setting['custom_label'] ) ) {
1694
-			$return_field->label = $field_setting['custom_label'];
1693
+		} elseif ( ! empty( $field_setting[ 'custom_label' ] ) ) {
1694
+			$return_field->label = $field_setting[ 'custom_label' ];
1695 1695
 		}
1696 1696
 
1697
-		if( !empty( $field_setting['custom_class'] ) ) {
1698
-			$return_field->cssClass .= ' '. gravityview_sanitize_html_class( $field_setting['custom_class'] );
1697
+		if ( ! empty( $field_setting[ 'custom_class' ] ) ) {
1698
+			$return_field->cssClass .= ' ' . gravityview_sanitize_html_class( $field_setting[ 'custom_class' ] );
1699 1699
 		}
1700 1700
 
1701 1701
 		/**
@@ -1733,16 +1733,16 @@  discard block
 block discarded – undo
1733 1733
 	     */
1734 1734
 	    $use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
1735 1735
 
1736
-	    if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
1737
-			foreach( $fields as $k => $field ) {
1738
-				if( $field->adminOnly ) {
1736
+	    if ( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry[ 'id' ] ) ) {
1737
+			foreach ( $fields as $k => $field ) {
1738
+				if ( $field->adminOnly ) {
1739 1739
 				    unset( $fields[ $k ] );
1740 1740
 				}
1741 1741
 			}
1742 1742
 			return array_values( $fields );
1743 1743
 		}
1744 1744
 
1745
-	    foreach( $fields as &$field ) {
1745
+	    foreach ( $fields as &$field ) {
1746 1746
 		    $field->adminOnly = false;
1747 1747
 		}
1748 1748
 
@@ -1763,7 +1763,7 @@  discard block
 block discarded – undo
1763 1763
 	 */
1764 1764
 	private function unselect_default_values( $form ) {
1765 1765
 
1766
-	    foreach ( $form['fields'] as &$field ) {
1766
+	    foreach ( $form[ 'fields' ] as &$field ) {
1767 1767
 
1768 1768
 			if ( empty( $field->choices ) ) {
1769 1769
                 continue;
@@ -1771,7 +1771,7 @@  discard block
 block discarded – undo
1771 1771
 
1772 1772
             foreach ( $field->choices as &$choice ) {
1773 1773
 				if ( \GV\Utils::get( $choice, 'isSelected' ) ) {
1774
-					$choice['isSelected'] = false;
1774
+					$choice[ 'isSelected' ] = false;
1775 1775
 				}
1776 1776
 			}
1777 1777
 		}
@@ -1796,22 +1796,22 @@  discard block
 block discarded – undo
1796 1796
 	 */
1797 1797
 	function prefill_conditional_logic( $form ) {
1798 1798
 
1799
-		if( ! GFFormDisplay::has_conditional_logic( $form ) ) {
1799
+		if ( ! GFFormDisplay::has_conditional_logic( $form ) ) {
1800 1800
 			return $form;
1801 1801
 		}
1802 1802
 
1803 1803
 		// Have Conditional Logic pre-fill fields as if the data were default values
1804 1804
 		/** @var GF_Field $field */
1805
-		foreach ( $form['fields'] as &$field ) {
1805
+		foreach ( $form[ 'fields' ] as &$field ) {
1806 1806
 
1807
-			if( 'checkbox' === $field->type ) {
1807
+			if ( 'checkbox' === $field->type ) {
1808 1808
 				foreach ( $field->get_entry_inputs() as $key => $input ) {
1809
-				    $input_id = $input['id'];
1809
+				    $input_id = $input[ 'id' ];
1810 1810
 				    $choice = $field->choices[ $key ];
1811 1811
 				    $value = \GV\Utils::get( $this->entry, $input_id );
1812 1812
 				    $match = RGFormsModel::choice_value_match( $field, $choice, $value );
1813
-				    if( $match ) {
1814
-				        $field->choices[ $key ]['isSelected'] = true;
1813
+				    if ( $match ) {
1814
+				        $field->choices[ $key ][ 'isSelected' ] = true;
1815 1815
 				    }
1816 1816
 				}
1817 1817
 			} else {
@@ -1819,15 +1819,15 @@  discard block
 block discarded – undo
1819 1819
 				// We need to run through each field to set the default values
1820 1820
 				foreach ( $this->entry as $field_id => $field_value ) {
1821 1821
 
1822
-				    if( floatval( $field_id ) === floatval( $field->id ) ) {
1822
+				    if ( floatval( $field_id ) === floatval( $field->id ) ) {
1823 1823
 
1824
-				        if( 'list' === $field->type ) {
1824
+				        if ( 'list' === $field->type ) {
1825 1825
 				            $list_rows = maybe_unserialize( $field_value );
1826 1826
 
1827 1827
 				            $list_field_value = array();
1828
-				            foreach ( (array) $list_rows as $row ) {
1829
-				                foreach ( (array) $row as $column ) {
1830
-				                    $list_field_value[] = $column;
1828
+				            foreach ( (array)$list_rows as $row ) {
1829
+				                foreach ( (array)$row as $column ) {
1830
+				                    $list_field_value[ ] = $column;
1831 1831
 				                }
1832 1832
 				            }
1833 1833
 
@@ -1862,16 +1862,16 @@  discard block
 block discarded – undo
1862 1862
 		 */
1863 1863
 		$use_conditional_logic = apply_filters( 'gravityview/edit_entry/conditional_logic', true, $form );
1864 1864
 
1865
-		if( $use_conditional_logic ) {
1865
+		if ( $use_conditional_logic ) {
1866 1866
 			return $form;
1867 1867
 		}
1868 1868
 
1869
-		foreach( $form['fields'] as &$field ) {
1869
+		foreach ( $form[ 'fields' ] as &$field ) {
1870 1870
 			/* @var GF_Field $field */
1871 1871
 			$field->conditionalLogic = null;
1872 1872
 		}
1873 1873
 
1874
-		unset( $form['button']['conditionalLogic'] );
1874
+		unset( $form[ 'button' ][ 'conditionalLogic' ] );
1875 1875
 
1876 1876
 		return $form;
1877 1877
 
@@ -1888,7 +1888,7 @@  discard block
 block discarded – undo
1888 1888
 	 */
1889 1889
 	public function manage_conditional_logic( $has_conditional_logic, $form ) {
1890 1890
 
1891
-		if( ! $this->is_edit_entry() ) {
1891
+		if ( ! $this->is_edit_entry() ) {
1892 1892
 			return $has_conditional_logic;
1893 1893
 		}
1894 1894
 
@@ -1920,44 +1920,44 @@  discard block
 block discarded – undo
1920 1920
 		 *  2. There are two entries embedded using oEmbed
1921 1921
 		 *  3. One of the entries has just been saved
1922 1922
 		 */
1923
-		if( !empty( $_POST['lid'] ) && !empty( $_GET['entry'] ) && ( $_POST['lid'] !== $_GET['entry'] ) ) {
1923
+		if ( ! empty( $_POST[ 'lid' ] ) && ! empty( $_GET[ 'entry' ] ) && ( $_POST[ 'lid' ] !== $_GET[ 'entry' ] ) ) {
1924 1924
 
1925 1925
 			$error = true;
1926 1926
 
1927 1927
 		}
1928 1928
 
1929
-		if( !empty( $_GET['entry'] ) && (string)$this->entry['id'] !== $_GET['entry'] ) {
1929
+		if ( ! empty( $_GET[ 'entry' ] ) && (string)$this->entry[ 'id' ] !== $_GET[ 'entry' ] ) {
1930 1930
 
1931 1931
 			$error = true;
1932 1932
 
1933
-		} elseif( ! $this->verify_nonce() ) {
1933
+		} elseif ( ! $this->verify_nonce() ) {
1934 1934
 
1935 1935
 			/**
1936 1936
 			 * If the Entry is embedded, there may be two entries on the same page.
1937 1937
 			 * If that's the case, and one is being edited, the other should fail gracefully and not display an error.
1938 1938
 			 */
1939
-			if( GravityView_oEmbed::getInstance()->get_entry_id() ) {
1939
+			if ( GravityView_oEmbed::getInstance()->get_entry_id() ) {
1940 1940
 				$error = true;
1941 1941
 			} else {
1942
-				$error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview');
1942
+				$error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview' );
1943 1943
 			}
1944 1944
 
1945 1945
 		}
1946 1946
 
1947
-		if( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
1948
-			$error = __( 'You do not have permission to edit this entry.', 'gravityview');
1947
+		if ( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
1948
+			$error = __( 'You do not have permission to edit this entry.', 'gravityview' );
1949 1949
 		}
1950 1950
 
1951
-		if( $this->entry['status'] === 'trash' ) {
1952
-			$error = __('You cannot edit the entry; it is in the trash.', 'gravityview' );
1951
+		if ( $this->entry[ 'status' ] === 'trash' ) {
1952
+			$error = __( 'You cannot edit the entry; it is in the trash.', 'gravityview' );
1953 1953
 		}
1954 1954
 
1955 1955
 		// No errors; everything's fine here!
1956
-		if( empty( $error ) ) {
1956
+		if ( empty( $error ) ) {
1957 1957
 			return true;
1958 1958
 		}
1959 1959
 
1960
-		if( $echo && $error !== true ) {
1960
+		if ( $echo && $error !== true ) {
1961 1961
 
1962 1962
 	        $error = esc_html( $error );
1963 1963
 
@@ -1965,10 +1965,10 @@  discard block
 block discarded – undo
1965 1965
 	         * @since 1.9
1966 1966
 	         */
1967 1967
 	        if ( ! empty( $this->entry ) ) {
1968
-		        $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;" ) );
1968
+		        $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;" ) );
1969 1969
 	        }
1970 1970
 
1971
-			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error');
1971
+			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error' );
1972 1972
 		}
1973 1973
 
1974 1974
 		gravityview()->log->error( '{error}', array( 'error' => $error ) );
@@ -1988,17 +1988,17 @@  discard block
 block discarded – undo
1988 1988
 
1989 1989
 		$error = NULL;
1990 1990
 
1991
-		if( ! $this->check_user_cap_edit_field( $field ) ) {
1992
-			$error = __( 'You do not have permission to edit this field.', 'gravityview');
1991
+		if ( ! $this->check_user_cap_edit_field( $field ) ) {
1992
+			$error = __( 'You do not have permission to edit this field.', 'gravityview' );
1993 1993
 		}
1994 1994
 
1995 1995
 		// No errors; everything's fine here!
1996
-		if( empty( $error ) ) {
1996
+		if ( empty( $error ) ) {
1997 1997
 			return true;
1998 1998
 		}
1999 1999
 
2000
-		if( $echo ) {
2001
-			echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error');
2000
+		if ( $echo ) {
2001
+			echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error' );
2002 2002
 		}
2003 2003
 
2004 2004
 		gravityview()->log->error( '{error}', array( 'error' => $error ) );
@@ -2019,14 +2019,14 @@  discard block
 block discarded – undo
2019 2019
 	private function check_user_cap_edit_field( $field ) {
2020 2020
 
2021 2021
 		// If they can edit any entries (as defined in Gravity Forms), we're good.
2022
-		if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
2022
+		if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
2023 2023
 			return true;
2024 2024
 		}
2025 2025
 
2026
-		$field_cap = isset( $field['allow_edit_cap'] ) ? $field['allow_edit_cap'] : false;
2026
+		$field_cap = isset( $field[ 'allow_edit_cap' ] ) ? $field[ 'allow_edit_cap' ] : false;
2027 2027
 
2028
-		if( $field_cap ) {
2029
-			return GVCommon::has_cap( $field['allow_edit_cap'] );
2028
+		if ( $field_cap ) {
2029
+			return GVCommon::has_cap( $field[ 'allow_edit_cap' ] );
2030 2030
 		}
2031 2031
 
2032 2032
 		return false;
@@ -2040,17 +2040,17 @@  discard block
 block discarded – undo
2040 2040
 	public function verify_nonce() {
2041 2041
 
2042 2042
 		// Verify form submitted for editing single
2043
-		if( $this->is_edit_entry_submission() ) {
2043
+		if ( $this->is_edit_entry_submission() ) {
2044 2044
 			$valid = wp_verify_nonce( $_POST[ self::$nonce_field ], self::$nonce_field );
2045 2045
 		}
2046 2046
 
2047 2047
 		// Verify
2048
-		else if( ! $this->is_edit_entry() ) {
2048
+		else if ( ! $this->is_edit_entry() ) {
2049 2049
 			$valid = false;
2050 2050
 		}
2051 2051
 
2052 2052
 		else {
2053
-			$valid = wp_verify_nonce( $_GET['edit'], self::$nonce_key );
2053
+			$valid = wp_verify_nonce( $_GET[ 'edit' ], self::$nonce_key );
2054 2054
 		}
2055 2055
 
2056 2056
 		/**
Please login to merge, or discard this patch.
includes/class-gravityview-shortcode.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 		gravityview()->log->debug( '$passed_atts: ', array( 'data' => $passed_atts ) );
49 49
 
50 50
 		// Get details about the current View
51
-		if( !empty( $passed_atts['detail'] ) ) {
52
-			return $this->get_view_detail( $passed_atts['detail'] );
51
+		if ( ! empty( $passed_atts[ 'detail' ] ) ) {
52
+			return $this->get_view_detail( $passed_atts[ 'detail' ] );
53 53
 		}
54 54
 
55 55
 		$atts = $this->parse_and_sanitize_atts( $passed_atts );
@@ -85,16 +85,16 @@  discard block
 block discarded – undo
85 85
 		$filtered_atts = shortcode_atts( $supported_atts, $passed_atts, 'gravityview' );
86 86
 
87 87
 		// Only keep the passed attributes after making sure that they're valid pairs
88
-		$filtered_atts = array_intersect_key( (array) $passed_atts, $filtered_atts );
88
+		$filtered_atts = array_intersect_key( (array)$passed_atts, $filtered_atts );
89 89
 
90 90
 		$atts = array();
91 91
 
92
-		foreach( $filtered_atts as $key => $passed_value ) {
92
+		foreach ( $filtered_atts as $key => $passed_value ) {
93 93
 
94 94
 			// Allow using GravityView merge tags in shortcode attributes, like {get} and {created_by}
95 95
 			$passed_value = GravityView_Merge_Tags::replace_variables( $passed_value );
96 96
 
97
-			switch( $defaults[ $key ]['type'] ) {
97
+			switch ( $defaults[ $key ][ 'type' ] ) {
98 98
 
99 99
 				/**
100 100
 				 * Make sure number fields are numeric.
@@ -102,14 +102,14 @@  discard block
 block discarded – undo
102 102
 				 * @see http://php.net/manual/en/function.is-numeric.php#107326
103 103
 				 */
104 104
 				case 'number':
105
-					if( is_numeric( $passed_value ) ) {
105
+					if ( is_numeric( $passed_value ) ) {
106 106
 						$atts[ $key ] = ( $passed_value + 0 );
107 107
 					}
108 108
 					break;
109 109
 
110 110
 				/** @since 2.1 */
111 111
 				case 'operator':
112
-					if( GFFormsModel::is_valid_operator( $passed_value ) ) {
112
+					if ( GFFormsModel::is_valid_operator( $passed_value ) ) {
113 113
 						$atts[ $key ] = $passed_value;
114 114
 					}
115 115
 					break;
@@ -124,8 +124,8 @@  discard block
 block discarded – undo
124 124
 				 */
125 125
 				case 'select':
126 126
 				case 'radio':
127
-					$options = isset( $defaults[ $key ]['choices'] ) ? $defaults[ $key ]['choices'] : $defaults[ $key ]['options'];
128
-					if( in_array( $passed_value, array_keys( $options ) ) ) {
127
+					$options = isset( $defaults[ $key ][ 'choices' ] ) ? $defaults[ $key ][ 'choices' ] : $defaults[ $key ][ 'options' ];
128
+					if ( in_array( $passed_value, array_keys( $options ) ) ) {
129 129
 						$atts[ $key ] = $passed_value;
130 130
 					}
131 131
 					break;
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 		$gravityview_view = GravityView_View::getInstance();
155 155
 		$return = '';
156 156
 
157
-		switch( $detail ) {
157
+		switch ( $detail ) {
158 158
 			case 'total_entries':
159 159
 				$return = number_format_i18n( $gravityview_view->getTotalEntries() );
160 160
 				break;
Please login to merge, or discard this patch.
includes/class-gravityview-extension.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
  */
15 15
 abstract class GravityView_Extension extends \GV\Extension {
16 16
 	public function __construct() {
17
-		if( ! in_array( $this->_author, array( 'GravityView', 'Katz Web Services, Inc.', true ) ) ) {
17
+		if ( ! in_array( $this->_author, array( 'GravityView', 'Katz Web Services, Inc.', true ) ) ) {
18 18
 			gravityview()->log->warning( '\GravityView_Extension is deprecated. Inherit from \GV\Extension instead', array( 'data' => $this ) );
19 19
 		}
20 20
 		parent::__construct();
Please login to merge, or discard this patch.
future/includes/rest/class-gv-rest-views-route.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 			'total' => wp_count_posts( 'gravityview' )->publish,
64 64
 		);
65 65
 		foreach ( $items as $item ) {
66
-			$data['views'][] = $this->prepare_view_for_response( $item, $request );
66
+			$data[ 'views' ][ ] = $this->prepare_view_for_response( $item, $request );
67 67
 		}
68 68
 
69 69
 		return new \WP_REST_Response( $data, 200 );
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 
83 83
 		$url = $request->get_url_params();
84 84
 
85
-		$view_id = intval( $url['id'] );
85
+		$view_id = intval( $url[ 'id' ] );
86 86
 
87 87
 		$item = get_post( $view_id );
88 88
 
@@ -166,10 +166,10 @@  discard block
 block discarded – undo
166 166
 	public function get_sub_items( $request ) {
167 167
 
168 168
 		$url     = $request->get_url_params();
169
-		$view_id = intval( $url['id'] );
169
+		$view_id = intval( $url[ 'id' ] );
170 170
 		$format  = \GV\Utils::get( $url, 'format', 'json' );
171 171
 
172
-		if( $post_id = $request->get_param('post_id') ) {
172
+		if ( $post_id = $request->get_param( 'post_id' ) ) {
173 173
 			global $post;
174 174
 
175 175
 			$post = get_post( $post_id );
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 
261 261
 		$data = array( 'entries' => $entries->all(), 'total' => $entries->total() );
262 262
 
263
-		foreach ( $data['entries'] as &$entry ) {
263
+		foreach ( $data[ 'entries' ] as &$entry ) {
264 264
 			$entry = $this->prepare_entry_for_response( $view, $entry, $request, 'directory' );
265 265
 		}
266 266
 
@@ -279,8 +279,8 @@  discard block
 block discarded – undo
279 279
 	 */
280 280
 	public function get_sub_item( $request ) {
281 281
 		$url      = $request->get_url_params();
282
-		$view_id  = intval( $url['id'] );
283
-		$entry_id = intval( $url['s_id'] );
282
+		$view_id  = intval( $url[ 'id' ] );
283
+		$entry_id = intval( $url[ 's_id' ] );
284 284
 		$format   = \GV\Utils::get( $url, 'format', 'json' );
285 285
 
286 286
 		$view  = \GV\View::by_id( $view_id );
@@ -315,32 +315,32 @@  discard block
 block discarded – undo
315 315
 		// Add all the WP_Post data
316 316
 		$view_post = $view_post->to_array();
317 317
 
318
-		unset( $view_post['to_ping'], $view_post['ping_status'], $view_post['pinged'], $view_post['post_type'], $view_post['filter'], $view_post['post_category'], $view_post['tags_input'], $view_post['post_content'], $view_post['post_content_filtered'] );
318
+		unset( $view_post[ 'to_ping' ], $view_post[ 'ping_status' ], $view_post[ 'pinged' ], $view_post[ 'post_type' ], $view_post[ 'filter' ], $view_post[ 'post_category' ], $view_post[ 'tags_input' ], $view_post[ 'post_content' ], $view_post[ 'post_content_filtered' ] );
319 319
 
320 320
 		$return = wp_parse_args( $item, $view_post );
321 321
 
322
-		$return['title'] = $return['post_title'];
322
+		$return[ 'title' ] = $return[ 'post_title' ];
323 323
 
324
-		$return['settings'] = isset( $return['atts'] ) ? $return['atts'] : array();
325
-		unset( $return['atts'], $return['view_id'] );
324
+		$return[ 'settings' ] = isset( $return[ 'atts' ] ) ? $return[ 'atts' ] : array();
325
+		unset( $return[ 'atts' ], $return[ 'view_id' ] );
326 326
 
327
-		$return['search_criteria'] = array(
327
+		$return[ 'search_criteria' ] = array(
328 328
 			'page_size' => rgars( $return, 'settings/page_size' ),
329 329
 			'sort_field' => rgars( $return, 'settings/sort_field' ),
330 330
 			'sort_direction' => rgars( $return, 'settings/sort_direction' ),
331 331
 			'offset' => rgars( $return, 'settings/offset' ),
332 332
 		);
333 333
 
334
-		unset( $return['settings']['page_size'], $return['settings']['sort_field'], $return['settings']['sort_direction'] );
334
+		unset( $return[ 'settings' ][ 'page_size' ], $return[ 'settings' ][ 'sort_field' ], $return[ 'settings' ][ 'sort_direction' ] );
335 335
 
336 336
 		// Redact for non-logged ins
337 337
 		if ( ! \GVCommon::has_cap( 'edit_others_gravityviews' ) ) {
338
-			unset( $return['settings'] );
339
-			unset( $return['search_criteria'] );
338
+			unset( $return[ 'settings' ] );
339
+			unset( $return[ 'search_criteria' ] );
340 340
 		}
341 341
 		
342 342
 		if ( ! \GFCommon::current_user_can_any( 'gravityforms_edit_forms' ) ) {
343
-			unset( $return['form'] );
343
+			unset( $return[ 'form' ] );
344 344
 		}
345 345
 
346 346
 		return $return;
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 			$view_id = func_get_arg( 1 ); // $view_id override
357 357
 		} else {
358 358
 			$url     = $request->get_url_params();
359
-			$view_id = intval( $url['id'] );
359
+			$view_id = intval( $url[ 'id' ] );
360 360
 		}
361 361
 
362 362
 		if ( ! $view = \GV\View::by_id( $view_id ) ) {
@@ -400,8 +400,8 @@  discard block
 block discarded – undo
400 400
 		}
401 401
 
402 402
 		$url     = $request->get_url_params();
403
-		$view_id = intval( $url['id'] );
404
-		$entry_id = intval( $url['s_id'] );
403
+		$view_id = intval( $url[ 'id' ] );
404
+		$entry_id = intval( $url[ 's_id' ] );
405 405
 
406 406
 		$view = \GV\View::by_id( $view_id );
407 407
 
@@ -409,11 +409,11 @@  discard block
 block discarded – undo
409 409
 			return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' );
410 410
 		}
411 411
 
412
-		if ( $entry['form_id'] != $view->form->ID ) {
412
+		if ( $entry[ 'form_id' ] != $view->form->ID ) {
413 413
 			return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' );
414 414
 		}
415 415
 
416
-		if ( $entry['status'] != 'active' ) {
416
+		if ( $entry[ 'status' ] != 'active' ) {
417 417
 			return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' );
418 418
 		}
419 419
 
@@ -421,10 +421,10 @@  discard block
 block discarded – undo
421 421
 			return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' );
422 422
 		}
423 423
 
424
-		$is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap('gravityview_moderate_entries', $view->ID );
424
+		$is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap( 'gravityview_moderate_entries', $view->ID );
425 425
 
426 426
 		if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) {
427
-			if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) )  ) {
427
+			if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) {
428 428
 				return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' );
429 429
 			}
430 430
 		}
Please login to merge, or discard this patch.
includes/widgets/register-gravityview-widgets.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -20,16 +20,16 @@
 block discarded – undo
20 20
  */
21 21
 function gravityview_register_gravityview_widgets() {
22 22
 
23
-	include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget.php' );
23
+	include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget.php' );
24 24
 
25
-	include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-pagination-info.php' );
26
-	include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-page-links.php' );
27
-	include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-page-size.php' );
28
-	include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-custom-content.php' );
29
-	include_once( GRAVITYVIEW_DIR .'includes/widgets/search-widget/class-search-widget.php' );
25
+	include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-pagination-info.php' );
26
+	include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-page-links.php' );
27
+	include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-page-size.php' );
28
+	include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-custom-content.php' );
29
+	include_once( GRAVITYVIEW_DIR . 'includes/widgets/search-widget/class-search-widget.php' );
30 30
 
31
-	if( class_exists('GFPolls') ) {
32
-		include_once( GRAVITYVIEW_DIR .'includes/widgets/poll/class-gravityview-widget-poll.php' );
31
+	if ( class_exists( 'GFPolls' ) ) {
32
+		include_once( GRAVITYVIEW_DIR . 'includes/widgets/poll/class-gravityview-widget-poll.php' );
33 33
 	}
34 34
 
35 35
 }
Please login to merge, or discard this patch.
includes/widgets/class-gravityview-widget-page-size.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 
75 75
 	/**
76 76
 	 * Render the page size widget
77
-     *
77
+	 *
78 78
 	 * @param array $widget_args The Widget shortcode args.
79 79
 	 * @param string $content The content.
80 80
 	 * @param string|\GV\Template_Context $context The context, if available.
@@ -115,14 +115,14 @@  discard block
 block discarded – undo
115 115
 						<?php } ?>
116 116
                     </select>
117 117
                     <input type="submit" value="Submit" style="visibility: hidden; position: absolute;" /><?php
118
-                    if( ! empty( $_GET ) ) {
119
-                        $get = $_GET;
120
-                        unset( $get['page_size'] );
121
-	                    foreach ( $get as $key => $value ) {
122
-		                    printf( '<input type="hidden" name="%s" value="%s" />', esc_attr( $key ), esc_attr( $value ) );
123
-	                    }
124
-                    }
125
-                    ?>
118
+					if( ! empty( $_GET ) ) {
119
+						$get = $_GET;
120
+						unset( $get['page_size'] );
121
+						foreach ( $get as $key => $value ) {
122
+							printf( '<input type="hidden" name="%s" value="%s" />', esc_attr( $key ), esc_attr( $value ) );
123
+						}
124
+					}
125
+					?>
126 126
                 </div>
127 127
             </form>
128 128
         </div>
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 		$default_size = 25;
46 46
 
47 47
 		if ( $context instanceof \GV\Template_Context ) {
48
-			$default_size = (int) $context->view->settings->get( 'page_size' );
48
+			$default_size = (int)$context->view->settings->get( 'page_size' );
49 49
 		}
50 50
 
51 51
 		$sizes = array( 10, 25, $default_size, 50, 100 );
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 
57 57
 		$page_sizes = array();
58 58
 		foreach ( $sizes as $size ) {
59
-			$page_sizes [] = array(
59
+			$page_sizes [ ] = array(
60 60
 				'value' => $size,
61 61
 				'text'  => $size
62 62
 			);
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
 	 */
82 82
 	public function render_frontend( $widget_args, $content = '', $context = null ) {
83 83
 
84
-		if( ! $this->pre_render_frontend() ) {
84
+		if ( ! $this->pre_render_frontend() ) {
85 85
 			return;
86 86
 		}
87 87
 
88
-		$page_size = (int) \GV\Utils::_GET( 'page_size', $context->view->settings->get( 'page_size' ) );
88
+		$page_size = (int)\GV\Utils::_GET( 'page_size', $context->view->settings->get( 'page_size' ) );
89 89
 
90 90
 		$settings = shortcode_atts( array(
91 91
 			'label'   => __( 'Page Size', 'gravityview' ),
@@ -104,20 +104,20 @@  discard block
 block discarded – undo
104 104
         <div class="gv-widget-page-size">
105 105
             <form method="get" action="<?php echo esc_url( add_query_arg( array() ) ); ?>" onchange="this.submit();">
106 106
                 <div>
107
-                    <?php if( ! empty( $settings['label'] ) ) { ?>
108
-                    <label for="gv-page_size"><?php echo esc_html( $settings['label'] ); ?></label>
107
+                    <?php if ( ! empty( $settings[ 'label' ] ) ) { ?>
108
+                    <label for="gv-page_size"><?php echo esc_html( $settings[ 'label' ] ); ?></label>
109 109
                     <?php } ?>
110 110
                     <select name="page_size" id="gv-page_size">
111
-                        <option value=""><?php echo esc_html( $settings['default_choice_text'] ); ?></option>
111
+                        <option value=""><?php echo esc_html( $settings[ 'default_choice_text' ] ); ?></option>
112 112
 						<?php
113
-						foreach ( $settings['choices'] as $choice ) { ?>
114
-                            <option value='<?php echo esc_attr( $choice['value'] ); ?>'<?php gv_selected( esc_attr( $choice['value'] ), esc_attr( $page_size ), true ); ?>><?php echo esc_html( $choice['text'] ); ?></option>
113
+						foreach ( $settings[ 'choices' ] as $choice ) { ?>
114
+                            <option value='<?php echo esc_attr( $choice[ 'value' ] ); ?>'<?php gv_selected( esc_attr( $choice[ 'value' ] ), esc_attr( $page_size ), true ); ?>><?php echo esc_html( $choice[ 'text' ] ); ?></option>
115 115
 						<?php } ?>
116 116
                     </select>
117 117
                     <input type="submit" value="Submit" style="visibility: hidden; position: absolute;" /><?php
118
-                    if( ! empty( $_GET ) ) {
118
+                    if ( ! empty( $_GET ) ) {
119 119
                         $get = $_GET;
120
-                        unset( $get['page_size'] );
120
+                        unset( $get[ 'page_size' ] );
121 121
 	                    foreach ( $get as $key => $value ) {
122 122
 		                    printf( '<input type="hidden" name="%s" value="%s" />', esc_attr( $key ), esc_attr( $value ) );
123 123
 	                    }
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 		}
151 151
 
152 152
 		// Already overridden
153
-		if ( (int) $page_size === (int) $view->settings->get( 'page_size' ) ) {
153
+		if ( (int)$page_size === (int)$view->settings->get( 'page_size' ) ) {
154 154
 			return;
155 155
 		}
156 156
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 			'view' => $view,
159 159
 		) );
160 160
 
161
-		if ( ! in_array( (int) $page_size, wp_list_pluck( self::get_page_sizes( $context ), 'value' ), true ) ) {
161
+		if ( ! in_array( (int)$page_size, wp_list_pluck( self::get_page_sizes( $context ), 'value' ), true ) ) {
162 162
 			gravityview()->log->warning( 'The passed page size is not allowed: {page_size}. Not modifying result.', array( 'page_size' => $page_size ) );
163 163
 			return;
164 164
 		}
Please login to merge, or discard this patch.
includes/admin/class-gravityview-support-port.php 2 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 			'payment_id'       => '',
105 105
 			'customer_name'    => '',
106 106
 			'customer_email'   => '',
107
-            'price_id'         => '0',
107
+			'price_id'         => '0',
108 108
 		) );
109 109
 
110 110
 		// This is just HTML we don't need.
@@ -121,9 +121,9 @@  discard block
 block discarded – undo
121 121
 			case 3:
122 122
 				$package = 'All Access';
123 123
 				break;
124
-            case 4:
125
-                $package = 'Lifetime';
126
-                break;
124
+			case 4:
125
+				$package = 'Lifetime';
126
+				break;
127 127
 		}
128 128
 
129 129
 		$data = array(
@@ -152,18 +152,18 @@  discard block
 block discarded – undo
152 152
 			'contactEnabled' => (int)GVCommon::has_cap( 'gravityview_contact_support' ),
153 153
 			'data' => $data,
154 154
 			'translation' => $translation,
155
-            'suggest' => array(),
155
+			'suggest' => array(),
156 156
 		);
157 157
 
158 158
 		/**
159
-         * @filter `gravityview/support_port/localization_data` Filter data passed to the Support Port, before localize_script is run
159
+		 * @filter `gravityview/support_port/localization_data` Filter data passed to the Support Port, before localize_script is run
160 160
 		 * @since 2.0
161
-         * @param array $localization_data {
162
-         *   @type int $contactEnabled Can the user contact support?
163
-         *   @type array $data Support/license info
164
-         *   @type array $translation i18n strings
165
-         *   @type array $suggest Article IDs to recommend to the user (per page in the admin
166
-         * }
161
+		 * @param array $localization_data {
162
+		 *   @type int $contactEnabled Can the user contact support?
163
+		 *   @type array $data Support/license info
164
+		 *   @type array $translation i18n strings
165
+		 *   @type array $suggest Article IDs to recommend to the user (per page in the admin
166
+		 * }
167 167
 		 */
168 168
 		$localization_data = apply_filters( 'gravityview/support_port/localization_data', $localization_data );
169 169
 
@@ -177,11 +177,11 @@  discard block
 block discarded – undo
177 177
 	 *
178 178
 	 * If the user doesn't have the `gravityview_support_port` capability, returns false; then
179 179
 	 * If global setting is "hide", returns false; then
180
-     * If user preference is not set, return global setting; then
181
-     * If user preference is set, return that setting.
180
+	 * If user preference is not set, return global setting; then
181
+	 * If user preference is set, return that setting.
182 182
 	 *
183 183
 	 * @since 1.15
184
-     * @since 1.17.5 Changed behavior to respect global setting
184
+	 * @since 1.17.5 Changed behavior to respect global setting
185 185
 	 *
186 186
 	 * @param int $user Optional. ID of the user to check, defaults to 0 for current user.
187 187
 	 *
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 		$global_setting = gravityview()->plugin->settings->get( 'support_port' );
197 197
 
198 198
 		if ( empty( $global_setting ) ) {
199
-            return false;
199
+			return false;
200 200
 		}
201 201
 
202 202
 		// Get the per-user Support Port setting
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 	 * Modifies the output of profile.php to add GravityView Support preference
233 233
 	 *
234 234
 	 * @since 1.15
235
-     * @since 1.17.5 Only show if global setting is active
235
+	 * @since 1.17.5 Only show if global setting is active
236 236
 	 *
237 237
 	 * @param WP_User $user Current user info
238 238
 	 *
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 		$global_setting = gravityview()->plugin->settings->get( 'support_port' );
244 244
 
245 245
 		if ( empty( $global_setting ) ) {
246
-            return;
246
+			return;
247 247
 		}
248 248
 
249 249
 		/**
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -108,9 +108,9 @@  discard block
 block discarded – undo
108 108
 		) );
109 109
 
110 110
 		// This is just HTML we don't need.
111
-		unset( $response['message'] );
111
+		unset( $response[ 'message' ] );
112 112
 
113
-		switch ( intval( $response['price_id'] ) ) {
113
+		switch ( intval( $response[ 'price_id' ] ) ) {
114 114
 			default:
115 115
 			case 1:
116 116
 				$package = 'Core';
@@ -128,19 +128,19 @@  discard block
 block discarded – undo
128 128
 
129 129
 		$data = array(
130 130
 			'email'                 => gravityview()->plugin->settings->get( 'support-email' ),
131
-			'name'                  => $response['customer_name'],
132
-			'Valid License?'        => ucwords( $response['license'] ),
133
-			'License Key'           => $response['license_key'],
131
+			'name'                  => $response[ 'customer_name' ],
132
+			'Valid License?'        => ucwords( $response[ 'license' ] ),
133
+			'License Key'           => $response[ 'license_key' ],
134 134
 			'License Level'         => $package,
135 135
 			'Site Admin Email'      => get_bloginfo( 'admin_email' ),
136 136
 			'Support Email'         => gravityview()->plugin->settings->get( 'support-email' ),
137
-			'License Limit'         => $response['license_limit'],
138
-			'Site Count'            => $response['site_count'],
139
-			'License Expires'       => $response['expires'],
140
-			'Activations Left'      => $response['activations_left'],
141
-			'Payment ID'            => $response['payment_id'],
142
-			'Payment Name'          => $response['customer_name'],
143
-			'Payment Email'         => $response['customer_email'],
137
+			'License Limit'         => $response[ 'license_limit' ],
138
+			'Site Count'            => $response[ 'site_count' ],
139
+			'License Expires'       => $response[ 'expires' ],
140
+			'Activations Left'      => $response[ 'activations_left' ],
141
+			'Payment ID'            => $response[ 'payment_id' ],
142
+			'Payment Name'          => $response[ 'customer_name' ],
143
+			'Payment Email'         => $response[ 'customer_email' ],
144 144
 			'WordPress Version'     => get_bloginfo( 'version', 'display' ),
145 145
 			'PHP Version'           => phpversion(),
146 146
 			'GravityView Version'   => \GV\Plugin::$version,
Please login to merge, or discard this patch.