Completed
Push — develop ( 3f375d...0f7d17 )
by Zack
28:11 queued 08:00
created
includes/admin/class-gravityview-admin-no-conflict.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	 */
19 19
 	public function __construct() {
20 20
 
21
-		if( ! is_admin() ) { return; }
21
+		if ( ! is_admin() ) { return; }
22 22
 		
23 23
 		$this->add_hooks();
24 24
 	}
@@ -32,13 +32,13 @@  discard block
 block discarded – undo
32 32
 	 */
33 33
 	private function add_hooks() {
34 34
 		//Hooks for no-conflict functionality
35
-		add_action( 'wp_print_scripts', array( $this, 'no_conflict_scripts' ), 1000);
36
-		add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_scripts' ), 9);
35
+		add_action( 'wp_print_scripts', array( $this, 'no_conflict_scripts' ), 1000 );
36
+		add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_scripts' ), 9 );
37 37
 
38
-		add_action( 'wp_print_styles', array( $this, 'no_conflict_styles' ), 1000);
39
-		add_action( 'admin_print_styles', array( $this, 'no_conflict_styles' ), 11);
40
-		add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_styles' ), 1);
41
-		add_action( 'admin_footer', array( $this, 'no_conflict_styles' ), 1);
38
+		add_action( 'wp_print_styles', array( $this, 'no_conflict_styles' ), 1000 );
39
+		add_action( 'admin_print_styles', array( $this, 'no_conflict_styles' ), 11 );
40
+		add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_styles' ), 1 );
41
+		add_action( 'admin_footer', array( $this, 'no_conflict_styles' ), 1 );
42 42
 	}
43 43
 
44 44
 	/**
@@ -51,13 +51,13 @@  discard block
 block discarded – undo
51 51
 	function no_conflict_scripts() {
52 52
 		global $wp_scripts;
53 53
 
54
-		if( ! gravityview()->request->is_admin( '', null ) ) {
54
+		if ( ! gravityview()->request->is_admin( '', null ) ) {
55 55
 			return;
56 56
 		}
57 57
 
58 58
 		$no_conflict_mode = gravityview()->plugin->settings->get( 'no-conflict-mode' );
59 59
 
60
-		if( empty( $no_conflict_mode ) ) {
60
+		if ( empty( $no_conflict_mode ) ) {
61 61
 			return;
62 62
 		}
63 63
 
@@ -110,15 +110,15 @@  discard block
 block discarded – undo
110 110
 	function no_conflict_styles() {
111 111
 		global $wp_styles;
112 112
 
113
-		if( ! gravityview()->request->is_admin( '', null ) ) {
113
+		if ( ! gravityview()->request->is_admin( '', null ) ) {
114 114
 			return;
115 115
 		}
116 116
 
117 117
 		// Dequeue other jQuery styles even if no-conflict is off.
118 118
 		// Terrible-looking tabs help no one.
119
-		if( !empty( $wp_styles->registered ) )  {
120
-			foreach ($wp_styles->registered as $key => $style) {
121
-				if( preg_match( '/^(?:wp\-)?jquery/ism', $key ) ) {
119
+		if ( ! empty( $wp_styles->registered ) ) {
120
+			foreach ( $wp_styles->registered as $key => $style ) {
121
+				if ( preg_match( '/^(?:wp\-)?jquery/ism', $key ) ) {
122 122
 					wp_dequeue_style( $key );
123 123
 				}
124 124
 			}
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 		$no_conflict_mode = gravityview()->plugin->settings->get( 'no-conflict-mode' );
128 128
 
129 129
 		// If no conflict is off, jQuery will suffice.
130
-		if( empty( $no_conflict_mode ) ) {
130
+		if ( empty( $no_conflict_mode ) ) {
131 131
 			return;
132 132
 		}
133 133
 
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 		/**
155 155
 		 * @action `gravityview_remove_conflicts_after` Runs after no-conflict styles are removed. You can re-add styles here.
156 156
 		 */
157
-		do_action('gravityview_remove_conflicts_after');
157
+		do_action( 'gravityview_remove_conflicts_after' );
158 158
 	}
159 159
 
160 160
 	/**
@@ -178,9 +178,9 @@  discard block
 block discarded – undo
178 178
 
179 179
 		//reset queue
180 180
 		$queue = array();
181
-		foreach( $wp_objects->queue as $object ) {
182
-			if( in_array( $object, $required_objects ) || preg_match('/gravityview|gf_|gravityforms/ism', $object ) ) {
183
-				$queue[] = $object;
181
+		foreach ( $wp_objects->queue as $object ) {
182
+			if ( in_array( $object, $required_objects ) || preg_match( '/gravityview|gf_|gravityforms/ism', $object ) ) {
183
+				$queue[ ] = $object;
184 184
 			}
185 185
 		}
186 186
 		$wp_objects->queue = $queue;
@@ -189,8 +189,8 @@  discard block
 block discarded – undo
189 189
 
190 190
 		//unregistering scripts
191 191
 		$registered = array();
192
-		foreach( $wp_objects->registered as $handle => $script_registration ){
193
-			if( in_array( $handle, $required_objects ) ){
192
+		foreach ( $wp_objects->registered as $handle => $script_registration ) {
193
+			if ( in_array( $handle, $required_objects ) ) {
194 194
 				$registered[ $handle ] = $script_registration;
195 195
 			}
196 196
 		}
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 	 * @param array $registered [description]
206 206
 	 * @param array $scripts    [description]
207 207
 	 */
208
-	private function add_script_dependencies($registered, $scripts) {
208
+	private function add_script_dependencies( $registered, $scripts ) {
209 209
 
210 210
 		//gets all dependent scripts linked to the $scripts array passed
211 211
 		do {
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 				$deps = isset( $registered[ $script ] ) && is_array( $registered[ $script ]->deps ) ? $registered[ $script ]->deps : array();
215 215
 				foreach ( $deps as $dep ) {
216 216
 					if ( ! in_array( $dep, $scripts ) && ! in_array( $dep, $dependents ) ) {
217
-						$dependents[] = $dep;
217
+						$dependents[ ] = $dep;
218 218
 					}
219 219
 				}
220 220
 			}
Please login to merge, or discard this patch.
future/includes/class-gv-settings-addon.php 1 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/class-gv-request-admin.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 		 */
39 39
 		$is_page = false;
40 40
 
41
-		if( function_exists( '\get_current_screen' ) || function_exists( 'get_current_screen' ) ) {
41
+		if ( function_exists( '\get_current_screen' ) || function_exists( 'get_current_screen' ) ) {
42 42
 			$current_screen = \get_current_screen();
43 43
 		} else {
44 44
 			$current_screen = false;
@@ -51,13 +51,13 @@  discard block
 block discarded – undo
51 51
 				$is_page = 'single';
52 52
 			} elseif ( $is_gv_settings = 'gravityview_page_gravityview_settings' === $current_screen->id ) {
53 53
 				$is_page = 'settings';
54
-			} elseif( $is_extensions = 'gravityview_page_gv-admin-installer' === $current_screen->id ) {
54
+			} elseif ( $is_extensions = 'gravityview_page_gv-admin-installer' === $current_screen->id ) {
55 55
 				$is_page = 'downloads';
56
-			} elseif( $is_changelog = 'gravityview_page_gv-changelog' === $current_screen->id ) {
56
+			} elseif ( $is_changelog = 'gravityview_page_gv-changelog' === $current_screen->id ) {
57 57
 				$is_page = 'changelog';
58
-			} elseif( $is_getting_started = 'gravityview_page_gv-getting-started' === $current_screen->id ) {
58
+			} elseif ( $is_getting_started = 'gravityview_page_gv-getting-started' === $current_screen->id ) {
59 59
 				$is_page = 'getting-started';
60
-			} elseif( $is_credits = 'gravityview_page_gv-credits' === $current_screen->id ) {
60
+			} elseif ( $is_credits = 'gravityview_page_gv-credits' === $current_screen->id ) {
61 61
 				$is_page = 'credits';
62 62
 			}
63 63
 		}
Please login to merge, or discard this patch.
includes/extensions/edit-entry/class-edit-entry-render.php 1 patch
Spacing   +202 added lines, -202 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();
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
 			 * @param GravityView_Edit_Entry_Render $this This object
362 362
 			 * @param GravityView_View_Data $gv_data The View data
363 363
 			 */
364
-			do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry['id'], $this, $gv_data );
364
+			do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry[ 'id' ], $this, $gv_data );
365 365
 
366 366
 		} else {
367 367
 			gravityview()->log->error( 'Submission is NOT valid.', array( 'entry' => $this->entry ) );
@@ -389,16 +389,16 @@  discard block
 block discarded – undo
389 389
 		 */
390 390
 		$unset_hidden_field_values = apply_filters( 'gravityview/edit_entry/unset_hidden_field_values', true, $this );
391 391
 
392
-		if( ! $unset_hidden_field_values ) {
392
+		if ( ! $unset_hidden_field_values ) {
393 393
 			return;
394 394
 		}
395 395
 
396 396
 		if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_meta_table_name' ) ) {
397 397
 			$entry_meta_table = GFFormsModel::get_entry_meta_table_name();
398
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value FROM $entry_meta_table WHERE entry_id=%d", $this->entry['id'] ) );
398
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value FROM $entry_meta_table WHERE entry_id=%d", $this->entry[ 'id' ] ) );
399 399
 		} else {
400 400
 			$lead_detail_table = GFFormsModel::get_lead_details_table_name();
401
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT id, field_number FROM $lead_detail_table WHERE lead_id=%d", $this->entry['id'] ) );
401
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT id, field_number FROM $lead_detail_table WHERE lead_id=%d", $this->entry[ 'id' ] ) );
402 402
 		}
403 403
 
404 404
 	    foreach ( $this->entry as $input_id => $field_value ) {
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
 		}
480 480
 
481 481
 		/** No file is being uploaded. */
482
-		if ( empty( $_FILES[ $input_name ]['name'] ) ) {
482
+		if ( empty( $_FILES[ $input_name ][ 'name' ] ) ) {
483 483
 			/** So return the original upload */
484 484
 			return $entry[ $input_id ];
485 485
 		}
@@ -497,11 +497,11 @@  discard block
 block discarded – undo
497 497
 	 * @return mixed
498 498
 	 */
499 499
 	public function modify_fileupload_settings( $plupload_init, $form_id, $instance ) {
500
-		if( ! $this->is_edit_entry() ) {
500
+		if ( ! $this->is_edit_entry() ) {
501 501
 			return $plupload_init;
502 502
 		}
503 503
 
504
-		$plupload_init['gf_vars']['max_files'] = 0;
504
+		$plupload_init[ 'gf_vars' ][ 'max_files' ] = 0;
505 505
 
506 506
 		return $plupload_init;
507 507
 	}
@@ -516,22 +516,22 @@  discard block
 block discarded – undo
516 516
 		$form = $this->form;
517 517
 
518 518
 	    /** @var GF_Field $field */
519
-		foreach( $form['fields'] as $k => &$field ) {
519
+		foreach ( $form[ 'fields' ] as $k => &$field ) {
520 520
 
521 521
 			/**
522 522
 			 * Remove the fields with calculation formulas before save to avoid conflicts with GF logic
523 523
 			 * @since 1.16.3
524 524
 			 * @var GF_Field $field
525 525
 			 */
526
-			if( $field->has_calculation() ) {
527
-				unset( $form['fields'][ $k ] );
526
+			if ( $field->has_calculation() ) {
527
+				unset( $form[ 'fields' ][ $k ] );
528 528
 			}
529 529
 
530 530
 			$field->adminOnly = false;
531 531
 
532
-			if( isset( $field->inputs ) && is_array( $field->inputs ) ) {
533
-				foreach( $field->inputs as $key => $input ) {
534
-				    $field->inputs[ $key ][ 'id' ] = (string)$input['id'];
532
+			if ( isset( $field->inputs ) && is_array( $field->inputs ) ) {
533
+				foreach ( $field->inputs as $key => $input ) {
534
+				    $field->inputs[ $key ][ 'id' ] = (string)$input[ 'id' ];
535 535
 				}
536 536
 			}
537 537
 		}
@@ -545,20 +545,20 @@  discard block
 block discarded – undo
545 545
 		$update = false;
546 546
 
547 547
 		// get the most up to date entry values
548
-		$entry = GFAPI::get_entry( $this->entry['id'] );
548
+		$entry = GFAPI::get_entry( $this->entry[ 'id' ] );
549 549
 
550
-		if( !empty( $this->fields_with_calculation ) ) {
550
+		if ( ! empty( $this->fields_with_calculation ) ) {
551 551
 			$update = true;
552 552
 			foreach ( $this->fields_with_calculation as $calc_field ) {
553 553
 				$inputs = $calc_field->get_entry_inputs();
554 554
 				if ( is_array( $inputs ) ) {
555 555
 				    foreach ( $inputs as $input ) {
556
-				        $input_name = 'input_' . str_replace( '.', '_', $input['id'] );
557
-				        $entry[ strval( $input['id'] ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
556
+				        $input_name = 'input_' . str_replace( '.', '_', $input[ 'id' ] );
557
+				        $entry[ strval( $input[ 'id' ] ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry[ 'id' ], $entry );
558 558
 				    }
559 559
 				} else {
560
-				    $input_name = 'input_' . str_replace( '.', '_', $calc_field->id);
561
-				    $entry[ strval( $calc_field->id ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
560
+				    $input_name = 'input_' . str_replace( '.', '_', $calc_field->id );
561
+				    $entry[ strval( $calc_field->id ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry[ 'id' ], $entry );
562 562
 				}
563 563
 			}
564 564
 		}
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
 
568 568
 			$return_entry = GFAPI::update_entry( $entry );
569 569
 
570
-			if( is_wp_error( $return_entry ) ) {
570
+			if ( is_wp_error( $return_entry ) ) {
571 571
 				gravityview()->log->error( 'Updating the entry calculation fields failed', array( 'data' => $return_entry ) );
572 572
 			} else {
573 573
 				gravityview()->log->debug( 'Updating the entry calculation fields succeeded' );
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
 			return;
585 585
 		}
586 586
 
587
-		$entry = GFAPI::get_entry( $this->entry['id'] );
587
+		$entry = GFAPI::get_entry( $this->entry[ 'id' ] );
588 588
 
589 589
 		foreach ( array( 'score', 'percent', 'grade', 'is_pass' ) as $meta ) {
590 590
 			GFQuiz::get_instance()->update_entry_meta( "gfquiz_$meta", $entry, self::$original_form );
@@ -614,19 +614,19 @@  discard block
 block discarded – undo
614 614
 
615 615
 		$input_name = 'input_' . $field_id;
616 616
 
617
-		if ( !empty( $_FILES[ $input_name ]['name'] ) ) {
617
+		if ( ! empty( $_FILES[ $input_name ][ 'name' ] ) ) {
618 618
 
619 619
 			// We have a new image
620 620
 
621
-			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'] );
621
+			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ] );
622 622
 
623 623
 			$ary = ! empty( $value ) ? explode( '|:|', $value ) : array();
624 624
 	        $ary = stripslashes_deep( $ary );
625 625
 			$img_url = \GV\Utils::get( $ary, 0 );
626 626
 
627
-			$img_title       = count( $ary ) > 1 ? $ary[1] : '';
628
-			$img_caption     = count( $ary ) > 2 ? $ary[2] : '';
629
-			$img_description = count( $ary ) > 3 ? $ary[3] : '';
627
+			$img_title       = count( $ary ) > 1 ? $ary[ 1 ] : '';
628
+			$img_caption     = count( $ary ) > 2 ? $ary[ 2 ] : '';
629
+			$img_description = count( $ary ) > 3 ? $ary[ 3 ] : '';
630 630
 
631 631
 			$image_meta = array(
632 632
 				'post_excerpt' => $img_caption,
@@ -635,7 +635,7 @@  discard block
 block discarded – undo
635 635
 
636 636
 			//adding title only if it is not empty. It will default to the file name if it is not in the array
637 637
 			if ( ! empty( $img_title ) ) {
638
-				$image_meta['post_title'] = $img_title;
638
+				$image_meta[ 'post_title' ] = $img_title;
639 639
 			}
640 640
 
641 641
 			/**
@@ -693,15 +693,15 @@  discard block
 block discarded – undo
693 693
 	 */
694 694
 	private function maybe_update_post_fields( $form ) {
695 695
 
696
-		if( empty( $this->entry['post_id'] ) ) {
696
+		if ( empty( $this->entry[ 'post_id' ] ) ) {
697 697
 	        gravityview()->log->debug( 'This entry has no post fields. Continuing...' );
698 698
 			return;
699 699
 		}
700 700
 
701
-		$post_id = $this->entry['post_id'];
701
+		$post_id = $this->entry[ 'post_id' ];
702 702
 
703 703
 		// Security check
704
-		if( false === GVCommon::has_cap( 'edit_post', $post_id ) ) {
704
+		if ( false === GVCommon::has_cap( 'edit_post', $post_id ) ) {
705 705
 			gravityview()->log->error( 'The current user does not have the ability to edit Post #{post_id}', array( 'post_id' => $post_id ) );
706 706
 			return;
707 707
 		}
@@ -714,25 +714,25 @@  discard block
 block discarded – undo
714 714
 
715 715
 			$field = RGFormsModel::get_field( $form, $field_id );
716 716
 
717
-			if( ! $field ) {
717
+			if ( ! $field ) {
718 718
 				continue;
719 719
 			}
720 720
 
721
-			if( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) {
721
+			if ( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) {
722 722
 
723 723
 				// Get the value of the field, including $_POSTed value
724 724
 				$value = RGFormsModel::get_field_value( $field );
725 725
 
726 726
 				// Use temporary entry variable, to make values available to fill_post_template() and update_post_image()
727 727
 				$entry_tmp = $this->entry;
728
-				$entry_tmp["{$field_id}"] = $value;
728
+				$entry_tmp[ "{$field_id}" ] = $value;
729 729
 
730
-				switch( $field->type ) {
730
+				switch ( $field->type ) {
731 731
 
732 732
 				    case 'post_title':
733 733
 				        $post_title = $value;
734 734
 				        if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) {
735
-				            $post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
735
+				            $post_title = $this->fill_post_template( $form[ 'postTitleTemplate' ], $form, $entry_tmp );
736 736
 				        }
737 737
 				        $updated_post->post_title = $post_title;
738 738
 				        $updated_post->post_name  = $post_title;
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
 				    case 'post_content':
743 743
 				        $post_content = $value;
744 744
 				        if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) {
745
-				            $post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
745
+				            $post_content = $this->fill_post_template( $form[ 'postContentTemplate' ], $form, $entry_tmp, true );
746 746
 				        }
747 747
 				        $updated_post->post_content = $post_content;
748 748
 				        unset( $post_content );
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
 							$value = $value[ $field_id ];
761 761
 						}
762 762
 
763
-				        if( ! empty( $field->customFieldTemplateEnabled ) ) {
763
+				        if ( ! empty( $field->customFieldTemplateEnabled ) ) {
764 764
 				            $value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
765 765
 				        }
766 766
 
@@ -778,7 +778,7 @@  discard block
 block discarded – undo
778 778
 				}
779 779
 
780 780
 				// update entry after
781
-				$this->entry["{$field_id}"] = $value;
781
+				$this->entry[ "{$field_id}" ] = $value;
782 782
 
783 783
 				$update_entry = true;
784 784
 
@@ -787,11 +787,11 @@  discard block
 block discarded – undo
787 787
 
788 788
 		}
789 789
 
790
-		if( $update_entry ) {
790
+		if ( $update_entry ) {
791 791
 
792 792
 			$return_entry = GFAPI::update_entry( $this->entry );
793 793
 
794
-			if( is_wp_error( $return_entry ) ) {
794
+			if ( is_wp_error( $return_entry ) ) {
795 795
 				gravityview()->log->error( 'Updating the entry post fields failed', array( 'data' => array( '$this->entry' => $this->entry, '$return_entry' => $return_entry ) ) );
796 796
 			} else {
797 797
 				gravityview()->log->debug( 'Updating the entry post fields for post #{post_id} succeeded', array( 'post_id' => $post_id ) );
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
 
802 802
 		$return_post = wp_update_post( $updated_post, true );
803 803
 
804
-		if( is_wp_error( $return_post ) ) {
804
+		if ( is_wp_error( $return_post ) ) {
805 805
 			$return_post->add_data( $updated_post, '$updated_post' );
806 806
 			gravityview()->log->error( 'Updating the post content failed', array( 'data' => compact( 'updated_post', 'return_post' ) ) );
807 807
 		} else {
@@ -823,7 +823,7 @@  discard block
 block discarded – undo
823 823
 		$input_type = RGFormsModel::get_input_type( $field );
824 824
 
825 825
 	    // Only certain custom field types are supported
826
-	    switch( $input_type ) {
826
+	    switch ( $input_type ) {
827 827
 		    case 'fileupload':
828 828
 		    case 'list':
829 829
 		    case 'multiselect':
@@ -860,7 +860,7 @@  discard block
 block discarded – undo
860 860
 		$output = GFCommon::replace_variables( $output, $form, $entry, false, false, false );
861 861
 
862 862
 		// replace conditional shortcodes
863
-		if( $do_shortcode ) {
863
+		if ( $do_shortcode ) {
864 864
 			$output = do_shortcode( $output );
865 865
 		}
866 866
 
@@ -879,19 +879,19 @@  discard block
 block discarded – undo
879 879
 	 */
880 880
 	private function after_update() {
881 881
 
882
-		do_action( 'gform_after_update_entry', $this->form, $this->entry['id'], self::$original_entry );
883
-		do_action( "gform_after_update_entry_{$this->form['id']}", $this->form, $this->entry['id'], self::$original_entry );
882
+		do_action( 'gform_after_update_entry', $this->form, $this->entry[ 'id' ], self::$original_entry );
883
+		do_action( "gform_after_update_entry_{$this->form[ 'id' ]}", $this->form, $this->entry[ 'id' ], self::$original_entry );
884 884
 
885 885
 		// Re-define the entry now that we've updated it.
886
-		$entry = RGFormsModel::get_lead( $this->entry['id'] );
886
+		$entry = RGFormsModel::get_lead( $this->entry[ 'id' ] );
887 887
 
888 888
 		$entry = GFFormsModel::set_entry_meta( $entry, $this->form );
889 889
 
890 890
 		if ( version_compare( GFFormsModel::get_database_version(), '2.3-dev-1', '<' ) ) {
891 891
 			// We need to clear the cache because Gravity Forms caches the field values, which
892 892
 			// we have just updated.
893
-			foreach ($this->form['fields'] as $key => $field) {
894
-				GFFormsModel::refresh_lead_field_value( $entry['id'], $field->id );
893
+			foreach ( $this->form[ 'fields' ] as $key => $field ) {
894
+				GFFormsModel::refresh_lead_field_value( $entry[ 'id' ], $field->id );
895 895
 			}
896 896
 		}
897 897
 
@@ -910,7 +910,7 @@  discard block
 block discarded – undo
910 910
 
911 911
 		<div class="gv-edit-entry-wrapper"><?php
912 912
 
913
-			$javascript = gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/inline-javascript.php', $this );
913
+			$javascript = gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/inline-javascript.php', $this );
914 914
 
915 915
 			/**
916 916
 			 * Fixes weird wpautop() issue
@@ -926,7 +926,7 @@  discard block
 block discarded – undo
926 926
 				     * @param string $edit_entry_title Modify the "Edit Entry" title
927 927
 				     * @param GravityView_Edit_Entry_Render $this This object
928 928
 				     */
929
-				    $edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
929
+				    $edit_entry_title = apply_filters( 'gravityview_edit_entry_title', __( 'Edit Entry', 'gravityview' ), $this );
930 930
 
931 931
 				    echo esc_attr( $edit_entry_title );
932 932
 			?></span>
@@ -976,16 +976,16 @@  discard block
 block discarded – undo
976 976
 
977 977
 			$back_link = esc_url( 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
-				$validation_message = "<div class='validation_error'>" . __('There was a problem with your submission.', 'gravityview') . " " . __('Errors have been highlighted below.', 'gravityview') . "</div>";
983
-				$message = apply_filters("gform_validation_message_{$this->form['id']}", apply_filters("gform_validation_message", $validation_message, $this->form), $this->form);
982
+				$validation_message = "<div class='validation_error'>" . __( 'There was a problem with your submission.', 'gravityview' ) . " " . __( 'Errors have been highlighted below.', 'gravityview' ) . "</div>";
983
+				$message = apply_filters( "gform_validation_message_{$this->form[ 'id' ]}", apply_filters( "gform_validation_message", $validation_message, $this->form ), $this->form );
984 984
 
985
-				echo GVCommon::generate_notice( $message , 'gv-error' );
985
+				echo GVCommon::generate_notice( $message, 'gv-error' );
986 986
 
987 987
 			} else {
988
-				$entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturn to Entry%s', 'gravityview'), '<a href="'. $back_link .'">', '</a>' );
988
+				$entry_updated_message = sprintf( esc_attr__( 'Entry Updated. %sReturn to Entry%s', 'gravityview' ), '<a href="' . $back_link . '">', '</a>' );
989 989
 
990 990
 				/**
991 991
 				 * @filter `gravityview/edit_entry/success` Modify the edit entry success message (including the anchor link)
@@ -995,7 +995,7 @@  discard block
 block discarded – undo
995 995
 				 * @param array $entry Gravity Forms entry array
996 996
 				 * @param string $back_link URL to return to the original entry. @since 1.6
997 997
 				 */
998
-				$message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message , $this->view_id, $this->entry, $back_link );
998
+				$message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message, $this->view_id, $this->entry, $back_link );
999 999
 
1000 1000
 				echo GVCommon::generate_notice( $message );
1001 1001
 			}
@@ -1019,21 +1019,21 @@  discard block
 block discarded – undo
1019 1019
 		 */
1020 1020
 		do_action( 'gravityview/edit-entry/render/before', $this );
1021 1021
 
1022
-		add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields'), 5000, 3 );
1023
-		add_filter( 'gform_submit_button', array( $this, 'render_form_buttons') );
1022
+		add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000, 3 );
1023
+		add_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) );
1024 1024
 		add_filter( 'gform_disable_view_counter', '__return_true' );
1025 1025
 
1026 1026
 		add_filter( 'gform_field_input', array( $this, 'verify_user_can_edit_post' ), 5, 5 );
1027 1027
 		add_filter( 'gform_field_input', array( $this, 'modify_edit_field_input' ), 10, 5 );
1028 1028
 
1029 1029
 		// We need to remove the fake $_GET['page'] arg to avoid rendering form as if in admin.
1030
-		unset( $_GET['page'] );
1030
+		unset( $_GET[ 'page' ] );
1031 1031
 
1032 1032
 		// TODO: Verify multiple-page forms
1033 1033
 
1034 1034
 		ob_start(); // Prevent PHP warnings possibly caused by prefilling list fields for conditional logic
1035 1035
 
1036
-		$html = GFFormDisplay::get_form( $this->form['id'], false, false, true, $this->entry );
1036
+		$html = GFFormDisplay::get_form( $this->form[ 'id' ], false, false, true, $this->entry );
1037 1037
 
1038 1038
 		ob_get_clean();
1039 1039
 
@@ -1059,7 +1059,7 @@  discard block
 block discarded – undo
1059 1059
 	 * @return string
1060 1060
 	 */
1061 1061
 	public function render_form_buttons() {
1062
-		return gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/form-buttons.php', $this );
1062
+		return gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/form-buttons.php', $this );
1063 1063
 	}
1064 1064
 
1065 1065
 
@@ -1079,10 +1079,10 @@  discard block
 block discarded – undo
1079 1079
 	public function filter_modify_form_fields( $form, $ajax = false, $field_values = '' ) {
1080 1080
 
1081 1081
 		// In case we have validated the form, use it to inject the validation results into the form render
1082
-		if( isset( $this->form_after_validation ) ) {
1082
+		if ( isset( $this->form_after_validation ) ) {
1083 1083
 			$form = $this->form_after_validation;
1084 1084
 		} else {
1085
-			$form['fields'] = $this->get_configured_edit_fields( $form, $this->view_id );
1085
+			$form[ 'fields' ] = $this->get_configured_edit_fields( $form, $this->view_id );
1086 1086
 		}
1087 1087
 
1088 1088
 		$form = $this->filter_conditional_logic( $form );
@@ -1090,8 +1090,8 @@  discard block
 block discarded – undo
1090 1090
 		$form = $this->prefill_conditional_logic( $form );
1091 1091
 
1092 1092
 		// for now we don't support Save and Continue feature.
1093
-		if( ! self::$supports_save_and_continue ) {
1094
-	        unset( $form['save'] );
1093
+		if ( ! self::$supports_save_and_continue ) {
1094
+	        unset( $form[ 'save' ] );
1095 1095
 		}
1096 1096
 
1097 1097
 		$form = $this->unselect_default_values( $form );
@@ -1114,31 +1114,31 @@  discard block
 block discarded – undo
1114 1114
 	 */
1115 1115
 	public function verify_user_can_edit_post( $field_content = '', $field, $value, $lead_id = 0, $form_id ) {
1116 1116
 
1117
-		if( ! GFCommon::is_post_field( $field ) ) {
1117
+		if ( ! GFCommon::is_post_field( $field ) ) {
1118 1118
 			return $field_content;
1119 1119
 		}
1120 1120
 
1121 1121
         $message = null;
1122 1122
 
1123 1123
         // First, make sure they have the capability to edit the post.
1124
-        if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) {
1124
+        if ( false === current_user_can( 'edit_post', $this->entry[ 'post_id' ] ) ) {
1125 1125
 
1126 1126
             /**
1127 1127
              * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post
1128 1128
              * @param string $message The existing "You don't have permission..." text
1129 1129
              */
1130
-            $message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don&rsquo;t have permission to edit this post.', 'gravityview') );
1130
+            $message = apply_filters( 'gravityview/edit_entry/unsupported_post_field_text', __( 'You don&rsquo;t have permission to edit this post.', 'gravityview' ) );
1131 1131
 
1132
-        } elseif( null === get_post( $this->entry['post_id'] ) ) {
1132
+        } elseif ( null === get_post( $this->entry[ 'post_id' ] ) ) {
1133 1133
             /**
1134 1134
              * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists
1135 1135
              * @param string $message The existing "This field is not editable; the post no longer exists." text
1136 1136
              */
1137
-            $message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) );
1137
+            $message = apply_filters( 'gravityview/edit_entry/no_post_text', __( 'This field is not editable; the post no longer exists.', 'gravityview' ) );
1138 1138
         }
1139 1139
 
1140
-        if( $message ) {
1141
-            $field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1140
+        if ( $message ) {
1141
+            $field_content = sprintf( '<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1142 1142
         }
1143 1143
 
1144 1144
         return $field_content;
@@ -1162,8 +1162,8 @@  discard block
 block discarded – undo
1162 1162
 
1163 1163
 		// If the form has been submitted, then we don't need to pre-fill the values,
1164 1164
 		// Except for fileupload type and when a field input is overridden- run always!!
1165
-		if(
1166
-			( $this->is_edit_entry_submission() && !in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
1165
+		if (
1166
+			( $this->is_edit_entry_submission() && ! in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
1167 1167
 			&& false === ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) )
1168 1168
 			&& ! GFCommon::is_product_field( $field->type )
1169 1169
 			|| ! empty( $field_content )
@@ -1183,7 +1183,7 @@  discard block
 block discarded – undo
1183 1183
 	    $return = null;
1184 1184
 
1185 1185
 		/** @var GravityView_Field $gv_field */
1186
-		if( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1186
+		if ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1187 1187
 			$return = $gv_field->get_field_input( $this->form, $field_value, $this->entry, $field );
1188 1188
 		} else {
1189 1189
 	        $return = $field->get_field_input( $this->form, $field_value, $this->entry );
@@ -1192,7 +1192,7 @@  discard block
 block discarded – undo
1192 1192
 	    // If there was output, it's an error
1193 1193
 	    $warnings = ob_get_clean();
1194 1194
 
1195
-	    if( !empty( $warnings ) ) {
1195
+	    if ( ! empty( $warnings ) ) {
1196 1196
 		    gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1197 1197
 	    }
1198 1198
 
@@ -1217,7 +1217,7 @@  discard block
 block discarded – undo
1217 1217
 		$override_saved_value = apply_filters( 'gravityview/edit_entry/pre_populate/override', false, $field );
1218 1218
 
1219 1219
 		// We're dealing with multiple inputs (e.g. checkbox) but not time or date (as it doesn't store data in input IDs)
1220
-		if( isset( $field->inputs ) && is_array( $field->inputs ) && !in_array( $field->type, array( 'time', 'date' ) ) ) {
1220
+		if ( isset( $field->inputs ) && is_array( $field->inputs ) && ! in_array( $field->type, array( 'time', 'date' ) ) ) {
1221 1221
 
1222 1222
 			$field_value = array();
1223 1223
 
@@ -1226,10 +1226,10 @@  discard block
 block discarded – undo
1226 1226
 
1227 1227
 			foreach ( (array)$field->inputs as $input ) {
1228 1228
 
1229
-				$input_id = strval( $input['id'] );
1229
+				$input_id = strval( $input[ 'id' ] );
1230 1230
 				
1231 1231
 				if ( isset( $this->entry[ $input_id ] ) && ! gv_empty( $this->entry[ $input_id ], false, false ) ) {
1232
-				    $field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1232
+				    $field_value[ $input_id ] = 'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1233 1233
 				    $allow_pre_populated = false;
1234 1234
 				}
1235 1235
 
@@ -1237,7 +1237,7 @@  discard block
 block discarded – undo
1237 1237
 
1238 1238
 			$pre_value = $field->get_value_submission( array(), false );
1239 1239
 
1240
-			$field_value = ! $allow_pre_populated && ! ( $override_saved_value && !gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
1240
+			$field_value = ! $allow_pre_populated && ! ( $override_saved_value && ! gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
1241 1241
 
1242 1242
 		} else {
1243 1243
 
@@ -1248,13 +1248,13 @@  discard block
 block discarded – undo
1248 1248
 
1249 1249
 			// saved field entry value (if empty, fallback to the pre-populated value, if exists)
1250 1250
 			// or pre-populated value if not empty and set to override saved value
1251
-			$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;
1251
+			$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;
1252 1252
 
1253 1253
 			// in case field is post_category but inputType is select, multi-select or radio, convert value into array of category IDs.
1254
-			if ( 'post_category' === $field->type && !gv_empty( $field_value, false, false ) ) {
1254
+			if ( 'post_category' === $field->type && ! gv_empty( $field_value, false, false ) ) {
1255 1255
 				$categories = array();
1256 1256
 				foreach ( explode( ',', $field_value ) as $cat_string ) {
1257
-				    $categories[] = GFCommon::format_post_category( $cat_string, true );
1257
+				    $categories[ ] = GFCommon::format_post_category( $cat_string, true );
1258 1258
 				}
1259 1259
 				$field_value = 'multiselect' === $field->get_input_type() ? $categories : implode( '', $categories );
1260 1260
 			}
@@ -1282,7 +1282,7 @@  discard block
 block discarded – undo
1282 1282
 	     * @param GF_Field $field Gravity Forms field object
1283 1283
 	     * @param GravityView_Edit_Entry_Render $this Current object
1284 1284
 	     */
1285
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1285
+	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type, $field_value, $field, $this );
1286 1286
 
1287 1287
 		return $field_value;
1288 1288
 	}
@@ -1299,12 +1299,12 @@  discard block
 block discarded – undo
1299 1299
 	 */
1300 1300
 	public function gform_pre_validation( $form ) {
1301 1301
 
1302
-		if( ! $this->verify_nonce() ) {
1302
+		if ( ! $this->verify_nonce() ) {
1303 1303
 			return $form;
1304 1304
 		}
1305 1305
 
1306 1306
 		// Fix PHP warning regarding undefined index.
1307
-		foreach ( $form['fields'] as &$field) {
1307
+		foreach ( $form[ 'fields' ] as &$field ) {
1308 1308
 
1309 1309
 			// This is because we're doing admin form pretending to be front-end, so Gravity Forms
1310 1310
 			// expects certain field array items to be set.
@@ -1312,7 +1312,7 @@  discard block
 block discarded – undo
1312 1312
 	            $field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1313 1313
 			}
1314 1314
 
1315
-			switch( RGFormsModel::get_input_type( $field ) ) {
1315
+			switch ( RGFormsModel::get_input_type( $field ) ) {
1316 1316
 
1317 1317
 				/**
1318 1318
 				 * 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.
@@ -1326,26 +1326,26 @@  discard block
 block discarded – undo
1326 1326
 				    // Set the previous value
1327 1327
 				    $entry = $this->get_entry();
1328 1328
 
1329
-				    $input_name = 'input_'.$field->id;
1330
-				    $form_id = $form['id'];
1329
+				    $input_name = 'input_' . $field->id;
1330
+				    $form_id = $form[ 'id' ];
1331 1331
 
1332 1332
 				    $value = NULL;
1333 1333
 
1334 1334
 				    // Use the previous entry value as the default.
1335
-				    if( isset( $entry[ $field->id ] ) ) {
1335
+				    if ( isset( $entry[ $field->id ] ) ) {
1336 1336
 				        $value = $entry[ $field->id ];
1337 1337
 				    }
1338 1338
 
1339 1339
 				    // If this is a single upload file
1340
-				    if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1341
-				        $file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1342
-				        $value = $file_path['url'];
1340
+				    if ( ! empty( $_FILES[ $input_name ] ) && ! empty( $_FILES[ $input_name ][ 'name' ] ) ) {
1341
+				        $file_path = GFFormsModel::get_file_upload_path( $form[ 'id' ], $_FILES[ $input_name ][ 'name' ] );
1342
+				        $value = $file_path[ 'url' ];
1343 1343
 
1344 1344
 				    } else {
1345 1345
 
1346 1346
 				        // Fix PHP warning on line 1498 of form_display.php for post_image fields
1347 1347
 				        // Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1348
-				        $_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1348
+				        $_FILES[ $input_name ] = array( 'name' => '', 'size' => '' );
1349 1349
 
1350 1350
 				    }
1351 1351
 
@@ -1353,10 +1353,10 @@  discard block
 block discarded – undo
1353 1353
 
1354 1354
 				        // If there are fresh uploads, process and merge them.
1355 1355
 				        // Otherwise, use the passed values, which should be json-encoded array of URLs
1356
-				        if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) {
1356
+				        if ( isset( GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] ) ) {
1357 1357
 				            $value = empty( $value ) ? '[]' : $value;
1358 1358
 				            $value = stripslashes_deep( $value );
1359
-				            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array());
1359
+				            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ], array() );
1360 1360
 				        }
1361 1361
 
1362 1362
 				    } else {
@@ -1374,8 +1374,8 @@  discard block
 block discarded – undo
1374 1374
 
1375 1375
 				case 'number':
1376 1376
 				    // Fix "undefined index" issue at line 1286 in form_display.php
1377
-				    if( !isset( $_POST['input_'.$field->id ] ) ) {
1378
-				        $_POST['input_'.$field->id ] = NULL;
1377
+				    if ( ! isset( $_POST[ 'input_' . $field->id ] ) ) {
1378
+				        $_POST[ 'input_' . $field->id ] = NULL;
1379 1379
 				    }
1380 1380
 				    break;
1381 1381
 			}
@@ -1412,7 +1412,7 @@  discard block
 block discarded – undo
1412 1412
 		 * You can enter whatever you want!
1413 1413
 		 * We try validating, and customize the results using `self::custom_validation()`
1414 1414
 		 */
1415
-		add_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10, 4);
1415
+		add_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10, 4 );
1416 1416
 
1417 1417
 		// Needed by the validate funtion
1418 1418
 		$failed_validation_page = NULL;
@@ -1420,14 +1420,14 @@  discard block
 block discarded – undo
1420 1420
 
1421 1421
 		// Prevent entry limit from running when editing an entry, also
1422 1422
 		// prevent form scheduling from preventing editing
1423
-		unset( $this->form['limitEntries'], $this->form['scheduleForm'] );
1423
+		unset( $this->form[ 'limitEntries' ], $this->form[ 'scheduleForm' ] );
1424 1424
 
1425 1425
 		// Hide fields depending on Edit Entry settings
1426
-		$this->form['fields'] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1426
+		$this->form[ 'fields' ] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1427 1427
 
1428 1428
 		$this->is_valid = GFFormDisplay::validate( $this->form, $field_values, 1, $failed_validation_page );
1429 1429
 
1430
-		remove_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10 );
1430
+		remove_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10 );
1431 1431
 	}
1432 1432
 
1433 1433
 
@@ -1450,7 +1450,7 @@  discard block
 block discarded – undo
1450 1450
 
1451 1451
 		$gv_valid = true;
1452 1452
 
1453
-		foreach ( $validation_results['form']['fields'] as $key => &$field ) {
1453
+		foreach ( $validation_results[ 'form' ][ 'fields' ] as $key => &$field ) {
1454 1454
 
1455 1455
 			$value = RGFormsModel::get_field_value( $field );
1456 1456
 			$field_type = RGFormsModel::get_input_type( $field );
@@ -1463,35 +1463,35 @@  discard block
 block discarded – undo
1463 1463
 				case 'post_image':
1464 1464
 
1465 1465
 				    // in case nothing is uploaded but there are already files saved
1466
-				    if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) {
1466
+				    if ( ! empty( $field->failed_validation ) && ! empty( $field->isRequired ) && ! empty( $value ) ) {
1467 1467
 				        $field->failed_validation = false;
1468 1468
 				        unset( $field->validation_message );
1469 1469
 				    }
1470 1470
 
1471 1471
 				    // validate if multi file upload reached max number of files [maxFiles] => 2
1472
-				    if( \GV\Utils::get( $field, 'maxFiles') && \GV\Utils::get( $field, 'multipleFiles') ) {
1472
+				    if ( \GV\Utils::get( $field, 'maxFiles' ) && \GV\Utils::get( $field, 'multipleFiles' ) ) {
1473 1473
 
1474 1474
 				        $input_name = 'input_' . $field->id;
1475 1475
 				        //uploaded
1476
-				        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1476
+				        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] : array();
1477 1477
 
1478 1478
 				        //existent
1479 1479
 				        $entry = $this->get_entry();
1480 1480
 				        $value = NULL;
1481
-				        if( isset( $entry[ $field->id ] ) ) {
1481
+				        if ( isset( $entry[ $field->id ] ) ) {
1482 1482
 				            $value = json_decode( $entry[ $field->id ], true );
1483 1483
 				        }
1484 1484
 
1485 1485
 				        // count uploaded files and existent entry files
1486 1486
 				        $count_files = count( $file_names ) + count( $value );
1487 1487
 
1488
-				        if( $count_files > $field->maxFiles ) {
1488
+				        if ( $count_files > $field->maxFiles ) {
1489 1489
 				            $field->validation_message = __( 'Maximum number of files reached', 'gravityview' );
1490 1490
 				            $field->failed_validation = 1;
1491 1491
 				            $gv_valid = false;
1492 1492
 
1493 1493
 				            // in case of error make sure the newest upload files are removed from the upload input
1494
-				            GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1494
+				            GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ] = null;
1495 1495
 				        }
1496 1496
 
1497 1497
 				    }
@@ -1502,7 +1502,7 @@  discard block
 block discarded – undo
1502 1502
 			}
1503 1503
 
1504 1504
 			// This field has failed validation.
1505
-			if( !empty( $field->failed_validation ) ) {
1505
+			if ( ! empty( $field->failed_validation ) ) {
1506 1506
 
1507 1507
 				gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field is invalid.', array( 'data' => array( 'field' => $field, 'value' => $value ) ) );
1508 1508
 
@@ -1520,19 +1520,19 @@  discard block
 block discarded – undo
1520 1520
 				}
1521 1521
 
1522 1522
 				// You can't continue inside a switch, so we do it after.
1523
-				if( empty( $field->failed_validation ) ) {
1523
+				if ( empty( $field->failed_validation ) ) {
1524 1524
 				    continue;
1525 1525
 				}
1526 1526
 
1527 1527
 				// checks if the No Duplicates option is not validating entry against itself, since
1528 1528
 				// we're editing a stored entry, it would also assume it's a duplicate.
1529
-				if( !empty( $field->noDuplicates ) ) {
1529
+				if ( ! empty( $field->noDuplicates ) ) {
1530 1530
 
1531 1531
 				    $entry = $this->get_entry();
1532 1532
 
1533 1533
 				    // If the value of the entry is the same as the stored value
1534 1534
 				    // Then we can assume it's not a duplicate, it's the same.
1535
-				    if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1535
+				    if ( ! empty( $entry ) && $value == $entry[ $field->id ] ) {
1536 1536
 				        //if value submitted was not changed, then don't validate
1537 1537
 				        $field->failed_validation = false;
1538 1538
 
@@ -1545,7 +1545,7 @@  discard block
 block discarded – undo
1545 1545
 				}
1546 1546
 
1547 1547
 				// if here then probably we are facing the validation 'At least one field must be filled out'
1548
-				if( GFFormDisplay::is_empty( $field, $this->form_id  ) && empty( $field->isRequired ) ) {
1548
+				if ( GFFormDisplay::is_empty( $field, $this->form_id ) && empty( $field->isRequired ) ) {
1549 1549
 				    unset( $field->validation_message );
1550 1550
 	                $field->validation_message = false;
1551 1551
 				    continue;
@@ -1557,12 +1557,12 @@  discard block
 block discarded – undo
1557 1557
 
1558 1558
 		}
1559 1559
 
1560
-		$validation_results['is_valid'] = $gv_valid;
1560
+		$validation_results[ 'is_valid' ] = $gv_valid;
1561 1561
 
1562 1562
 		gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Validation results.', array( 'data' => $validation_results ) );
1563 1563
 
1564 1564
 		// We'll need this result when rendering the form ( on GFFormDisplay::get_form )
1565
-		$this->form_after_validation = $validation_results['form'];
1565
+		$this->form_after_validation = $validation_results[ 'form' ];
1566 1566
 
1567 1567
 		return $validation_results;
1568 1568
 	}
@@ -1575,7 +1575,7 @@  discard block
 block discarded – undo
1575 1575
 	 */
1576 1576
 	public function get_entry() {
1577 1577
 
1578
-		if( empty( $this->entry ) ) {
1578
+		if ( empty( $this->entry ) ) {
1579 1579
 			// Get the database value of the entry that's being edited
1580 1580
 			$this->entry = gravityview_get_entry( GravityView_frontend::is_single_entry() );
1581 1581
 		}
@@ -1607,10 +1607,10 @@  discard block
 block discarded – undo
1607 1607
 		}
1608 1608
 
1609 1609
 		// If edit tab not yet configured, show all fields
1610
-		$edit_fields = !empty( $properties['edit_edit-fields'] ) ? $properties['edit_edit-fields'] : NULL;
1610
+		$edit_fields = ! empty( $properties[ 'edit_edit-fields' ] ) ? $properties[ 'edit_edit-fields' ] : NULL;
1611 1611
 
1612 1612
 		// Hide fields depending on admin settings
1613
-		$fields = $this->filter_fields( $form['fields'], $edit_fields );
1613
+		$fields = $this->filter_fields( $form[ 'fields' ], $edit_fields );
1614 1614
 
1615 1615
 	    // If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1616 1616
 	    $fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
@@ -1642,7 +1642,7 @@  discard block
 block discarded – undo
1642 1642
 	 */
1643 1643
 	private function filter_fields( $fields, $configured_fields ) {
1644 1644
 
1645
-		if( empty( $fields ) || !is_array( $fields ) ) {
1645
+		if ( empty( $fields ) || ! is_array( $fields ) ) {
1646 1646
 			return $fields;
1647 1647
 		}
1648 1648
 
@@ -1655,18 +1655,18 @@  discard block
 block discarded – undo
1655 1655
 
1656 1656
 			// Remove the fields that have calculation properties and keep them to be used later
1657 1657
 			// @since 1.16.2
1658
-			if( $field->has_calculation() ) {
1659
-				$this->fields_with_calculation[] = $field;
1658
+			if ( $field->has_calculation() ) {
1659
+				$this->fields_with_calculation[ ] = $field;
1660 1660
 				// don't remove the calculation fields on form render.
1661 1661
 			}
1662 1662
 
1663
-			if( in_array( $field->type, $field_type_blacklist ) ) {
1663
+			if ( in_array( $field->type, $field_type_blacklist ) ) {
1664 1664
 				unset( $fields[ $key ] );
1665 1665
 			}
1666 1666
 		}
1667 1667
 
1668 1668
 		// The Edit tab has not been configured, so we return all fields by default.
1669
-		if( empty( $configured_fields ) ) {
1669
+		if ( empty( $configured_fields ) ) {
1670 1670
 			return $fields;
1671 1671
 		}
1672 1672
 
@@ -1675,8 +1675,8 @@  discard block
 block discarded – undo
1675 1675
 
1676 1676
 	        /** @var GF_Field $field */
1677 1677
 	        foreach ( $fields as $field ) {
1678
-				if( intval( $configured_field['id'] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1679
-				    $edit_fields[] = $this->merge_field_properties( $field, $configured_field );
1678
+				if ( intval( $configured_field[ 'id' ] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1679
+				    $edit_fields[ ] = $this->merge_field_properties( $field, $configured_field );
1680 1680
 				    break;
1681 1681
 				}
1682 1682
 
@@ -1699,14 +1699,14 @@  discard block
 block discarded – undo
1699 1699
 
1700 1700
 		$return_field = $field;
1701 1701
 
1702
-		if( empty( $field_setting['show_label'] ) ) {
1702
+		if ( empty( $field_setting[ 'show_label' ] ) ) {
1703 1703
 			$return_field->label = '';
1704
-		} elseif ( !empty( $field_setting['custom_label'] ) ) {
1705
-			$return_field->label = $field_setting['custom_label'];
1704
+		} elseif ( ! empty( $field_setting[ 'custom_label' ] ) ) {
1705
+			$return_field->label = $field_setting[ 'custom_label' ];
1706 1706
 		}
1707 1707
 
1708
-		if( !empty( $field_setting['custom_class'] ) ) {
1709
-			$return_field->cssClass .= ' '. gravityview_sanitize_html_class( $field_setting['custom_class'] );
1708
+		if ( ! empty( $field_setting[ 'custom_class' ] ) ) {
1709
+			$return_field->cssClass .= ' ' . gravityview_sanitize_html_class( $field_setting[ 'custom_class' ] );
1710 1710
 		}
1711 1711
 
1712 1712
 		/**
@@ -1744,16 +1744,16 @@  discard block
 block discarded – undo
1744 1744
 	     */
1745 1745
 	    $use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
1746 1746
 
1747
-	    if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
1748
-			foreach( $fields as $k => $field ) {
1749
-				if( $field->adminOnly ) {
1747
+	    if ( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry[ 'id' ] ) ) {
1748
+			foreach ( $fields as $k => $field ) {
1749
+				if ( $field->adminOnly ) {
1750 1750
 				    unset( $fields[ $k ] );
1751 1751
 				}
1752 1752
 			}
1753 1753
 			return $fields;
1754 1754
 		}
1755 1755
 
1756
-	    foreach( $fields as &$field ) {
1756
+	    foreach ( $fields as &$field ) {
1757 1757
 		    $field->adminOnly = false;
1758 1758
 		}
1759 1759
 
@@ -1774,7 +1774,7 @@  discard block
 block discarded – undo
1774 1774
 	 */
1775 1775
 	private function unselect_default_values( $form ) {
1776 1776
 
1777
-	    foreach ( $form['fields'] as &$field ) {
1777
+	    foreach ( $form[ 'fields' ] as &$field ) {
1778 1778
 
1779 1779
 			if ( empty( $field->choices ) ) {
1780 1780
                 continue;
@@ -1782,7 +1782,7 @@  discard block
 block discarded – undo
1782 1782
 
1783 1783
             foreach ( $field->choices as &$choice ) {
1784 1784
 				if ( \GV\Utils::get( $choice, 'isSelected' ) ) {
1785
-					$choice['isSelected'] = false;
1785
+					$choice[ 'isSelected' ] = false;
1786 1786
 				}
1787 1787
 			}
1788 1788
 		}
@@ -1807,22 +1807,22 @@  discard block
 block discarded – undo
1807 1807
 	 */
1808 1808
 	function prefill_conditional_logic( $form ) {
1809 1809
 
1810
-		if( ! GFFormDisplay::has_conditional_logic( $form ) ) {
1810
+		if ( ! GFFormDisplay::has_conditional_logic( $form ) ) {
1811 1811
 			return $form;
1812 1812
 		}
1813 1813
 
1814 1814
 		// Have Conditional Logic pre-fill fields as if the data were default values
1815 1815
 		/** @var GF_Field $field */
1816
-		foreach ( $form['fields'] as &$field ) {
1816
+		foreach ( $form[ 'fields' ] as &$field ) {
1817 1817
 
1818
-			if( 'checkbox' === $field->type ) {
1818
+			if ( 'checkbox' === $field->type ) {
1819 1819
 				foreach ( $field->get_entry_inputs() as $key => $input ) {
1820
-				    $input_id = $input['id'];
1820
+				    $input_id = $input[ 'id' ];
1821 1821
 				    $choice = $field->choices[ $key ];
1822 1822
 				    $value = \GV\Utils::get( $this->entry, $input_id );
1823 1823
 				    $match = RGFormsModel::choice_value_match( $field, $choice, $value );
1824
-				    if( $match ) {
1825
-				        $field->choices[ $key ]['isSelected'] = true;
1824
+				    if ( $match ) {
1825
+				        $field->choices[ $key ][ 'isSelected' ] = true;
1826 1826
 				    }
1827 1827
 				}
1828 1828
 			} else {
@@ -1830,15 +1830,15 @@  discard block
 block discarded – undo
1830 1830
 				// We need to run through each field to set the default values
1831 1831
 				foreach ( $this->entry as $field_id => $field_value ) {
1832 1832
 
1833
-				    if( floatval( $field_id ) === floatval( $field->id ) ) {
1833
+				    if ( floatval( $field_id ) === floatval( $field->id ) ) {
1834 1834
 
1835
-				        if( 'list' === $field->type ) {
1835
+				        if ( 'list' === $field->type ) {
1836 1836
 				            $list_rows = maybe_unserialize( $field_value );
1837 1837
 
1838 1838
 				            $list_field_value = array();
1839
-				            foreach ( (array) $list_rows as $row ) {
1840
-				                foreach ( (array) $row as $column ) {
1841
-				                    $list_field_value[] = $column;
1839
+				            foreach ( (array)$list_rows as $row ) {
1840
+				                foreach ( (array)$row as $column ) {
1841
+				                    $list_field_value[ ] = $column;
1842 1842
 				                }
1843 1843
 				            }
1844 1844
 
@@ -1873,16 +1873,16 @@  discard block
 block discarded – undo
1873 1873
 		 */
1874 1874
 		$use_conditional_logic = apply_filters( 'gravityview/edit_entry/conditional_logic', true, $form );
1875 1875
 
1876
-		if( $use_conditional_logic ) {
1876
+		if ( $use_conditional_logic ) {
1877 1877
 			return $form;
1878 1878
 		}
1879 1879
 
1880
-		foreach( $form['fields'] as &$field ) {
1880
+		foreach ( $form[ 'fields' ] as &$field ) {
1881 1881
 			/* @var GF_Field $field */
1882 1882
 			$field->conditionalLogic = null;
1883 1883
 		}
1884 1884
 
1885
-		unset( $form['button']['conditionalLogic'] );
1885
+		unset( $form[ 'button' ][ 'conditionalLogic' ] );
1886 1886
 
1887 1887
 		return $form;
1888 1888
 
@@ -1899,7 +1899,7 @@  discard block
 block discarded – undo
1899 1899
 	 */
1900 1900
 	public function manage_conditional_logic( $has_conditional_logic, $form ) {
1901 1901
 
1902
-		if( ! $this->is_edit_entry() ) {
1902
+		if ( ! $this->is_edit_entry() ) {
1903 1903
 			return $has_conditional_logic;
1904 1904
 		}
1905 1905
 
@@ -1931,44 +1931,44 @@  discard block
 block discarded – undo
1931 1931
 		 *  2. There are two entries embedded using oEmbed
1932 1932
 		 *  3. One of the entries has just been saved
1933 1933
 		 */
1934
-		if( !empty( $_POST['lid'] ) && !empty( $_GET['entry'] ) && ( $_POST['lid'] !== $_GET['entry'] ) ) {
1934
+		if ( ! empty( $_POST[ 'lid' ] ) && ! empty( $_GET[ 'entry' ] ) && ( $_POST[ 'lid' ] !== $_GET[ 'entry' ] ) ) {
1935 1935
 
1936 1936
 			$error = true;
1937 1937
 
1938 1938
 		}
1939 1939
 
1940
-		if( !empty( $_GET['entry'] ) && (string)$this->entry['id'] !== $_GET['entry'] ) {
1940
+		if ( ! empty( $_GET[ 'entry' ] ) && (string)$this->entry[ 'id' ] !== $_GET[ 'entry' ] ) {
1941 1941
 
1942 1942
 			$error = true;
1943 1943
 
1944
-		} elseif( ! $this->verify_nonce() ) {
1944
+		} elseif ( ! $this->verify_nonce() ) {
1945 1945
 
1946 1946
 			/**
1947 1947
 			 * If the Entry is embedded, there may be two entries on the same page.
1948 1948
 			 * If that's the case, and one is being edited, the other should fail gracefully and not display an error.
1949 1949
 			 */
1950
-			if( GravityView_oEmbed::getInstance()->get_entry_id() ) {
1950
+			if ( GravityView_oEmbed::getInstance()->get_entry_id() ) {
1951 1951
 				$error = true;
1952 1952
 			} else {
1953
-				$error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview');
1953
+				$error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview' );
1954 1954
 			}
1955 1955
 
1956 1956
 		}
1957 1957
 
1958
-		if( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
1959
-			$error = __( 'You do not have permission to edit this entry.', 'gravityview');
1958
+		if ( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
1959
+			$error = __( 'You do not have permission to edit this entry.', 'gravityview' );
1960 1960
 		}
1961 1961
 
1962
-		if( $this->entry['status'] === 'trash' ) {
1963
-			$error = __('You cannot edit the entry; it is in the trash.', 'gravityview' );
1962
+		if ( $this->entry[ 'status' ] === 'trash' ) {
1963
+			$error = __( 'You cannot edit the entry; it is in the trash.', 'gravityview' );
1964 1964
 		}
1965 1965
 
1966 1966
 		// No errors; everything's fine here!
1967
-		if( empty( $error ) ) {
1967
+		if ( empty( $error ) ) {
1968 1968
 			return true;
1969 1969
 		}
1970 1970
 
1971
-		if( $echo && $error !== true ) {
1971
+		if ( $echo && $error !== true ) {
1972 1972
 
1973 1973
 	        $error = esc_html( $error );
1974 1974
 
@@ -1976,10 +1976,10 @@  discard block
 block discarded – undo
1976 1976
 	         * @since 1.9
1977 1977
 	         */
1978 1978
 	        if ( ! empty( $this->entry ) ) {
1979
-		        $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;" ) );
1979
+		        $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;" ) );
1980 1980
 	        }
1981 1981
 
1982
-			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error');
1982
+			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error' );
1983 1983
 		}
1984 1984
 
1985 1985
 		gravityview()->log->error( '{error}', array( 'error' => $error ) );
@@ -1999,17 +1999,17 @@  discard block
 block discarded – undo
1999 1999
 
2000 2000
 		$error = NULL;
2001 2001
 
2002
-		if( ! $this->check_user_cap_edit_field( $field ) ) {
2003
-			$error = __( 'You do not have permission to edit this field.', 'gravityview');
2002
+		if ( ! $this->check_user_cap_edit_field( $field ) ) {
2003
+			$error = __( 'You do not have permission to edit this field.', 'gravityview' );
2004 2004
 		}
2005 2005
 
2006 2006
 		// No errors; everything's fine here!
2007
-		if( empty( $error ) ) {
2007
+		if ( empty( $error ) ) {
2008 2008
 			return true;
2009 2009
 		}
2010 2010
 
2011
-		if( $echo ) {
2012
-			echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error');
2011
+		if ( $echo ) {
2012
+			echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error' );
2013 2013
 		}
2014 2014
 
2015 2015
 		gravityview()->log->error( '{error}', array( 'error' => $error ) );
@@ -2030,14 +2030,14 @@  discard block
 block discarded – undo
2030 2030
 	private function check_user_cap_edit_field( $field ) {
2031 2031
 
2032 2032
 		// If they can edit any entries (as defined in Gravity Forms), we're good.
2033
-		if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
2033
+		if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
2034 2034
 			return true;
2035 2035
 		}
2036 2036
 
2037
-		$field_cap = isset( $field['allow_edit_cap'] ) ? $field['allow_edit_cap'] : false;
2037
+		$field_cap = isset( $field[ 'allow_edit_cap' ] ) ? $field[ 'allow_edit_cap' ] : false;
2038 2038
 
2039
-		if( $field_cap ) {
2040
-			return GVCommon::has_cap( $field['allow_edit_cap'] );
2039
+		if ( $field_cap ) {
2040
+			return GVCommon::has_cap( $field[ 'allow_edit_cap' ] );
2041 2041
 		}
2042 2042
 
2043 2043
 		return false;
@@ -2051,17 +2051,17 @@  discard block
 block discarded – undo
2051 2051
 	public function verify_nonce() {
2052 2052
 
2053 2053
 		// Verify form submitted for editing single
2054
-		if( $this->is_edit_entry_submission() ) {
2054
+		if ( $this->is_edit_entry_submission() ) {
2055 2055
 			$valid = wp_verify_nonce( $_POST[ self::$nonce_field ], self::$nonce_field );
2056 2056
 		}
2057 2057
 
2058 2058
 		// Verify
2059
-		else if( ! $this->is_edit_entry() ) {
2059
+		else if ( ! $this->is_edit_entry() ) {
2060 2060
 			$valid = false;
2061 2061
 		}
2062 2062
 
2063 2063
 		else {
2064
-			$valid = wp_verify_nonce( $_GET['edit'], self::$nonce_key );
2064
+			$valid = wp_verify_nonce( $_GET[ 'edit' ], self::$nonce_key );
2065 2065
 		}
2066 2066
 
2067 2067
 		/**
Please login to merge, or discard this patch.
future/includes/class-gv-view.php 1 patch
Spacing   +25 added lines, -26 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 		$supports = array( 'title', 'revisions' );
109 109
 
110 110
 		if ( $is_hierarchical ) {
111
-			$supports[] = 'page-attributes';
111
+			$supports[ ] = 'page-attributes';
112 112
 		}
113 113
 
114 114
 		/**
@@ -210,11 +210,11 @@  discard block
 block discarded – undo
210 210
 		$rule = array( sprintf( '%s/([^/]+)/csv/?', $slug ), 'index.php?gravityview=$matches[1]&csv=1', 'top' );
211 211
 
212 212
 		add_filter( 'query_vars', function( $query_vars ) { 
213
-			$query_vars[] = 'csv';
213
+			$query_vars[ ] = 'csv';
214 214
 			return $query_vars;
215 215
 		} );
216 216
 
217
-		if ( ! isset( $wp_rewrite->extra_rules_top[ $rule[0] ] ) ) {
217
+		if ( ! isset( $wp_rewrite->extra_rules_top[ $rule[ 0 ] ] ) ) {
218 218
 			call_user_func_array( 'add_rewrite_rule', $rule );
219 219
 		}
220 220
 	}
@@ -283,13 +283,13 @@  discard block
 block discarded – undo
283 283
 			return $content;
284 284
 		}
285 285
 
286
-		$is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap('gravityview_moderate_entries', $view->ID );
286
+		$is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap( 'gravityview_moderate_entries', $view->ID );
287 287
 
288 288
 		/**
289 289
 		 * Editing a single entry.
290 290
 		 */
291 291
 		if ( $entry = $request->is_edit_entry( $view->form ? $view->form->ID : 0 ) ) {
292
-			if ( $entry['status'] != 'active' ) {
292
+			if ( $entry[ 'status' ] != 'active' ) {
293 293
 				gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) );
294 294
 				return __( 'You are not allowed to view this content.', 'gravityview' );
295 295
 			}
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 			}
301 301
 
302 302
 			if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) {
303
-				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) )  ) {
303
+				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) {
304 304
 					gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) );
305 305
 					return __( 'You are not allowed to view this content.', 'gravityview' );
306 306
 				}
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 		 * Viewing a single entry.
314 314
 		 */
315 315
 		} else if ( $entry = $request->is_entry( $view->form ? $view->form->ID : 0 ) ) {
316
-			if ( $entry['status'] != 'active' ) {
316
+			if ( $entry[ 'status' ] != 'active' ) {
317 317
 				gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) );
318 318
 				return __( 'You are not allowed to view this content.', 'gravityview' );
319 319
 			}
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 			}
325 325
 
326 326
 			if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) {
327
-				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) )  ) {
327
+				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) {
328 328
 					gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) );
329 329
 					return __( 'You are not allowed to view this content.', 'gravityview' );
330 330
 				}
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 
333 333
 			$error = \GVCommon::check_entry_display( $entry->as_entry(), $view );
334 334
 
335
-			if( is_wp_error( $error ) ) {
335
+			if ( is_wp_error( $error ) ) {
336 336
 				gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing: {message}', array( 'entry_id' => $entry->ID, 'message' => $error->get_error_message() ) );
337 337
 				return __( 'You are not allowed to view this content.', 'gravityview' );
338 338
 			}
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
 			$join_column    = is_numeric( $join_column ) ? GF_Field::by_id( $join, $join_column ) : Internal_Field( $join_column );
502 502
 			$join_on_column = is_numeric( $join_on_column ) ? GF_Field::by_id( $join_on, $join_on_column ) : Internal_Field( $join_on_column );
503 503
 
504
-			$joins [] = new Join( $join, $join_column, $join_on, $join_on_column );
504
+			$joins [ ] = new Join( $join, $join_column, $join_on, $join_on_column );
505 505
 		}
506 506
 
507 507
 		return $joins;
@@ -543,10 +543,10 @@  discard block
 block discarded – undo
543 543
 
544 544
 			list( $join, $join_column, $join_on, $join_on_column ) = $meta;
545 545
 
546
-			$forms_ids [] = GF_Form::by_id( $join_on );
546
+			$forms_ids [ ] = GF_Form::by_id( $join_on );
547 547
 		}
548 548
 
549
-		return ( !empty( $forms_ids) ) ? $forms_ids : null;
549
+		return ( ! empty( $forms_ids ) ) ? $forms_ids : null;
550 550
 	}
551 551
 
552 552
 	/**
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
 		if ( ! $view->form ) {
585 585
 			gravityview()->log->error( 'View #{view_id} tried attaching non-existent Form #{form_id} to it.', array(
586 586
 				'view_id' => $view->ID,
587
-				'form_id' => $view->_gravityview_form_id ? : 0,
587
+				'form_id' => $view->_gravityview_form_id ?: 0,
588 588
 			) );
589 589
 		}
590 590
 
@@ -817,28 +817,27 @@  discard block
 block discarded – undo
817 817
 			 * @todo: Stop using _frontend and use something like $request->get_search_criteria() instead
818 818
 			 */
819 819
 			$parameters = \GravityView_frontend::get_view_entries_parameters( $this->settings->as_atts(), $this->form->ID );
820
-			$parameters['context_view_id'] = $this->ID;
820
+			$parameters[ 'context_view_id' ] = $this->ID;
821 821
 			$parameters = \GVCommon::calculate_get_entries_criteria( $parameters, $this->form->ID );
822 822
 
823 823
 			if ( $request instanceof REST\Request ) {
824 824
 				$atts = $this->settings->as_atts();
825 825
 				$paging_parameters = wp_parse_args( $request->get_paging(), array(
826
-						'paging' => array( 'page_size' => $atts['page_size'] ),
826
+						'paging' => array( 'page_size' => $atts[ 'page_size' ] ),
827 827
 					) );
828
-				$parameters['paging'] = $paging_parameters['paging'];
828
+				$parameters[ 'paging' ] = $paging_parameters[ 'paging' ];
829 829
 			}
830 830
 
831
-			$page = Utils::get( $parameters['paging'], 'current_page' ) ?
832
-				: ( ( ( $parameters['paging']['offset'] - $this->settings->get( 'offset' ) ) / $parameters['paging']['page_size'] ) + 1 );
831
+			$page = Utils::get( $parameters[ 'paging' ], 'current_page' ) ?: ( ( ( $parameters[ 'paging' ][ 'offset' ] - $this->settings->get( 'offset' ) ) / $parameters[ 'paging' ][ 'page_size' ] ) + 1 );
833 832
 
834 833
 			if ( gravityview()->plugin->supports( Plugin::FEATURE_GFQUERY ) ) {
835 834
 				/**
836 835
 				 * New \GF_Query stuff :)
837 836
 				 */
838
-				$query = new \GF_Query( $this->form->ID, $parameters['search_criteria'], $parameters['sorting'] );
837
+				$query = new \GF_Query( $this->form->ID, $parameters[ 'search_criteria' ], $parameters[ 'sorting' ] );
839 838
 
840
-				$query->limit( $parameters['paging']['page_size'] )
841
-					->offset( ( ( $page - 1 ) * $parameters['paging']['page_size'] ) + $this->settings->get( 'offset' ) );
839
+				$query->limit( $parameters[ 'paging' ][ 'page_size' ] )
840
+					->offset( ( ( $page - 1 ) * $parameters[ 'paging' ][ 'page_size' ] ) + $this->settings->get( 'offset' ) );
842 841
 
843 842
 				/**
844 843
 				 * Any joins?
@@ -878,15 +877,15 @@  discard block
 block discarded – undo
878 877
 				} );
879 878
 			} else {
880 879
 				$entries = $this->form->entries
881
-					->filter( \GV\GF_Entry_Filter::from_search_criteria( $parameters['search_criteria'] ) )
880
+					->filter( \GV\GF_Entry_Filter::from_search_criteria( $parameters[ 'search_criteria' ] ) )
882 881
 					->offset( $this->settings->get( 'offset' ) )
883
-					->limit( $parameters['paging']['page_size'] )
882
+					->limit( $parameters[ 'paging' ][ 'page_size' ] )
884 883
 					->page( $page );
885 884
 
886
-				if ( ! empty( $parameters['sorting'] ) && ! empty( $parameters['sorting']['key'] ) ) {
885
+				if ( ! empty( $parameters[ 'sorting' ] ) && ! empty( $parameters[ 'sorting' ][ 'key' ] ) ) {
887 886
 					$field = new \GV\Field();
888
-					$field->ID = $parameters['sorting']['key'];
889
-					$direction = strtolower( $parameters['sorting']['direction'] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC;
887
+					$field->ID = $parameters[ 'sorting' ][ 'key' ];
888
+					$direction = strtolower( $parameters[ 'sorting' ][ 'direction' ] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC;
890 889
 					$entries = $entries->sort( new \GV\Entry_Sort( $field, $direction ) );
891 890
 				}
892 891
 			}
Please login to merge, or discard this patch.
future/includes/class-gv-renderer.php 1 patch
Spacing   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -40,8 +40,7 @@  discard block
 block discarded – undo
40 40
 				$tab = __( 'Edit Entry', 'gravityview' );
41 41
 				$context = 'edit';
42 42
 				break;
43
-			case ( $gravityview->request->is_entry( $gravityview->view->form ? $gravityview->view->form->ID : 0 ) ):
44
-				$tab = __( 'Single Entry', 'gravityview' );
43
+			case ( $gravityview->request->is_entry( $gravityview->view->form ? $gravityview->view->form->ID : 0 ) ) : $tab = __( 'Single Entry', 'gravityview' );
45 44
 				$context = 'single';
46 45
 				break;
47 46
 			default:
@@ -61,7 +60,7 @@  discard block
 block discarded – undo
61 60
 		$action_text = sprintf( esc_html__( 'Add fields to %s', 'gravityview' ), $tab );
62 61
 		$message = esc_html__( 'You can only see this message because you are able to edit this View.', 'gravityview' );
63 62
 
64
-		$image =  sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', $tab, esc_url( plugins_url( sprintf( 'assets/images/tab-%s.png', $context ), GRAVITYVIEW_FILE ) ) );
63
+		$image = sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', $tab, esc_url( plugins_url( sprintf( 'assets/images/tab-%s.png', $context ), GRAVITYVIEW_FILE ) ) );
65 64
 		$output = sprintf( '<h3>%s <strong><a href="%s">%s</a></strong></h3><p>%s</p>', $title, esc_url( $edit_link ), $action_text, $message );
66 65
 
67 66
 		echo \GVCommon::generate_notice( $output . $image, 'gv-error error', 'edit_gravityview', $gravityview->view->ID );
Please login to merge, or discard this patch.
future/includes/class-gv-shortcode-gravityview.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
 			'detail' => null,
42 42
 		) );
43 43
 		
44
-		if ( ! $view_id = $atts['id'] ? : $atts['view_id'] ) {
45
-			if ( $atts['detail'] && $view = $request->is_view() ) {
44
+		if ( ! $view_id = $atts[ 'id' ] ?: $atts[ 'view_id' ] ) {
45
+			if ( $atts[ 'detail' ] && $view = $request->is_view() ) {
46 46
 				$view_id = $view->ID;
47 47
 			}
48 48
 		}
@@ -111,12 +111,12 @@  discard block
 block discarded – undo
111 111
 			}
112 112
 		}
113 113
 
114
-		$is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap('gravityview_moderate_entries', $view->ID );
114
+		$is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap( 'gravityview_moderate_entries', $view->ID );
115 115
 
116 116
 		/**
117 117
 		 * View details.
118 118
 		 */
119
-		if ( $atts['detail'] ) {
119
+		if ( $atts[ 'detail' ] ) {
120 120
 			$entries = $view->get_entries( $request );
121 121
 			return self::_return( $this->detail( $view, $entries, $atts ) );
122 122
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 				return self::_return( '' );
134 134
 			}
135 135
 
136
-			if ( $entry['status'] != 'active' ) {
136
+			if ( $entry[ 'status' ] != 'active' ) {
137 137
 				gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) );
138 138
 				return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) );
139 139
 			}
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 			}
145 145
 
146 146
 			if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) {
147
-				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) )  ) {
147
+				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) {
148 148
 					gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) );
149 149
 					return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) );
150 150
 				}
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 				return self::_return( '' );
165 165
 			}
166 166
 
167
-			if ( $entry['status'] != 'active' ) {
167
+			if ( $entry[ 'status' ] != 'active' ) {
168 168
 				gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) );
169 169
 				return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) );
170 170
 			}
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 			}
176 176
 
177 177
 			if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) {
178
-				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) )  ) {
178
+				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) {
179 179
 					gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) );
180 180
 					return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) );
181 181
 				}
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 
184 184
 			$error = \GVCommon::check_entry_display( $entry->as_entry(), $view );
185 185
 
186
-			if( is_wp_error( $error ) ) {
186
+			if ( is_wp_error( $error ) ) {
187 187
 				gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing: {message}', array( 'entry_id' => $entry->ID, 'message' => $error->get_error_message() ) );
188 188
 				return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) );
189 189
 			}
@@ -199,10 +199,10 @@  discard block
 block discarded – undo
199 199
 				
200 200
 				// Mock the request with the actual View, not the global one
201 201
 				$mock_request = new \GV\Mock_Request();
202
-				$mock_request->returns['is_view'] = $view;
203
-				$mock_request->returns['is_entry'] = $request->is_entry( $view->form ? $view->form->ID : 0 );
204
-				$mock_request->returns['is_edit_entry'] = $request->is_edit_entry( $view->form ? $view->form->ID : 0 );
205
-				$mock_request->returns['is_search'] = $request->is_search();
202
+				$mock_request->returns[ 'is_view' ] = $view;
203
+				$mock_request->returns[ 'is_entry' ] = $request->is_entry( $view->form ? $view->form->ID : 0 );
204
+				$mock_request->returns[ 'is_edit_entry' ] = $request->is_edit_entry( $view->form ? $view->form->ID : 0 );
205
+				$mock_request->returns[ 'is_search' ] = $request->is_search();
206 206
 
207 207
 				$request = $mock_request;
208 208
 			}
@@ -238,16 +238,16 @@  discard block
 block discarded – undo
238 238
 		$filtered_atts = shortcode_atts( $supported_atts, $passed_atts, 'gravityview' );
239 239
 
240 240
 		// Only keep the passed attributes after making sure that they're valid pairs
241
-		$filtered_atts = array_intersect_key( (array) $passed_atts, $filtered_atts );
241
+		$filtered_atts = array_intersect_key( (array)$passed_atts, $filtered_atts );
242 242
 
243 243
 		$atts = array();
244 244
 
245
-		foreach( $filtered_atts as $key => $passed_value ) {
245
+		foreach ( $filtered_atts as $key => $passed_value ) {
246 246
 
247 247
 			// Allow using GravityView merge tags in shortcode attributes, like {get} and {created_by}
248 248
 			$passed_value = \GravityView_Merge_Tags::replace_variables( $passed_value );
249 249
 
250
-			switch( $defaults[ $key ]['type'] ) {
250
+			switch ( $defaults[ $key ][ 'type' ] ) {
251 251
 
252 252
 				/**
253 253
 				 * Make sure number fields are numeric.
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 				 * @see http://php.net/manual/en/function.is-numeric.php#107326
256 256
 				 */
257 257
 				case 'number':
258
-					if( is_numeric( $passed_value ) ) {
258
+					if ( is_numeric( $passed_value ) ) {
259 259
 						$atts[ $key ] = ( $passed_value + 0 );
260 260
 					}
261 261
 					break;
@@ -270,8 +270,8 @@  discard block
 block discarded – undo
270 270
 				 */
271 271
 				case 'select':
272 272
 				case 'radio':
273
-					$options = isset( $defaults[ $key ]['choices'] ) ? $defaults[ $key ]['choices'] : $defaults[ $key ]['options'];
274
-					if( in_array( $passed_value, array_keys( $options ) ) ) {
273
+					$options = isset( $defaults[ $key ][ 'choices' ] ) ? $defaults[ $key ][ 'choices' ] : $defaults[ $key ][ 'options' ];
274
+					if ( in_array( $passed_value, array_keys( $options ) ) ) {
275 275
 						$atts[ $key ] = $passed_value;
276 276
 					}
277 277
 					break;
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 			}
284 284
 		}
285 285
 
286
-		$atts['detail'] = \GV\Utils::get( $passed_atts, 'detail', null );
286
+		$atts[ 'detail' ] = \GV\Utils::get( $passed_atts, 'detail', null );
287 287
 
288 288
 		return $atts;
289 289
 	}
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 	private function detail( $view, $entries, $atts ) {
301 301
 		$output = '';
302 302
 
303
-		switch ( $key = $atts['detail'] ):
303
+		switch ( $key = $atts[ 'detail' ] ):
304 304
 			case 'total_entries':
305 305
 				$output = number_format_i18n( $entries->total() );
306 306
 				break;
Please login to merge, or discard this patch.
includes/widgets/search-widget/class-search-widget.php 1 patch
Spacing   +114 added lines, -114 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 				'type' => 'radio',
65 65
 				'full_width' => true,
66 66
 				'label' => esc_html__( 'Search Mode', 'gravityview' ),
67
-				'desc' => __('Should search results match all search fields, or any?', 'gravityview'),
67
+				'desc' => __( 'Should search results match all search fields, or any?', 'gravityview' ),
68 68
 				'value' => 'any',
69 69
 				'class' => 'hide-if-js',
70 70
 				'options' => array(
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 
87 87
 			// admin - add scripts - run at 1100 to make sure GravityView_Admin_Views::add_scripts_and_styles() runs first at 999
88 88
 			add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 1100 );
89
-			add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts') );
89
+			add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) );
90 90
 			add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) );
91 91
 
92 92
 			// ajax - get the searchable fields
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 		$script_min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
225 225
 		$script_source = empty( $script_min ) ? '/source' : '';
226 226
 
227
-		wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js'.$script_source.'/admin-search-widget'.$script_min.'.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), \GV\Plugin::$version );
227
+		wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js' . $script_source . '/admin-search-widget' . $script_min . '.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), \GV\Plugin::$version );
228 228
 
229 229
 		wp_localize_script( 'gravityview_searchwidget_admin', 'gvSearchVar', array(
230 230
 			'nonce' => wp_create_nonce( 'gravityview_ajaxsearchwidget' ),
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 	 * @return array Scripts allowed in no-conflict mode, plus the search widget script
247 247
 	 */
248 248
 	public function register_no_conflict( $allowed ) {
249
-		$allowed[] = 'gravityview_searchwidget_admin';
249
+		$allowed[ ] = 'gravityview_searchwidget_admin';
250 250
 		return $allowed;
251 251
 	}
252 252
 
@@ -259,24 +259,24 @@  discard block
 block discarded – undo
259 259
 	 */
260 260
 	public static function get_searchable_fields() {
261 261
 
262
-		if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxsearchwidget' ) ) {
262
+		if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxsearchwidget' ) ) {
263 263
 			exit( '0' );
264 264
 		}
265 265
 
266 266
 		$form = '';
267 267
 
268 268
 		// Fetch the form for the current View
269
-		if ( ! empty( $_POST['view_id'] ) ) {
269
+		if ( ! empty( $_POST[ 'view_id' ] ) ) {
270 270
 
271
-			$form = gravityview_get_form_id( $_POST['view_id'] );
271
+			$form = gravityview_get_form_id( $_POST[ 'view_id' ] );
272 272
 
273
-		} elseif ( ! empty( $_POST['formid'] ) ) {
273
+		} elseif ( ! empty( $_POST[ 'formid' ] ) ) {
274 274
 
275
-			$form = (int) $_POST['formid'];
275
+			$form = (int)$_POST[ 'formid' ];
276 276
 
277
-		} elseif ( ! empty( $_POST['template_id'] ) && class_exists( 'GravityView_Ajax' ) ) {
277
+		} elseif ( ! empty( $_POST[ 'template_id' ] ) && class_exists( 'GravityView_Ajax' ) ) {
278 278
 
279
-			$form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] );
279
+			$form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] );
280 280
 
281 281
 		}
282 282
 
@@ -325,8 +325,8 @@  discard block
 block discarded – undo
325 325
 			),
326 326
 		);
327 327
 
328
-		foreach( $custom_fields as $custom_field_key => $custom_field ) {
329
-			$output .= sprintf( '<option value="%s" %s data-inputtypes="%s" data-placeholder="%s">%s</option>', $custom_field_key, selected( $custom_field_key, $current, false ), $custom_field['type'], self::get_field_label( array('field' => $custom_field_key ) ), $custom_field['text'] );
328
+		foreach ( $custom_fields as $custom_field_key => $custom_field ) {
329
+			$output .= sprintf( '<option value="%s" %s data-inputtypes="%s" data-placeholder="%s">%s</option>', $custom_field_key, selected( $custom_field_key, $current, false ), $custom_field[ 'type' ], self::get_field_label( array( 'field' => $custom_field_key ) ), $custom_field[ 'text' ] );
330 330
 		}
331 331
 
332 332
 		// Get fields with sub-inputs and no parent
@@ -348,13 +348,13 @@  discard block
 block discarded – undo
348 348
 
349 349
 			foreach ( $fields as $id => $field ) {
350 350
 
351
-				if ( in_array( $field['type'], $blacklist_field_types ) ) {
351
+				if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
352 352
 					continue;
353 353
 				}
354 354
 
355
-				$types = self::get_search_input_types( $id, $field['type'] );
355
+				$types = self::get_search_input_types( $id, $field[ 'type' ] );
356 356
 
357
-				$output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'data-inputtypes="'. esc_attr( $types ) .'">'. esc_html( $field['label'] ) .'</option>';
357
+				$output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . 'data-inputtypes="' . esc_attr( $types ) . '">' . esc_html( $field[ 'label' ] ) . '</option>';
358 358
 			}
359 359
 		}
360 360
 
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 	public static function get_search_input_types( $field_id = '', $field_type = null ) {
378 378
 
379 379
 		// @todo - This needs to be improved - many fields have . including products and addresses
380
-		if ( false !== strpos( (string) $field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) {
380
+		if ( false !== strpos( (string)$field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) {
381 381
 			$input_type = 'boolean'; // on/off checkbox
382 382
 		} elseif ( in_array( $field_type, array( 'checkbox', 'post_category', 'multiselect' ) ) ) {
383 383
 			$input_type = 'multi'; //multiselect
@@ -421,19 +421,19 @@  discard block
 block discarded – undo
421 421
 			$post_id = 0;
422 422
 
423 423
 			// We're in the WordPress Widget context, and an overriding post ID has been set.
424
-			if ( ! empty( $widget_args['post_id'] ) ) {
425
-				$post_id = absint( $widget_args['post_id'] );
424
+			if ( ! empty( $widget_args[ 'post_id' ] ) ) {
425
+				$post_id = absint( $widget_args[ 'post_id' ] );
426 426
 			}
427 427
 			// We're in the WordPress Widget context, and the base View ID should be used
428
-			else if ( ! empty( $widget_args['view_id'] ) ) {
429
-				$post_id = absint( $widget_args['view_id'] );
428
+			else if ( ! empty( $widget_args[ 'view_id' ] ) ) {
429
+				$post_id = absint( $widget_args[ 'view_id' ] );
430 430
 			}
431 431
 
432 432
 			$args = gravityview_get_permalink_query_args( $post_id );
433 433
 
434 434
 			// Add hidden fields to the search form
435 435
 			foreach ( $args as $key => $value ) {
436
-				$search_fields[] = array(
436
+				$search_fields[ ] = array(
437 437
 					'name'  => $key,
438 438
 					'input' => 'hidden',
439 439
 					'value' => $value,
@@ -472,22 +472,22 @@  discard block
 block discarded – undo
472 472
 		/**
473 473
 		 * Include the sidebar Widgets.
474 474
 		 */
475
-		$widgets = (array) get_option( 'widget_gravityview_search', array() );
475
+		$widgets = (array)get_option( 'widget_gravityview_search', array() );
476 476
 
477 477
 		foreach ( $widgets as $widget ) {
478
-			if ( ! empty( $widget['view_id'] ) && $widget['view_id'] == $view->ID ) {
479
-				if( $_fields = json_decode( $widget['search_fields'], true ) ) {
478
+			if ( ! empty( $widget[ 'view_id' ] ) && $widget[ 'view_id' ] == $view->ID ) {
479
+				if ( $_fields = json_decode( $widget[ 'search_fields' ], true ) ) {
480 480
 					foreach ( $_fields as $field ) {
481
-						$searchable_fields [] = $with_full_field ? $field : $field['field'];
481
+						$searchable_fields [ ] = $with_full_field ? $field : $field[ 'field' ];
482 482
 					}
483 483
 				}
484 484
 			}
485 485
 		}
486 486
 
487 487
 		foreach ( $view->widgets->by_id( $this->get_widget_id() )->all() as $widget ) {
488
-			if( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) {
488
+			if ( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) {
489 489
 				foreach ( $_fields as $field ) {
490
-					$searchable_fields [] = $with_full_field ? $field : $field['field'];
490
+					$searchable_fields [ ] = $with_full_field ? $field : $field[ 'field' ];
491 491
 				}
492 492
 			}
493 493
 		}
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 	 */
505 505
 	public function filter_entries( $search_criteria, $form_id = null, $args = array() ) {
506 506
 
507
-		if( 'post' === $this->search_method ) {
507
+		if ( 'post' === $this->search_method ) {
508 508
 			$get = $_POST;
509 509
 		} else {
510 510
 			$get = $_GET;
@@ -523,14 +523,14 @@  discard block
 block discarded – undo
523 523
 		$get = gv_map_deep( $get, 'rawurldecode' );
524 524
 
525 525
 		// Make sure array key is set up
526
-		$search_criteria['field_filters'] = \GV\Utils::get( $search_criteria, 'field_filters', array() );
526
+		$search_criteria[ 'field_filters' ] = \GV\Utils::get( $search_criteria, 'field_filters', array() );
527 527
 
528 528
 		$searchable_fields = $this->get_view_searchable_fields( $view );
529 529
 
530 530
 		// add free search
531
-		if ( isset( $get['gv_search'] ) && '' !== $get['gv_search'] && in_array( 'search_all', $searchable_fields ) ) {
531
+		if ( isset( $get[ 'gv_search' ] ) && '' !== $get[ 'gv_search' ] && in_array( 'search_all', $searchable_fields ) ) {
532 532
 
533
-			$search_all_value = trim( $get['gv_search'] );
533
+			$search_all_value = trim( $get[ 'gv_search' ] );
534 534
 
535 535
 			/**
536 536
 			 * @filter `gravityview/search-all-split-words` Search for each word separately or the whole phrase?
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
 			}
556 556
 
557 557
 			foreach ( $words as $word ) {
558
-				$search_criteria['field_filters'][] = array(
558
+				$search_criteria[ 'field_filters' ][ ] = array(
559 559
 					'key' => null, // The field ID to search
560 560
 					'value' => $word, // The value to search
561 561
 					'operator' => 'contains', // What to search in. Options: `is` or `contains`
@@ -568,14 +568,14 @@  discard block
 block discarded – undo
568 568
 			/**
569 569
 			 * Get and normalize the dates according to the input format.
570 570
 			 */
571
-			if ( $curr_start = ! empty( $get['gv_start'] ) ? $get['gv_start'] : '' ) {
572
-				if( $curr_start_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_start ) ) {
571
+			if ( $curr_start = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_start' ] : '' ) {
572
+				if ( $curr_start_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_start ) ) {
573 573
 					$curr_start = $curr_start_date->format( 'Y-m-d' );
574 574
 				}
575 575
 			}
576 576
 
577
-			if ( $curr_end = ! empty( $get['gv_start'] ) ? ( ! empty( $get['gv_end'] ) ? $get['gv_end'] : '' ) : '' ) {
578
-				if( $curr_end_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_end ) ) {
577
+			if ( $curr_end = ! empty( $get[ 'gv_start' ] ) ? ( ! empty( $get[ 'gv_end' ] ) ? $get[ 'gv_end' ] : '' ) : '' ) {
578
+				if ( $curr_end_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_end ) ) {
579 579
 					$curr_end = $curr_end_date->format( 'Y-m-d' );
580 580
 				}
581 581
 			}
@@ -610,22 +610,22 @@  discard block
 block discarded – undo
610 610
 			 */
611 611
 			if ( ! empty( $curr_start ) ) {
612 612
 				$curr_start = date( 'Y-m-d H:i:s', strtotime( $curr_start ) );
613
-				$search_criteria['start_date'] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start;
613
+				$search_criteria[ 'start_date' ] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start;
614 614
 			}
615 615
 
616 616
 			if ( ! empty( $curr_end ) ) {
617 617
 				// Fast-forward 24 hour on the end time
618 618
 				$curr_end = date( 'Y-m-d H:i:s', strtotime( $curr_end ) + DAY_IN_SECONDS );
619
-				$search_criteria['end_date'] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end;
620
-				if ( strpos( $search_criteria['end_date'], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056
621
-					$search_criteria['end_date'] = date( 'Y-m-d H:i:s', strtotime( $search_criteria['end_date'] ) - 1 );
619
+				$search_criteria[ 'end_date' ] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end;
620
+				if ( strpos( $search_criteria[ 'end_date' ], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056
621
+					$search_criteria[ 'end_date' ] = date( 'Y-m-d H:i:s', strtotime( $search_criteria[ 'end_date' ] ) - 1 );
622 622
 				}
623 623
 			}
624 624
 		}
625 625
 
626 626
 		// search for a specific entry ID
627 627
 		if ( ! empty( $get[ 'gv_id' ] ) && in_array( 'entry_id', $searchable_fields ) ) {
628
-			$search_criteria['field_filters'][] = array(
628
+			$search_criteria[ 'field_filters' ][ ] = array(
629 629
 				'key' => 'id',
630 630
 				'value' => absint( $get[ 'gv_id' ] ),
631 631
 				'operator' => '=',
@@ -634,42 +634,42 @@  discard block
 block discarded – undo
634 634
 
635 635
 		// search for a specific Created_by ID
636 636
 		if ( ! empty( $get[ 'gv_by' ] ) && in_array( 'created_by', $searchable_fields ) ) {
637
-			$search_criteria['field_filters'][] = array(
637
+			$search_criteria[ 'field_filters' ][ ] = array(
638 638
 				'key' => 'created_by',
639
-				'value' => absint( $get['gv_by'] ),
639
+				'value' => absint( $get[ 'gv_by' ] ),
640 640
 				'operator' => '=',
641 641
 			);
642 642
 		}
643 643
 
644 644
 
645 645
 		// Get search mode passed in URL
646
-		$mode = isset( $get['mode'] ) && in_array( $get['mode'], array( 'any', 'all' ) ) ?  $get['mode'] : 'any';
646
+		$mode = isset( $get[ 'mode' ] ) && in_array( $get[ 'mode' ], array( 'any', 'all' ) ) ? $get[ 'mode' ] : 'any';
647 647
 
648 648
 		// get the other search filters
649 649
 		foreach ( $get as $key => $value ) {
650 650
 
651
-			if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[0], false, false ) ) ) {
651
+			if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[ 0 ], false, false ) ) ) {
652 652
 				continue;
653 653
 			}
654 654
 
655 655
 			$filter_key = $this->convert_request_key_to_filter_key( $key );
656 656
 
657 657
 			// could return simple filter or multiple filters
658
-			if ( ! in_array( 'search_all', $searchable_fields ) && ! in_array( $filter_key , $searchable_fields ) ) {
658
+			if ( ! in_array( 'search_all', $searchable_fields ) && ! in_array( $filter_key, $searchable_fields ) ) {
659 659
 				continue;
660 660
 			}
661 661
 
662 662
 			$filter = $this->prepare_field_filter( $filter_key, $value, $view );
663 663
 
664
-			if ( isset( $filter[0]['value'] ) ) {
665
-				$search_criteria['field_filters'] = array_merge( $search_criteria['field_filters'], $filter );
664
+			if ( isset( $filter[ 0 ][ 'value' ] ) ) {
665
+				$search_criteria[ 'field_filters' ] = array_merge( $search_criteria[ 'field_filters' ], $filter );
666 666
 
667 667
 				// if date range type, set search mode to ALL
668
-				if ( ! empty( $filter[0]['operator'] ) && in_array( $filter[0]['operator'], array( '>=', '<=', '>', '<' ) ) ) {
668
+				if ( ! empty( $filter[ 0 ][ 'operator' ] ) && in_array( $filter[ 0 ][ 'operator' ], array( '>=', '<=', '>', '<' ) ) ) {
669 669
 					$mode = 'all';
670 670
 				}
671
-			} elseif( !empty( $filter ) ) {
672
-				$search_criteria['field_filters'][] = $filter;
671
+			} elseif ( ! empty( $filter ) ) {
672
+				$search_criteria[ 'field_filters' ][ ] = $filter;
673 673
 			}
674 674
 		}
675 675
 
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
 		 * @since 1.5.1
679 679
 		 * @param[out,in] string $mode Search mode (`any` vs `all`)
680 680
 		 */
681
-		$search_criteria['field_filters']['mode'] = apply_filters( 'gravityview/search/mode', $mode );
681
+		$search_criteria[ 'field_filters' ][ 'mode' ] = apply_filters( 'gravityview/search/mode', $mode );
682 682
 
683 683
 		gravityview()->log->debug( 'Returned Search Criteria: ', array( 'data' => $search_criteria ) );
684 684
 
@@ -706,7 +706,7 @@  discard block
 block discarded – undo
706 706
 		$field_id = str_replace( 'filter_', '', $key );
707 707
 
708 708
 		// calculates field_id, removing 'filter_' and for '_' for advanced fields ( like name or checkbox )
709
-		if ( preg_match('/^[0-9_]+$/ism', $field_id ) ) {
709
+		if ( preg_match( '/^[0-9_]+$/ism', $field_id ) ) {
710 710
 			$field_id = str_replace( '_', '.', $field_id );
711 711
 		}
712 712
 
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
 
742 742
 			case 'select':
743 743
 			case 'radio':
744
-				$filter['operator'] = 'is';
744
+				$filter[ 'operator' ] = 'is';
745 745
 				break;
746 746
 
747 747
 			case 'post_category':
@@ -755,7 +755,7 @@  discard block
 block discarded – undo
755 755
 
756 756
 				foreach ( $value as $val ) {
757 757
 					$cat = get_term( $val, 'category' );
758
-					$filter[] = array(
758
+					$filter[ ] = array(
759 759
 						'key'      => $filter_key,
760 760
 						'value'    => esc_attr( $cat->name ) . ':' . $val,
761 761
 						'operator' => 'is',
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
 				$filter = array();
775 775
 
776 776
 				foreach ( $value as $val ) {
777
-					$filter[] = array( 'key' => $filter_key, 'value' => $val );
777
+					$filter[ ] = array( 'key' => $filter_key, 'value' => $val );
778 778
 				}
779 779
 
780 780
 				break;
@@ -783,9 +783,9 @@  discard block
 block discarded – undo
783 783
 				// convert checkbox on/off into the correct search filter
784 784
 				if ( false !== strpos( $filter_key, '.' ) && ! empty( $form_field->inputs ) && ! empty( $form_field->choices ) ) {
785 785
 					foreach ( $form_field->inputs as $k => $input ) {
786
-						if ( $input['id'] == $filter_key ) {
787
-							$filter['value'] = $form_field->choices[ $k ]['value'];
788
-							$filter['operator'] = 'is';
786
+						if ( $input[ 'id' ] == $filter_key ) {
787
+							$filter[ 'value' ] = $form_field->choices[ $k ][ 'value' ];
788
+							$filter[ 'operator' ] = 'is';
789 789
 							break;
790 790
 						}
791 791
 					}
@@ -795,7 +795,7 @@  discard block
 block discarded – undo
795 795
 					$filter = array();
796 796
 
797 797
 					foreach ( $value as $val ) {
798
-						$filter[] = array(
798
+						$filter[ ] = array(
799 799
 							'key'      => $filter_key,
800 800
 							'value'    => $val,
801 801
 							'operator' => 'is',
@@ -816,9 +816,9 @@  discard block
 block discarded – undo
816 816
 					foreach ( $words as $word ) {
817 817
 						if ( ! empty( $word ) && strlen( $word ) > 1 ) {
818 818
 							// Keep the same key for each filter
819
-							$filter['value'] = $word;
819
+							$filter[ 'value' ] = $word;
820 820
 							// Add a search for the value
821
-							$filters[] = $filter;
821
+							$filters[ ] = $filter;
822 822
 						}
823 823
 					}
824 824
 
@@ -832,19 +832,19 @@  discard block
 block discarded – undo
832 832
 
833 833
 					foreach ( $searchable_fields as $searchable_field ) {
834 834
 
835
-						if( $form_field->ID !== $searchable_field['field'] ) {
835
+						if ( $form_field->ID !== $searchable_field[ 'field' ] ) {
836 836
 							continue;
837 837
 						}
838 838
 
839 839
 						// Only exact-match dropdowns, not text search
840
-						if( in_array( $searchable_field['input'], array( 'text', 'search' ), true ) ) {
840
+						if ( in_array( $searchable_field[ 'input' ], array( 'text', 'search' ), true ) ) {
841 841
 							continue;
842 842
 						}
843 843
 
844 844
 						$input_id = gravityview_get_input_id_from_id( $form_field->ID );
845 845
 
846 846
 						if ( 4 === $input_id ) {
847
-							$filter['operator'] = 'is';
847
+							$filter[ 'operator' ] = 'is';
848 848
 						};
849 849
 					}
850 850
 				}
@@ -869,19 +869,19 @@  discard block
 block discarded – undo
869 869
 						 * @since 1.16.3
870 870
 						 * Safeguard until GF implements '<=' operator
871 871
 						 */
872
-						if( !GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) {
872
+						if ( ! GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) {
873 873
 							$operator = '<';
874 874
 							$date = date( 'Y-m-d', strtotime( $date . ' +1 day' ) );
875 875
 						}
876 876
 
877
-						$filter[] = array(
877
+						$filter[ ] = array(
878 878
 							'key'      => $filter_key,
879 879
 							'value'    => self::get_formatted_date( $date, 'Y-m-d' ),
880 880
 							'operator' => $operator,
881 881
 						);
882 882
 					}
883 883
 				} else {
884
-					$filter['value'] = self::get_formatted_date( $value, 'Y-m-d' );
884
+					$filter[ 'value' ] = self::get_formatted_date( $value, 'Y-m-d' );
885 885
 				}
886 886
 
887 887
 				break;
@@ -912,7 +912,7 @@  discard block
 block discarded – undo
912 912
 			'ymd_dot' => 'Y.m.d',
913 913
 		);
914 914
 
915
-		if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){
915
+		if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) {
916 916
 			$format = $datepicker[ $field->dateFormat ];
917 917
 		}
918 918
 
@@ -945,7 +945,7 @@  discard block
 block discarded – undo
945 945
 	public function add_template_path( $file_paths ) {
946 946
 
947 947
 		// Index 100 is the default GravityView template path.
948
-		$file_paths[102] = self::$file . 'templates/';
948
+		$file_paths[ 102 ] = self::$file . 'templates/';
949 949
 
950 950
 		return $file_paths;
951 951
 	}
@@ -964,7 +964,7 @@  discard block
 block discarded – undo
964 964
 		$has_date = false;
965 965
 
966 966
 		foreach ( $search_fields as $k => $field ) {
967
-			if ( in_array( $field['input'], array( 'date', 'date_range', 'entry_date' ) ) ) {
967
+			if ( in_array( $field[ 'input' ], array( 'date', 'date_range', 'entry_date' ) ) ) {
968 968
 				$has_date = true;
969 969
 				break;
970 970
 			}
@@ -991,7 +991,7 @@  discard block
 block discarded – undo
991 991
 		}
992 992
 
993 993
 		// get configured search fields
994
-		$search_fields = ! empty( $widget_args['search_fields'] ) ? json_decode( $widget_args['search_fields'], true ) : '';
994
+		$search_fields = ! empty( $widget_args[ 'search_fields' ] ) ? json_decode( $widget_args[ 'search_fields' ], true ) : '';
995 995
 
996 996
 		if ( empty( $search_fields ) || ! is_array( $search_fields ) ) {
997 997
 			gravityview()->log->debug( 'No search fields configured for widget:', array( 'data' => $widget_args ) );
@@ -1006,34 +1006,34 @@  discard block
 block discarded – undo
1006 1006
 
1007 1007
 			$updated_field = $this->get_search_filter_details( $updated_field );
1008 1008
 
1009
-			switch ( $field['field'] ) {
1009
+			switch ( $field[ 'field' ] ) {
1010 1010
 
1011 1011
 				case 'search_all':
1012
-					$updated_field['key'] = 'search_all';
1013
-					$updated_field['input'] = 'search_all';
1014
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_search' );
1012
+					$updated_field[ 'key' ] = 'search_all';
1013
+					$updated_field[ 'input' ] = 'search_all';
1014
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_search' );
1015 1015
 					break;
1016 1016
 
1017 1017
 				case 'entry_date':
1018
-					$updated_field['key'] = 'entry_date';
1019
-					$updated_field['input'] = 'entry_date';
1020
-					$updated_field['value'] = array(
1018
+					$updated_field[ 'key' ] = 'entry_date';
1019
+					$updated_field[ 'input' ] = 'entry_date';
1020
+					$updated_field[ 'value' ] = array(
1021 1021
 						'start' => $this->rgget_or_rgpost( 'gv_start' ),
1022 1022
 						'end' => $this->rgget_or_rgpost( 'gv_end' ),
1023 1023
 					);
1024 1024
 					break;
1025 1025
 
1026 1026
 				case 'entry_id':
1027
-					$updated_field['key'] = 'entry_id';
1028
-					$updated_field['input'] = 'entry_id';
1029
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_id' );
1027
+					$updated_field[ 'key' ] = 'entry_id';
1028
+					$updated_field[ 'input' ] = 'entry_id';
1029
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_id' );
1030 1030
 					break;
1031 1031
 
1032 1032
 				case 'created_by':
1033
-					$updated_field['key'] = 'created_by';
1034
-					$updated_field['name'] = 'gv_by';
1035
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_by' );
1036
-					$updated_field['choices'] = self::get_created_by_choices();
1033
+					$updated_field[ 'key' ] = 'created_by';
1034
+					$updated_field[ 'name' ] = 'gv_by';
1035
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_by' );
1036
+					$updated_field[ 'choices' ] = self::get_created_by_choices();
1037 1037
 					break;
1038 1038
 			}
1039 1039
 
@@ -1052,16 +1052,16 @@  discard block
 block discarded – undo
1052 1052
 		 */
1053 1053
 		$gravityview_view->search_fields = apply_filters( 'gravityview_widget_search_filters', $search_fields, $this, $widget_args, $context );
1054 1054
 
1055
-		$gravityview_view->search_layout = ! empty( $widget_args['search_layout'] ) ? $widget_args['search_layout'] : 'horizontal';
1055
+		$gravityview_view->search_layout = ! empty( $widget_args[ 'search_layout' ] ) ? $widget_args[ 'search_layout' ] : 'horizontal';
1056 1056
 
1057 1057
 		/** @since 1.14 */
1058
-		$gravityview_view->search_mode = ! empty( $widget_args['search_mode'] ) ? $widget_args['search_mode'] : 'any';
1058
+		$gravityview_view->search_mode = ! empty( $widget_args[ 'search_mode' ] ) ? $widget_args[ 'search_mode' ] : 'any';
1059 1059
 
1060
-		$custom_class = ! empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : '';
1060
+		$custom_class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : '';
1061 1061
 
1062 1062
 		$gravityview_view->search_class = self::get_search_class( $custom_class );
1063 1063
 
1064
-		$gravityview_view->search_clear = ! empty( $widget_args['search_clear'] ) ? $widget_args['search_clear'] : false;
1064
+		$gravityview_view->search_clear = ! empty( $widget_args[ 'search_clear' ] ) ? $widget_args[ 'search_clear' ] : false;
1065 1065
 
1066 1066
 		if ( $this->has_date_field( $search_fields ) ) {
1067 1067
 			// enqueue datepicker stuff only if needed!
@@ -1083,10 +1083,10 @@  discard block
 block discarded – undo
1083 1083
 	public static function get_search_class( $custom_class = '' ) {
1084 1084
 		$gravityview_view = GravityView_View::getInstance();
1085 1085
 
1086
-		$search_class = 'gv-search-'.$gravityview_view->search_layout;
1086
+		$search_class = 'gv-search-' . $gravityview_view->search_layout;
1087 1087
 
1088
-		if ( ! empty( $custom_class )  ) {
1089
-			$search_class .= ' '.$custom_class;
1088
+		if ( ! empty( $custom_class ) ) {
1089
+			$search_class .= ' ' . $custom_class;
1090 1090
 		}
1091 1091
 
1092 1092
 		/**
@@ -1130,9 +1130,9 @@  discard block
 block discarded – undo
1130 1130
 
1131 1131
 		if ( ! $label ) {
1132 1132
 
1133
-			$label = isset( $form_field['label'] ) ? $form_field['label'] : '';
1133
+			$label = isset( $form_field[ 'label' ] ) ? $form_field[ 'label' ] : '';
1134 1134
 
1135
-			switch( $field['field'] ) {
1135
+			switch ( $field[ 'field' ] ) {
1136 1136
 				case 'search_all':
1137 1137
 					$label = __( 'Search Entries:', 'gravityview' );
1138 1138
 					break;
@@ -1144,10 +1144,10 @@  discard block
 block discarded – undo
1144 1144
 					break;
1145 1145
 				default:
1146 1146
 					// If this is a field input, not a field
1147
-					if ( strpos( $field['field'], '.' ) > 0 && ! empty( $form_field['inputs'] ) ) {
1147
+					if ( strpos( $field[ 'field' ], '.' ) > 0 && ! empty( $form_field[ 'inputs' ] ) ) {
1148 1148
 
1149 1149
 						// Get the label for the field in question, which returns an array
1150
-						$items = wp_list_filter( $form_field['inputs'], array( 'id' => $field['field'] ) );
1150
+						$items = wp_list_filter( $form_field[ 'inputs' ], array( 'id' => $field[ 'field' ] ) );
1151 1151
 
1152 1152
 						// Get the item with the `label` key
1153 1153
 						$values = wp_list_pluck( $items, 'label' );
@@ -1186,32 +1186,32 @@  discard block
 block discarded – undo
1186 1186
 		$form = $gravityview_view->getForm();
1187 1187
 
1188 1188
 		// for advanced field ids (eg, first name / last name )
1189
-		$name = 'filter_' . str_replace( '.', '_', $field['field'] );
1189
+		$name = 'filter_' . str_replace( '.', '_', $field[ 'field' ] );
1190 1190
 
1191 1191
 		// get searched value from $_GET/$_POST (string or array)
1192 1192
 		$value = $this->rgget_or_rgpost( $name );
1193 1193
 
1194 1194
 		// get form field details
1195
-		$form_field = gravityview_get_field( $form, $field['field'] );
1195
+		$form_field = gravityview_get_field( $form, $field[ 'field' ] );
1196 1196
 
1197 1197
 		$filter = array(
1198
-			'key' => $field['field'],
1198
+			'key' => $field[ 'field' ],
1199 1199
 			'name' => $name,
1200 1200
 			'label' => self::get_field_label( $field, $form_field ),
1201
-			'input' => $field['input'],
1201
+			'input' => $field[ 'input' ],
1202 1202
 			'value' => $value,
1203
-			'type' => $form_field['type'],
1203
+			'type' => $form_field[ 'type' ],
1204 1204
 		);
1205 1205
 
1206 1206
 		// collect choices
1207
-		if ( 'post_category' === $form_field['type'] && ! empty( $form_field['displayAllCategories'] ) && empty( $form_field['choices'] ) ) {
1208
-			$filter['choices'] = gravityview_get_terms_choices();
1209
-		} elseif ( ! empty( $form_field['choices'] ) ) {
1210
-			$filter['choices'] = $form_field['choices'];
1207
+		if ( 'post_category' === $form_field[ 'type' ] && ! empty( $form_field[ 'displayAllCategories' ] ) && empty( $form_field[ 'choices' ] ) ) {
1208
+			$filter[ 'choices' ] = gravityview_get_terms_choices();
1209
+		} elseif ( ! empty( $form_field[ 'choices' ] ) ) {
1210
+			$filter[ 'choices' ] = $form_field[ 'choices' ];
1211 1211
 		}
1212 1212
 
1213
-		if ( 'date_range' === $field['input'] && empty( $value ) ) {
1214
-			$filter['value'] = array( 'start' => '', 'end' => '' );
1213
+		if ( 'date_range' === $field[ 'input' ] && empty( $value ) ) {
1214
+			$filter[ 'value' ] = array( 'start' => '', 'end' => '' );
1215 1215
 		}
1216 1216
 
1217 1217
 		return $filter;
@@ -1235,7 +1235,7 @@  discard block
 block discarded – undo
1235 1235
 
1236 1236
 		$choices = array();
1237 1237
 		foreach ( $users as $user ) {
1238
-			$choices[] = array(
1238
+			$choices[ ] = array(
1239 1239
 				'value' => $user->ID,
1240 1240
 				'text' => $user->display_name,
1241 1241
 			);
@@ -1290,7 +1290,7 @@  discard block
 block discarded – undo
1290 1290
 	 */
1291 1291
 	public function add_datepicker_js_dependency( $js_dependencies ) {
1292 1292
 
1293
-		$js_dependencies[] = 'jquery-ui-datepicker';
1293
+		$js_dependencies[ ] = 'jquery-ui-datepicker';
1294 1294
 
1295 1295
 		return $js_dependencies;
1296 1296
 	}
@@ -1334,7 +1334,7 @@  discard block
 block discarded – undo
1334 1334
 			'isRTL'             => is_rtl(),
1335 1335
 		), $view_data );
1336 1336
 
1337
-		$localizations['datepicker'] = $datepicker_settings;
1337
+		$localizations[ 'datepicker' ] = $datepicker_settings;
1338 1338
 
1339 1339
 		return $localizations;
1340 1340
 
@@ -1361,7 +1361,7 @@  discard block
 block discarded – undo
1361 1361
 	 * @return void
1362 1362
 	 */
1363 1363
 	private function maybe_enqueue_flexibility() {
1364
-		if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/MSIE [8-9]/', $_SERVER['HTTP_USER_AGENT'] ) ) {
1364
+		if ( isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) && preg_match( '/MSIE [8-9]/', $_SERVER[ 'HTTP_USER_AGENT' ] ) ) {
1365 1365
 			wp_enqueue_script( 'gv-flexibility' );
1366 1366
 		}
1367 1367
 	}
@@ -1383,7 +1383,7 @@  discard block
 block discarded – undo
1383 1383
 		add_filter( 'gravityview_js_localization', array( $this, 'add_datepicker_localization' ), 10, 2 );
1384 1384
 
1385 1385
 		$scheme = is_ssl() ? 'https://' : 'http://';
1386
-		wp_enqueue_style( 'jquery-ui-datepicker', $scheme.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' );
1386
+		wp_enqueue_style( 'jquery-ui-datepicker', $scheme . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' );
1387 1387
 
1388 1388
 		/**
1389 1389
 		 * @filter `gravityview_search_datepicker_class`
Please login to merge, or discard this patch.