Completed
Pull Request — master (#1147)
by Gennady
22:01 queued 16:50
created
includes/class-api.php 1 patch
Spacing   +100 added lines, -100 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
 		$form = $gravityview_view->getForm();
33 33
 
34
-		if ( defined( 'DOING_GRAVITYVIEW_TESTS' ) && ! empty( $GLOBALS['GravityView_API_field_label_override'] ) ) {
34
+		if ( defined( 'DOING_GRAVITYVIEW_TESTS' ) && ! empty( $GLOBALS[ 'GravityView_API_field_label_override' ] ) ) {
35 35
 			/** Allow to fall through for back compatibility testing purposes. */
36 36
 		} else {
37 37
 			return \GV\Mocks\GravityView_API_field_label( $form, $field, $entry, $force_show_label );
@@ -39,29 +39,29 @@  discard block
 block discarded – undo
39 39
 
40 40
 		$label = '';
41 41
 
42
-		if( !empty( $field['show_label'] ) || $force_show_label ) {
42
+		if ( ! empty( $field[ 'show_label' ] ) || $force_show_label ) {
43 43
 
44
-			$label = $field['label'];
44
+			$label = $field[ 'label' ];
45 45
 
46 46
 			// Support Gravity Forms 1.9+
47
-			if( class_exists( 'GF_Field' ) ) {
47
+			if ( class_exists( 'GF_Field' ) ) {
48 48
 
49
-				$field_object = RGFormsModel::get_field( $form, $field['id'] );
49
+				$field_object = RGFormsModel::get_field( $form, $field[ 'id' ] );
50 50
 
51
-				if( $field_object ) {
51
+				if ( $field_object ) {
52 52
 
53
-					$input = GFFormsModel::get_input( $field_object, $field['id'] );
53
+					$input = GFFormsModel::get_input( $field_object, $field[ 'id' ] );
54 54
 
55 55
 					// This is a complex field, with labels on a per-input basis
56
-					if( $input ) {
56
+					if ( $input ) {
57 57
 
58 58
 						// Does the input have a custom label on a per-input basis? Otherwise, default label.
59
-						$label = ! empty( $input['customLabel'] ) ? $input['customLabel'] : $input['label'];
59
+						$label = ! empty( $input[ 'customLabel' ] ) ? $input[ 'customLabel' ] : $input[ 'label' ];
60 60
 
61 61
 					} else {
62 62
 
63 63
 						// This is a field with one label
64
-						$label = $field_object->get_field_label( true, $field['label'] );
64
+						$label = $field_object->get_field_label( true, $field[ 'label' ] );
65 65
 
66 66
 					}
67 67
 
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
 			}
71 71
 
72 72
 			// Use Gravity Forms label by default, but if a custom label is defined in GV, use it.
73
-			if ( !empty( $field['custom_label'] ) ) {
73
+			if ( ! empty( $field[ 'custom_label' ] ) ) {
74 74
 
75
-				$label = self::replace_variables( $field['custom_label'], $form, $entry );
75
+				$label = self::replace_variables( $field[ 'custom_label' ], $form, $entry );
76 76
 
77 77
 			}
78 78
 
@@ -134,11 +134,11 @@  discard block
 block discarded – undo
134 134
 
135 135
 		$width = NULL;
136 136
 
137
-		if( !empty( $field['width'] ) ) {
138
-			$width = absint( $field['width'] );
137
+		if ( ! empty( $field[ 'width' ] ) ) {
138
+			$width = absint( $field[ 'width' ] );
139 139
 
140 140
 			// If using percentages, limit to 100%
141
-			if( '%d%%' === $format && $width > 100 ) {
141
+			if ( '%d%%' === $format && $width > 100 ) {
142 142
 				$width = 100;
143 143
 			}
144 144
 
@@ -159,42 +159,42 @@  discard block
 block discarded – undo
159 159
 	public static function field_class( $field, $form = NULL, $entry = NULL ) {
160 160
 		$classes = array();
161 161
 
162
-		if( !empty( $field['custom_class'] ) ) {
162
+		if ( ! empty( $field[ 'custom_class' ] ) ) {
163 163
 
164
-            $custom_class = $field['custom_class'];
164
+            $custom_class = $field[ 'custom_class' ];
165 165
 
166
-            if( !empty( $entry ) ) {
166
+            if ( ! empty( $entry ) ) {
167 167
 
168 168
                 // We want the merge tag to be formatted as a class. The merge tag may be
169 169
                 // replaced by a multiple-word value that should be output as a single class.
170 170
                 // "Office Manager" will be formatted as `.OfficeManager`, not `.Office` and `.Manager`
171
-                add_filter('gform_merge_tag_filter', 'sanitize_html_class');
171
+                add_filter( 'gform_merge_tag_filter', 'sanitize_html_class' );
172 172
 
173
-                $custom_class = self::replace_variables( $custom_class, $form, $entry);
173
+                $custom_class = self::replace_variables( $custom_class, $form, $entry );
174 174
 
175 175
                 // And then we want life to return to normal
176
-                remove_filter('gform_merge_tag_filter', 'sanitize_html_class');
176
+                remove_filter( 'gform_merge_tag_filter', 'sanitize_html_class' );
177 177
             }
178 178
 
179 179
 			// And now we want the spaces to be handled nicely.
180
-			$classes[] = gravityview_sanitize_html_class( $custom_class );
180
+			$classes[ ] = gravityview_sanitize_html_class( $custom_class );
181 181
 
182 182
 		}
183 183
 
184
-		if(!empty($field['id'])) {
185
-			if( !empty( $form ) && !empty( $form['id'] ) ) {
186
-				$form_id = '-'.$form['id'];
184
+		if ( ! empty( $field[ 'id' ] ) ) {
185
+			if ( ! empty( $form ) && ! empty( $form[ 'id' ] ) ) {
186
+				$form_id = '-' . $form[ 'id' ];
187 187
 			} else {
188 188
 				// @deprecated path. Form should always be given.
189 189
 				gravityview()->log->warning( 'GravityView_View::getInstance() legacy API called' );
190 190
 				$gravityview_view = GravityView_View::getInstance();
191
-				$form_id = $gravityview_view->getFormId() ? '-'. $gravityview_view->getFormId() : '';
191
+				$form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : '';
192 192
 			}
193 193
 
194
-			$classes[] = 'gv-field'.$form_id.'-'.$field['id'];
194
+			$classes[ ] = 'gv-field' . $form_id . '-' . $field[ 'id' ];
195 195
 		}
196 196
 
197
-		return esc_attr(implode(' ', $classes));
197
+		return esc_attr( implode( ' ', $classes ) );
198 198
 	}
199 199
 
200 200
 	/**
@@ -210,11 +210,11 @@  discard block
 block discarded – undo
210 210
 	 * @return string Sanitized unique HTML `id` attribute for the field
211 211
 	 */
212 212
 	public static function field_html_attr_id( $field, $form = array(), $entry = array() ) {
213
-		$id = $field['id'];
213
+		$id = $field[ 'id' ];
214 214
 
215 215
 		if ( ! empty( $id ) ) {
216
-			if ( ! empty( $form ) && ! empty( $form['id'] ) ) {
217
-				$form_id = '-' . $form['id'];
216
+			if ( ! empty( $form ) && ! empty( $form[ 'id' ] ) ) {
217
+				$form_id = '-' . $form[ 'id' ];
218 218
 			} else {
219 219
 				// @deprecated path. Form should always be given.
220 220
 				gravityview()->log->warning( 'GravityView_View::getInstance() legacy API called' );
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 				$form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : '';
223 223
 			}
224 224
 
225
-			$id = 'gv-field' . $form_id . '-' . $field['id'];
225
+			$id = 'gv-field' . $form_id . '-' . $field[ 'id' ];
226 226
 		}
227 227
 
228 228
 		return esc_attr( $id );
@@ -262,14 +262,14 @@  discard block
 block discarded – undo
262 262
 	 */
263 263
 	public static function entry_link_html( $entry = array(), $anchor_text = '', $passed_tag_atts = array(), $field_settings = array(), $base_id = null ) {
264 264
 
265
-		if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry['id'] ) ) {
265
+		if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry[ 'id' ] ) ) {
266 266
 			gravityview()->log->debug( 'Entry not defined; returning null', array( 'data' => $entry ) );
267 267
 			return NULL;
268 268
 		}
269 269
 
270 270
 		$href = self::entry_link( $entry, $base_id );
271 271
 
272
-		if( '' === $href ) {
272
+		if ( '' === $href ) {
273 273
 			return NULL;
274 274
 		}
275 275
 
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 		} else {
307 307
 			$gravityview_view = GravityView_View::getInstance();
308 308
 
309
-			if( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) {
309
+			if ( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) {
310 310
 				$is_search = true;
311 311
 			}
312 312
 		}
@@ -402,9 +402,9 @@  discard block
 block discarded – undo
402 402
 
403 403
 		// If we've saved the permalink in memory, use it
404 404
 		// @since 1.3
405
-		$link = wp_cache_get( 'gv_directory_link_'.$post_id );
405
+		$link = wp_cache_get( 'gv_directory_link_' . $post_id );
406 406
 
407
-		if ( (int) $post_id === (int) get_option( 'page_on_front' ) ) {
407
+		if ( (int)$post_id === (int)get_option( 'page_on_front' ) ) {
408 408
 			$link = home_url();
409 409
 		}
410 410
 
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 
414 414
 			// If not yet saved, cache the permalink.
415 415
 			// @since 1.3
416
-			wp_cache_set( 'gv_directory_link_'.$post_id, $link );
416
+			wp_cache_set( 'gv_directory_link_' . $post_id, $link );
417 417
 		}
418 418
 
419 419
 		// Deal with returning to proper pagination for embedded views
@@ -421,13 +421,13 @@  discard block
 block discarded – undo
421 421
 
422 422
 			$args = array();
423 423
 
424
-			if( $pagenum = \GV\Utils::_GET( 'pagenum' ) ) {
425
-				$args['pagenum'] = intval( $pagenum );
424
+			if ( $pagenum = \GV\Utils::_GET( 'pagenum' ) ) {
425
+				$args[ 'pagenum' ] = intval( $pagenum );
426 426
 			}
427 427
 
428
-			if( $sort = \GV\Utils::_GET( 'sort' ) ) {
429
-				$args['sort'] = $sort;
430
-				$args['dir'] = \GV\Utils::_GET( 'dir' );
428
+			if ( $sort = \GV\Utils::_GET( 'sort' ) ) {
429
+				$args[ 'sort' ] = $sort;
430
+				$args[ 'dir' ] = \GV\Utils::_GET( 'dir' );
431 431
 			}
432 432
 
433 433
 			$link = add_query_arg( $args, $link );
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
 	private static function get_custom_entry_slug( $id, $entry = array() ) {
465 465
 
466 466
 		// Generate an unique hash to use as the default value
467
-		$slug = substr( wp_hash( $id, 'gravityview'.$id ), 0, 8 );
467
+		$slug = substr( wp_hash( $id, 'gravityview' . $id ), 0, 8 );
468 468
 
469 469
 		/**
470 470
 		 * @filter `gravityview_entry_slug` Modify the unique hash ID generated, if you want to improve usability or change the format. This will allow for custom URLs, such as `{entryid}-{first-name}` or even, if unique, `{first-name}-{last-name}`
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
 		$slug = apply_filters( 'gravityview_entry_slug', $slug, $id, $entry );
476 476
 
477 477
 		// Make sure we have something - use the original ID as backup.
478
-		if( empty( $slug ) ) {
478
+		if ( empty( $slug ) ) {
479 479
 			$slug = $id;
480 480
 		}
481 481
 
@@ -569,15 +569,15 @@  discard block
 block discarded – undo
569 569
          * @param boolean $custom Should we process the custom entry slug?
570 570
          */
571 571
         $custom = apply_filters( 'gravityview_custom_entry_slug', false );
572
-        if( $custom ) {
572
+        if ( $custom ) {
573 573
             // create the gravityview_unique_id and save it
574 574
 
575 575
             // Get the entry hash
576
-            $hash = self::get_custom_entry_slug( $entry['id'], $entry );
576
+            $hash = self::get_custom_entry_slug( $entry[ 'id' ], $entry );
577 577
 
578
-	        gravityview()->log->debug( 'Setting hash for entry {entry_id}: {hash}', array( 'entry_id' => $entry['id'], 'hash' => $hash ) );
578
+	        gravityview()->log->debug( 'Setting hash for entry {entry_id}: {hash}', array( 'entry_id' => $entry[ 'id' ], 'hash' => $hash ) );
579 579
 
580
-            gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash, \GV\Utils::get( $entry, 'form_id' ) );
580
+            gform_update_meta( $entry[ 'id' ], 'gravityview_unique_id', $hash, \GV\Utils::get( $entry, 'form_id' ) );
581 581
 
582 582
         }
583 583
     }
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
 
597 597
 		if ( ! empty( $entry ) && ! is_array( $entry ) ) {
598 598
 			$entry = GVCommon::get_entry( $entry );
599
-		} else if( empty( $entry ) ) {
599
+		} else if ( empty( $entry ) ) {
600 600
 			// @deprecated path
601 601
 			$entry = GravityView_frontend::getInstance()->getEntry();
602 602
 		}
@@ -616,9 +616,9 @@  discard block
 block discarded – undo
616 616
 
617 617
 		$query_arg_name = \GV\Entry::get_endpoint_name();
618 618
 
619
-		$entry_slug = self::get_entry_slug( $entry['id'], $entry );
619
+		$entry_slug = self::get_entry_slug( $entry[ 'id' ], $entry );
620 620
 
621
-		if ( get_option('permalink_structure') && !is_preview() ) {
621
+		if ( get_option( 'permalink_structure' ) && ! is_preview() ) {
622 622
 
623 623
 			$args = array();
624 624
 
@@ -628,9 +628,9 @@  discard block
 block discarded – undo
628 628
 			 */
629 629
 			$link_parts = explode( '?', $directory_link );
630 630
 
631
-			$query = !empty( $link_parts[1] ) ? '?'.$link_parts[1] : '';
631
+			$query = ! empty( $link_parts[ 1 ] ) ? '?' . $link_parts[ 1 ] : '';
632 632
 
633
-			$directory_link = trailingslashit( $link_parts[0] ) . $query_arg_name . '/'. $entry_slug .'/' . $query;
633
+			$directory_link = trailingslashit( $link_parts[ 0 ] ) . $query_arg_name . '/' . $entry_slug . '/' . $query;
634 634
 
635 635
 		} else {
636 636
 
@@ -642,22 +642,22 @@  discard block
 block discarded – undo
642 642
 		 */
643 643
 		if ( $add_directory_args ) {
644 644
 
645
-			if ( ! empty( $_GET['pagenum'] ) ) {
646
-				$args['pagenum'] = intval( $_GET['pagenum'] );
645
+			if ( ! empty( $_GET[ 'pagenum' ] ) ) {
646
+				$args[ 'pagenum' ] = intval( $_GET[ 'pagenum' ] );
647 647
 			}
648 648
 
649 649
 			/**
650 650
 			 * @since 1.7
651 651
 			 */
652 652
 			if ( $sort = \GV\Utils::_GET( 'sort' ) ) {
653
-				$args['sort'] = $sort;
654
-				$args['dir'] = \GV\Utils::_GET( 'dir' );
653
+				$args[ 'sort' ] = $sort;
654
+				$args[ 'dir' ] = \GV\Utils::_GET( 'dir' );
655 655
 			}
656 656
 
657 657
 		}
658 658
 
659 659
 		if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() ) {
660
-			$args['gvid'] = gravityview_get_view_id();
660
+			$args[ 'gvid' ] = gravityview_get_view_id();
661 661
 		}
662 662
 
663 663
 		return add_query_arg( $args, $directory_link );
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
 }
679 679
 
680 680
 function gv_class( $field, $form = NULL, $entry = array() ) {
681
-	return GravityView_API::field_class( $field, $form, $entry  );
681
+	return GravityView_API::field_class( $field, $form, $entry );
682 682
 }
683 683
 
684 684
 /**
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
 		$view_id = 0;
702 702
 		if ( $context->view ) {
703 703
 			$view_id = $context->view->ID;
704
-			if( $context->view->settings->get( 'hide_until_searched' ) ) {
704
+			if ( $context->view->settings->get( 'hide_until_searched' ) ) {
705 705
 				$hide_until_searched = ( empty( $context->entry ) && ! $context->request->is_search() );
706 706
 			}
707 707
 		}
@@ -729,7 +729,7 @@  discard block
 block discarded – undo
729 729
 		$default_css_class .= ' gv-container-no-results';
730 730
 	}
731 731
 
732
-	$css_class = trim( $passed_css_class . ' '. $default_css_class );
732
+	$css_class = trim( $passed_css_class . ' ' . $default_css_class );
733 733
 
734 734
 	/**
735 735
 	 * @filter `gravityview/render/container/class` Modify the CSS class to be added to the wrapper <div> of a View
@@ -756,7 +756,7 @@  discard block
 block discarded – undo
756 756
 
757 757
 	$value = GravityView_API::field_value( $entry, $field );
758 758
 
759
-	if( $value === '' ) {
759
+	if ( $value === '' ) {
760 760
 		/**
761 761
 		 * @filter `gravityview_empty_value` What to display when a field is empty
762 762
 		 * @param string $value (empty string)
@@ -869,7 +869,7 @@  discard block
 block discarded – undo
869 869
  */
870 870
 function gravityview_get_field_value( $entry, $field_id, $display_value ) {
871 871
 
872
-	if( floatval( $field_id ) === floor( floatval( $field_id ) ) ) {
872
+	if ( floatval( $field_id ) === floor( floatval( $field_id ) ) ) {
873 873
 
874 874
 		// For the complete field value as generated by Gravity Forms
875 875
 		return $display_value;
@@ -903,16 +903,16 @@  discard block
 block discarded – undo
903 903
 		$terms = explode( ', ', $value );
904 904
 	}
905 905
 
906
-	foreach ($terms as $term_name ) {
906
+	foreach ( $terms as $term_name ) {
907 907
 
908 908
 		// If we're processing a category,
909
-		if( $taxonomy === 'category' ) {
909
+		if ( $taxonomy === 'category' ) {
910 910
 
911 911
 			// Use rgexplode to prevent errors if : doesn't exist
912 912
 			list( $term_name, $term_id ) = rgexplode( ':', $term_name, 2 );
913 913
 
914 914
 			// The explode was succesful; we have the category ID
915
-			if( !empty( $term_id )) {
915
+			if ( ! empty( $term_id ) ) {
916 916
 				$term = get_term_by( 'id', $term_id, $taxonomy );
917 917
 			} else {
918 918
 			// We have to fall back to the name
@@ -925,7 +925,7 @@  discard block
 block discarded – undo
925 925
 		}
926 926
 
927 927
 		// There's still a tag/category here.
928
-		if( $term ) {
928
+		if ( $term ) {
929 929
 
930 930
 			$term_link = get_term_link( $term, $taxonomy );
931 931
 
@@ -934,11 +934,11 @@  discard block
 block discarded – undo
934 934
 			    continue;
935 935
 			}
936 936
 
937
-			$output[] = gravityview_get_link( $term_link, esc_html( $term->name ) );
937
+			$output[ ] = gravityview_get_link( $term_link, esc_html( $term->name ) );
938 938
 		}
939 939
 	}
940 940
 
941
-	return implode(', ', $output );
941
+	return implode( ', ', $output );
942 942
 }
943 943
 
944 944
 /**
@@ -952,8 +952,8 @@  discard block
 block discarded – undo
952 952
 
953 953
 	$output = get_the_term_list( $post_id, $taxonomy, NULL, ', ' );
954 954
 
955
-	if( empty( $link ) ) {
956
-		return strip_tags( $output);
955
+	if ( empty( $link ) ) {
956
+		return strip_tags( $output );
957 957
 	}
958 958
 
959 959
 	return $output;
@@ -972,7 +972,7 @@  discard block
 block discarded – undo
972 972
 	$fe = GravityView_frontend::getInstance();
973 973
 
974 974
 	// Solve problem when loading content via admin-ajax.php
975
-	if( ! $fe->getGvOutputData() ) {
975
+	if ( ! $fe->getGvOutputData() ) {
976 976
 
977 977
 		gravityview()->log->debug( 'gv_output_data not defined; parsing content.' );
978 978
 
@@ -980,7 +980,7 @@  discard block
 block discarded – undo
980 980
 	}
981 981
 
982 982
 	// Make 100% sure that we're dealing with a properly called situation
983
-	if( !is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) {
983
+	if ( ! is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) {
984 984
 
985 985
 		gravityview()->log->debug( 'gv_output_data not an object or get_view not callable.', array( 'data' => $fe->getGvOutputData() ) );
986 986
 
@@ -1202,12 +1202,12 @@  discard block
 block discarded – undo
1202 1202
 function gravityview_get_files_array( $value, $gv_class = '', $context = null ) {
1203 1203
 	/** @define "GRAVITYVIEW_DIR" "../" */
1204 1204
 
1205
-	if( !class_exists( 'GravityView_Field' ) ) {
1206
-		include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field.php' );
1205
+	if ( ! class_exists( 'GravityView_Field' ) ) {
1206
+		include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field.php' );
1207 1207
 	}
1208 1208
 
1209
-	if( !class_exists( 'GravityView_Field_FileUpload' ) ) {
1210
-		include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field-fileupload.php' );
1209
+	if ( ! class_exists( 'GravityView_Field_FileUpload' ) ) {
1210
+		include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field-fileupload.php' );
1211 1211
 	}
1212 1212
 
1213 1213
 	if ( is_null( $context ) ) {
@@ -1310,21 +1310,21 @@  discard block
 block discarded – undo
1310 1310
 	} else {
1311 1311
 		// @deprecated path
1312 1312
 		// Required fields.
1313
-		if ( empty( $args['field'] ) || empty( $args['form'] ) ) {
1313
+		if ( empty( $args[ 'field' ] ) || empty( $args[ 'form' ] ) ) {
1314 1314
 			gravityview()->log->error( 'Field or form are empty.', array( 'data' => $args ) );
1315 1315
 			return '';
1316 1316
 		}
1317 1317
 	}
1318 1318
 
1319 1319
 	if ( $context instanceof \GV\Template_Context ) {
1320
-		$entry = $args['entry'] ? : ( $context->entry ? $context->entry->as_entry() : array() );
1321
-		$field = $args['field'] ? : ( $context->field ? $context->field->as_configuration() : array() );
1322
-		$form = $args['form'] ? : ( $context->view->form ? $context->view->form->form : array() );
1320
+		$entry = $args[ 'entry' ] ?: ( $context->entry ? $context->entry->as_entry() : array() );
1321
+		$field = $args[ 'field' ] ?: ( $context->field ? $context->field->as_configuration() : array() );
1322
+		$form = $args[ 'form' ] ?: ( $context->view->form ? $context->view->form->form : array() );
1323 1323
 	} else {
1324 1324
 		// @deprecated path
1325
-		$entry = empty( $args['entry'] ) ? array() : $args['entry'];
1326
-		$field = $args['field'];
1327
-		$form = $args['form'];
1325
+		$entry = empty( $args[ 'entry' ] ) ? array() : $args[ 'entry' ];
1326
+		$field = $args[ 'field' ];
1327
+		$form = $args[ 'form' ];
1328 1328
 	}
1329 1329
 
1330 1330
 	/**
@@ -1342,40 +1342,40 @@  discard block
 block discarded – undo
1342 1342
 	);
1343 1343
 
1344 1344
 	if ( $context instanceof \GV\Template_Context ) {
1345
-		$placeholders['value'] = \GV\Utils::get( $args, 'value', '' );
1345
+		$placeholders[ 'value' ] = \GV\Utils::get( $args, 'value', '' );
1346 1346
 	} else {
1347 1347
 		// @deprecated path
1348
-		$placeholders['value'] = gv_value( $entry, $field );
1348
+		$placeholders[ 'value' ] = gv_value( $entry, $field );
1349 1349
 	}
1350 1350
 
1351 1351
 	// If the value is empty and we're hiding empty, return empty.
1352
-	if ( $placeholders['value'] === '' && ! empty( $args['hide_empty'] ) ) {
1352
+	if ( $placeholders[ 'value' ] === '' && ! empty( $args[ 'hide_empty' ] ) ) {
1353 1353
 		return '';
1354 1354
 	}
1355 1355
 
1356
-	if ( $placeholders['value'] !== '' && ! empty( $args['wpautop'] ) ) {
1357
-		$placeholders['value'] = wpautop( $placeholders['value'] );
1356
+	if ( $placeholders[ 'value' ] !== '' && ! empty( $args[ 'wpautop' ] ) ) {
1357
+		$placeholders[ 'value' ] = wpautop( $placeholders[ 'value' ] );
1358 1358
 	}
1359 1359
 
1360 1360
 	// Get width setting, if exists
1361
-	$placeholders['width'] = GravityView_API::field_width( $field );
1361
+	$placeholders[ 'width' ] = GravityView_API::field_width( $field );
1362 1362
 
1363 1363
 	// If replacing with CSS inline formatting, let's do it.
1364
-	$placeholders['width:style'] = GravityView_API::field_width( $field, 'width:' . $placeholders['width'] . '%;' );
1364
+	$placeholders[ 'width:style' ] = GravityView_API::field_width( $field, 'width:' . $placeholders[ 'width' ] . '%;' );
1365 1365
 
1366 1366
 	// Grab the Class using `gv_class`
1367
-	$placeholders['class'] = gv_class( $field, $form, $entry );
1368
-	$placeholders['field_id'] = GravityView_API::field_html_attr_id( $field, $form, $entry );
1367
+	$placeholders[ 'class' ] = gv_class( $field, $form, $entry );
1368
+	$placeholders[ 'field_id' ] = GravityView_API::field_html_attr_id( $field, $form, $entry );
1369 1369
 
1370 1370
 	if ( $context instanceof \GV\Template_Context ) {
1371
-		$placeholders['label_value'] = \GV\Utils::get( $args, 'label' );
1371
+		$placeholders[ 'label_value' ] = \GV\Utils::get( $args, 'label' );
1372 1372
 	} else {
1373 1373
 		// Default Label value
1374
-		$placeholders['label_value'] = gv_label( $field, $entry );
1374
+		$placeholders[ 'label_value' ] = gv_label( $field, $entry );
1375 1375
 	}
1376 1376
 
1377
-	if ( empty( $placeholders['label'] ) && ! empty( $placeholders['label_value'] ) ){
1378
-		$placeholders['label'] = '<span class="gv-field-label">{{ label_value }}</span>';
1377
+	if ( empty( $placeholders[ 'label' ] ) && ! empty( $placeholders[ 'label_value' ] ) ) {
1378
+		$placeholders[ 'label' ] = '<span class="gv-field-label">{{ label_value }}</span>';
1379 1379
 	}
1380 1380
 
1381 1381
 	/**
@@ -1386,7 +1386,7 @@  discard block
 block discarded – undo
1386 1386
 	 * @since 2.0
1387 1387
 	 * @param \GV\Template_Context $context The context.
1388 1388
 	 */
1389
-	$html = apply_filters( 'gravityview/field_output/pre_html', $args['markup'], $args, $context );
1389
+	$html = apply_filters( 'gravityview/field_output/pre_html', $args[ 'markup' ], $args, $context );
1390 1390
 
1391 1391
 	/**
1392 1392
 	 * @filter `gravityview/field_output/open_tag` Modify the opening tags for the template content placeholders
@@ -1413,7 +1413,7 @@  discard block
 block discarded – undo
1413 1413
 	foreach ( $placeholders as $tag => $value ) {
1414 1414
 
1415 1415
 		// If the tag doesn't exist just skip it
1416
-		if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ){
1416
+		if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ) {
1417 1417
 			continue;
1418 1418
 		}
1419 1419
 
Please login to merge, or discard this patch.
includes/class-gravityview-entry-approval.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -39,13 +39,13 @@  discard block
 block discarded – undo
39 39
 	private function add_hooks() {
40 40
 
41 41
 		// in case entry is edited (on admin or frontend)
42
-		add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2);
42
+		add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2 );
43 43
 
44 44
 		// when using the User opt-in field, check on entry submission
45 45
 		add_action( 'gform_after_submission', array( $this, 'after_submission' ), 10, 2 );
46 46
 
47 47
 		// process ajax approve entry requests
48
-		add_action('wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved'));
48
+		add_action( 'wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved' ) );
49 49
 
50 50
 		// autounapprove
51 51
 		add_action( 'gravityview/edit_entry/after_update', array( __CLASS__, 'autounapprove' ), 10, 4 );
@@ -94,10 +94,10 @@  discard block
 block discarded – undo
94 94
 			return;
95 95
 		}
96 96
 
97
-		$form = GFAPI::get_form( $entry['form_id'] );
97
+		$form = GFAPI::get_form( $entry[ 'form_id' ] );
98 98
 
99 99
 		if ( ! $form ) {
100
-			gravityview()->log->error( 'Form not found at ID #{form_id} for entry #{entry_id}', array( 'form_id' => $entry['form_id'], 'entry_id' => $entry_id ) );
100
+			gravityview()->log->error( 'Form not found at ID #{form_id} for entry #{entry_id}', array( 'form_id' => $entry[ 'form_id' ], 'entry_id' => $entry_id ) );
101 101
 			return;
102 102
 		}
103 103
 
@@ -114,10 +114,10 @@  discard block
 block discarded – undo
114 114
 	 */
115 115
 	public static function add_approval_notification_events( $notification_events = array(), $form = array() ) {
116 116
 
117
-		$notification_events['gravityview/approve_entries/approved'] = 'GravityView - ' . esc_html_x( 'Entry is approved', 'The title for an event in a notifications drop down list.', 'gravityview' );
118
-		$notification_events['gravityview/approve_entries/disapproved'] = 'GravityView - ' . esc_html_x( 'Entry is disapproved', 'The title for an event in a notifications drop down list.', 'gravityview' );
119
-		$notification_events['gravityview/approve_entries/unapproved'] = 'GravityView - ' . esc_html_x( 'Entry approval is reset', 'The title for an event in a notifications drop down list.', 'gravityview' );
120
-		$notification_events['gravityview/approve_entries/updated'] = 'GravityView - ' . esc_html_x( 'Entry approval is changed', 'The title for an event in a notifications drop down list.', 'gravityview' );
117
+		$notification_events[ 'gravityview/approve_entries/approved' ] = 'GravityView - ' . esc_html_x( 'Entry is approved', 'The title for an event in a notifications drop down list.', 'gravityview' );
118
+		$notification_events[ 'gravityview/approve_entries/disapproved' ] = 'GravityView - ' . esc_html_x( 'Entry is disapproved', 'The title for an event in a notifications drop down list.', 'gravityview' );
119
+		$notification_events[ 'gravityview/approve_entries/unapproved' ] = 'GravityView - ' . esc_html_x( 'Entry approval is reset', 'The title for an event in a notifications drop down list.', 'gravityview' );
120
+		$notification_events[ 'gravityview/approve_entries/updated' ] = 'GravityView - ' . esc_html_x( 'Entry approval is changed', 'The title for an event in a notifications drop down list.', 'gravityview' );
121 121
 
122 122
 		return $notification_events;
123 123
 	}
@@ -135,13 +135,13 @@  discard block
 block discarded – undo
135 135
 	 */
136 136
 	public static function get_entry_status( $entry, $value_or_label = 'label' ) {
137 137
 
138
-		$entry_id = is_array( $entry ) ? $entry['id'] : GVCommon::get_entry_id( $entry, true );
138
+		$entry_id = is_array( $entry ) ? $entry[ 'id' ] : GVCommon::get_entry_id( $entry, true );
139 139
 
140 140
 		$status = gform_get_meta( $entry_id, self::meta_key );
141 141
 
142 142
 		$status = GravityView_Entry_Approval_Status::maybe_convert_status( $status );
143 143
 
144
-		if( 'value' === $value_or_label ) {
144
+		if ( 'value' === $value_or_label ) {
145 145
 			return $status;
146 146
 		}
147 147
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 		$nonce = \GV\Utils::_POST( 'nonce' );
180 180
 
181 181
 		// Valid status
182
-		if( ! GravityView_Entry_Approval_Status::is_valid( $approval_status ) ) {
182
+		if ( ! GravityView_Entry_Approval_Status::is_valid( $approval_status ) ) {
183 183
 
184 184
 			gravityview()->log->error( 'Invalid approval status', array( 'data' => $_POST ) );
185 185
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 
211 211
 			gravityview()->log->error( 'User does not have the `gravityview_moderate_entries` capability.' );
212 212
 
213
-			$result = new WP_Error( 'Missing Cap: gravityview_moderate_entries', __( 'You do not have permission to edit this entry.', 'gravityview') );
213
+			$result = new WP_Error( 'Missing Cap: gravityview_moderate_entries', __( 'You do not have permission to edit this entry.', 'gravityview' ) );
214 214
 
215 215
 		}
216 216
 
@@ -261,10 +261,10 @@  discard block
 block discarded – undo
261 261
 		}
262 262
 
263 263
 		// Set default
264
-		self::update_approved_meta( $entry['id'], $default_status, $entry['form_id'] );
264
+		self::update_approved_meta( $entry[ 'id' ], $default_status, $entry[ 'form_id' ] );
265 265
 
266 266
 		// Then check for if there is an approval column, and use that value instead
267
-		$this->after_update_entry_update_approved_meta( $form , $entry['id'] );
267
+		$this->after_update_entry_update_approved_meta( $form, $entry[ 'id' ] );
268 268
 	}
269 269
 
270 270
 	/**
@@ -278,12 +278,12 @@  discard block
 block discarded – undo
278 278
 	 */
279 279
 	public function after_update_entry_update_approved_meta( $form, $entry_id = NULL ) {
280 280
 
281
-		$approved_column = self::get_approved_column( $form['id'] );
281
+		$approved_column = self::get_approved_column( $form[ 'id' ] );
282 282
 
283 283
 		/**
284 284
 		 * If the form doesn't contain the approve field, don't assume anything.
285 285
 		 */
286
-		if( empty( $approved_column ) ) {
286
+		if ( empty( $approved_column ) ) {
287 287
 			return;
288 288
 		}
289 289
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 			$value = GravityView_Entry_Approval_Status::APPROVED;
298 298
 		}
299 299
 
300
-		self::update_approved_meta( $entry_id, $value, $form['id'] );
300
+		self::update_approved_meta( $entry_id, $value, $form[ 'id' ] );
301 301
 	}
302 302
 
303 303
 	/**
@@ -315,12 +315,12 @@  discard block
 block discarded – undo
315 315
 	 */
316 316
 	public static function update_bulk( $entries = array(), $approved, $form_id ) {
317 317
 
318
-		if( empty($entries) || ( $entries !== true && !is_array($entries) ) ) {
318
+		if ( empty( $entries ) || ( $entries !== true && ! is_array( $entries ) ) ) {
319 319
 			gravityview()->log->error( 'Entries were empty or malformed.', array( 'data' => $entries ) );
320 320
 			return NULL;
321 321
 		}
322 322
 
323
-		if( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
323
+		if ( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
324 324
 			gravityview()->log->error( 'User does not have the `gravityview_moderate_entries` capability.' );
325 325
 			return NULL;
326 326
 		}
@@ -335,10 +335,10 @@  discard block
 block discarded – undo
335 335
 		$approved_column_id = self::get_approved_column( $form_id );
336 336
 
337 337
 		$success = true;
338
-		foreach( $entries as $entry_id ) {
338
+		foreach ( $entries as $entry_id ) {
339 339
 			$update_success = self::update_approved( (int)$entry_id, $approved, $form_id, $approved_column_id );
340 340
 
341
-			if( ! $update_success ) {
341
+			if ( ! $update_success ) {
342 342
 				$success = false;
343 343
 			}
344 344
 		}
@@ -362,12 +362,12 @@  discard block
 block discarded – undo
362 362
 	 */
363 363
 	public static function update_approved( $entry_id = 0, $approved = 2, $form_id = 0, $approvedcolumn = 0 ) {
364 364
 
365
-		if( !class_exists( 'GFAPI' ) ) {
365
+		if ( ! class_exists( 'GFAPI' ) ) {
366 366
 			gravityview()->log->error( 'GFAPI does not exist' );
367 367
 			return false;
368 368
 		}
369 369
 
370
-		if( ! GravityView_Entry_Approval_Status::is_valid( $approved ) ) {
370
+		if ( ! GravityView_Entry_Approval_Status::is_valid( $approved ) ) {
371 371
 			gravityview()->log->error( 'Not a valid approval value.' );
372 372
 			return false;
373 373
 		}
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 		// If the form has an Approve/Reject field, update that value
385 385
 		$result = self::update_approved_column( $entry_id, $approved, $form_id, $approvedcolumn );
386 386
 
387
-		if( is_wp_error( $result ) ) {
387
+		if ( is_wp_error( $result ) ) {
388 388
 			gravityview()->log->error( 'Entry approval not updated: {error}', array( 'error' => $result->get_error_message() ) );
389 389
 			return false;
390 390
 		}
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 
397 397
 		// add note to entry if approval field updating worked or there was no approved field
398 398
 		// There's no validation for the meta
399
-		if( true === $result ) {
399
+		if ( true === $result ) {
400 400
 
401 401
 			// Add an entry note
402 402
 			self::add_approval_status_updated_note( $entry_id, $approved );
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
 
450 450
 		$note_id = false;
451 451
 
452
-		if( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) {
452
+		if ( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) {
453 453
 
454 454
 			$current_user = wp_get_current_user();
455 455
 
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
 	 */
472 472
 	private static function update_approved_column( $entry_id = 0, $status = '0', $form_id = 0, $approvedcolumn = 0 ) {
473 473
 
474
-		if( empty( $approvedcolumn ) ) {
474
+		if ( empty( $approvedcolumn ) ) {
475 475
 			$approvedcolumn = self::get_approved_column( $form_id );
476 476
 		}
477 477
 
@@ -494,12 +494,12 @@  discard block
 block discarded – undo
494 494
 		$status = GravityView_Entry_Approval_Status::maybe_convert_status( $status );
495 495
 
496 496
 		$new_value = '';
497
-		if( GravityView_Entry_Approval_Status::APPROVED === $status ) {
497
+		if ( GravityView_Entry_Approval_Status::APPROVED === $status ) {
498 498
 			$new_value = self::get_approved_column_input_label( $form_id, $approvedcolumn );
499 499
 		}
500 500
 
501 501
 		//update entry
502
-		$entry["{$approvedcolumn}"] = $new_value;
502
+		$entry[ "{$approvedcolumn}" ] = $new_value;
503 503
 
504 504
 		/**
505 505
 		 * Note: GFAPI::update_entry() doesn't trigger `gform_after_update_entry`, so we trigger updating the meta ourselves
@@ -530,12 +530,12 @@  discard block
 block discarded – undo
530 530
 		// If the user has enabled a different value than the label (for some reason), use it.
531 531
 		// This is highly unlikely
532 532
 		if ( is_array( $field->choices ) && ! empty( $field->choices ) ) {
533
-			return isset( $field->choices[0]['value'] ) ? $field->choices[0]['value'] : $field->choices[0]['text'];
533
+			return isset( $field->choices[ 0 ][ 'value' ] ) ? $field->choices[ 0 ][ 'value' ] : $field->choices[ 0 ][ 'text' ];
534 534
 		}
535 535
 
536 536
 		// Otherwise, fall back on the inputs array
537 537
 		if ( is_array( $field->inputs ) && ! empty( $field->inputs ) ) {
538
-			return $field->inputs[0]['label'];
538
+			return $field->inputs[ 0 ][ 'label' ];
539 539
 		}
540 540
 
541 541
 		return null;
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
 		 * @since 1.18 Added "unapproved"
588 588
 		 * @param  int $entry_id ID of the Gravity Forms entry
589 589
 		 */
590
-		do_action( 'gravityview/approve_entries/' . $action , $entry_id );
590
+		do_action( 'gravityview/approve_entries/' . $action, $entry_id );
591 591
 	}
592 592
 
593 593
 	/**
@@ -600,11 +600,11 @@  discard block
 block discarded – undo
600 600
 	 */
601 601
 	static public function get_approved_column( $form ) {
602 602
 
603
-		if( empty( $form ) ) {
603
+		if ( empty( $form ) ) {
604 604
 			return null;
605 605
 		}
606 606
 
607
-		if( !is_array( $form ) ) {
607
+		if ( ! is_array( $form ) ) {
608 608
 			$form = GVCommon::get_form( $form );
609 609
 		}
610 610
 
@@ -614,22 +614,22 @@  discard block
 block discarded – undo
614 614
 		 * @var string $key
615 615
 		 * @var GF_Field $field
616 616
 		 */
617
-		foreach( $form['fields'] as $key => $field ) {
617
+		foreach ( $form[ 'fields' ] as $key => $field ) {
618 618
 
619 619
 			$inputs = $field->get_entry_inputs();
620 620
 
621
-			if( !empty( $field->gravityview_approved ) ) {
622
-				if ( ! empty( $inputs ) && !empty( $inputs[0]['id'] ) ) {
623
-					$approved_column_id = $inputs[0]['id'];
621
+			if ( ! empty( $field->gravityview_approved ) ) {
622
+				if ( ! empty( $inputs ) && ! empty( $inputs[ 0 ][ 'id' ] ) ) {
623
+					$approved_column_id = $inputs[ 0 ][ 'id' ];
624 624
 					break;
625 625
 				}
626 626
 			}
627 627
 
628 628
 			// Note: This is just for backward compatibility from GF Directory plugin and old GV versions - when using i18n it may not work..
629
-			if( 'checkbox' === $field->type && ! empty( $inputs ) ) {
629
+			if ( 'checkbox' === $field->type && ! empty( $inputs ) ) {
630 630
 				foreach ( $inputs as $input ) {
631
-					if ( 'approved' === strtolower( $input['label'] ) ) {
632
-						$approved_column_id = $input['id'];
631
+					if ( 'approved' === strtolower( $input[ 'label' ] ) ) {
632
+						$approved_column_id = $input[ 'id' ];
633 633
 						break;
634 634
 					}
635 635
 				}
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
 
656 656
 		$view_keys = array_keys( $gv_data->get_views() );
657 657
 
658
-		$view = \GV\View::by_id( $view_keys[0] );
658
+		$view = \GV\View::by_id( $view_keys[ 0 ] );
659 659
 
660 660
 		if ( ! $view->settings->get( 'unapprove_edit' ) ) {
661 661
 			return;
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
 			return;
666 666
 		}
667 667
 
668
-		self::update_approved_meta( $entry_id, GravityView_Entry_Approval_Status::UNAPPROVED, $form['id'] );
668
+		self::update_approved_meta( $entry_id, GravityView_Entry_Approval_Status::UNAPPROVED, $form[ 'id' ] );
669 669
 	}
670 670
 
671 671
 }
Please login to merge, or discard this patch.
future/includes/class-gv-request-admin.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -30,14 +30,14 @@  discard block
 block discarded – undo
30 30
 			return true;
31 31
 		}
32 32
 
33
-		$context = $args[1];
33
+		$context = $args[ 1 ];
34 34
 
35 35
 		/**
36 36
 		 * Assume false by default.
37 37
 		 */
38 38
 		$is_page = false;
39 39
 
40
-		if( function_exists( '\get_current_screen' ) ) {
40
+		if ( function_exists( '\get_current_screen' ) ) {
41 41
 			$current_screen = \get_current_screen();
42 42
 		} else {
43 43
 			$current_screen = false;
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 				$is_page = 'single';
51 51
 			} else if ( $is_gv_settings = 'gravityview_page_gravityview_settings' === $current_screen->id ) {
52 52
 				$is_page = 'settings';
53
-			} else if( $is_extensions = 'gravityview_page_gv-admin-installer' === $current_screen->id ) {
53
+			} else if ( $is_extensions = 'gravityview_page_gv-admin-installer' === $current_screen->id ) {
54 54
 				$is_page = 'downloads';
55 55
 			}
56 56
 		}
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 		 * @param[in,out] string|bool $is_page If false, no. If string, the name of the page (`single`, `settings`, or `views`)
61 61
 		 * @param[in] string $hook The name of the page to check against. Is passed to the method.
62 62
 		 */
63
-		$is_page = apply_filters( 'gravityview_is_admin_page', $is_page, $args[0] );
63
+		$is_page = apply_filters( 'gravityview_is_admin_page', $is_page, $args[ 0 ] );
64 64
 
65 65
 		// If the current page is the same as the compared page
66 66
 		if ( ! empty( $context ) ) {
Please login to merge, or discard this patch.
includes/class-gravityview-extension.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
  */
15 15
 abstract class GravityView_Extension extends \GV\Extension {
16 16
 	public function __construct() {
17
-		if( ! in_array( $this->_author, array( 'GravityView', 'Katz Web Services, Inc.', true ) ) ) {
17
+		if ( ! in_array( $this->_author, array( 'GravityView', 'Katz Web Services, Inc.', true ) ) ) {
18 18
 			gravityview()->log->warning( '\GravityView_Extension is deprecated. Inherit from \GV\Extension instead', array( 'data' => $this ) );
19 19
 		}
20 20
 		parent::__construct();
Please login to merge, or discard this patch.
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();
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 			 * @param GravityView_Edit_Entry_Render $this This object
359 359
 			 * @param GravityView_View_Data $gv_data The View data
360 360
 			 */
361
-			do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry['id'], $this, $gv_data );
361
+			do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry[ 'id' ], $this, $gv_data );
362 362
 
363 363
 		} else {
364 364
 			gravityview()->log->error( 'Submission is NOT valid.', array( 'entry' => $this->entry ) );
@@ -386,16 +386,16 @@  discard block
 block discarded – undo
386 386
 		 */
387 387
 		$unset_hidden_field_values = apply_filters( 'gravityview/edit_entry/unset_hidden_field_values', true, $this );
388 388
 
389
-		if( ! $unset_hidden_field_values ) {
389
+		if ( ! $unset_hidden_field_values ) {
390 390
 			return;
391 391
 		}
392 392
 
393 393
 		if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_meta_table_name' ) ) {
394 394
 			$entry_meta_table = GFFormsModel::get_entry_meta_table_name();
395
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value FROM $entry_meta_table WHERE entry_id=%d", $this->entry['id'] ) );
395
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value FROM $entry_meta_table WHERE entry_id=%d", $this->entry[ 'id' ] ) );
396 396
 		} else {
397 397
 			$lead_detail_table = GFFormsModel::get_lead_details_table_name();
398
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT id, field_number FROM $lead_detail_table WHERE lead_id=%d", $this->entry['id'] ) );
398
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT id, field_number FROM $lead_detail_table WHERE lead_id=%d", $this->entry[ 'id' ] ) );
399 399
 		}
400 400
 
401 401
 	    foreach ( $this->entry as $input_id => $field_value ) {
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
 		}
477 477
 
478 478
 		/** No file is being uploaded. */
479
-		if ( empty( $_FILES[ $input_name ]['name'] ) ) {
479
+		if ( empty( $_FILES[ $input_name ][ 'name' ] ) ) {
480 480
 			/** So return the original upload */
481 481
 			return $entry[ $input_id ];
482 482
 		}
@@ -494,11 +494,11 @@  discard block
 block discarded – undo
494 494
 	 * @return mixed
495 495
 	 */
496 496
 	public function modify_fileupload_settings( $plupload_init, $form_id, $instance ) {
497
-		if( ! $this->is_edit_entry() ) {
497
+		if ( ! $this->is_edit_entry() ) {
498 498
 			return $plupload_init;
499 499
 		}
500 500
 
501
-		$plupload_init['gf_vars']['max_files'] = 0;
501
+		$plupload_init[ 'gf_vars' ][ 'max_files' ] = 0;
502 502
 
503 503
 		return $plupload_init;
504 504
 	}
@@ -513,22 +513,22 @@  discard block
 block discarded – undo
513 513
 		$form = $this->form;
514 514
 
515 515
 	    /** @var GF_Field $field */
516
-		foreach( $form['fields'] as $k => &$field ) {
516
+		foreach ( $form[ 'fields' ] as $k => &$field ) {
517 517
 
518 518
 			/**
519 519
 			 * Remove the fields with calculation formulas before save to avoid conflicts with GF logic
520 520
 			 * @since 1.16.3
521 521
 			 * @var GF_Field $field
522 522
 			 */
523
-			if( $field->has_calculation() ) {
524
-				unset( $form['fields'][ $k ] );
523
+			if ( $field->has_calculation() ) {
524
+				unset( $form[ 'fields' ][ $k ] );
525 525
 			}
526 526
 
527 527
 			$field->adminOnly = false;
528 528
 
529
-			if( isset( $field->inputs ) && is_array( $field->inputs ) ) {
530
-				foreach( $field->inputs as $key => $input ) {
531
-				    $field->inputs[ $key ][ 'id' ] = (string)$input['id'];
529
+			if ( isset( $field->inputs ) && is_array( $field->inputs ) ) {
530
+				foreach ( $field->inputs as $key => $input ) {
531
+				    $field->inputs[ $key ][ 'id' ] = (string)$input[ 'id' ];
532 532
 				}
533 533
 			}
534 534
 		}
@@ -542,30 +542,30 @@  discard block
 block discarded – undo
542 542
 		$update = false;
543 543
 
544 544
 		// get the most up to date entry values
545
-		$entry = GFAPI::get_entry( $this->entry['id'] );
545
+		$entry = GFAPI::get_entry( $this->entry[ 'id' ] );
546 546
 
547
-		if( !empty( $this->fields_with_calculation ) ) {
547
+		if ( ! empty( $this->fields_with_calculation ) ) {
548 548
 			$update = true;
549 549
 			foreach ( $this->fields_with_calculation as $calc_field ) {
550 550
 				$inputs = $calc_field->get_entry_inputs();
551 551
 				if ( is_array( $inputs ) ) {
552 552
 				    foreach ( $inputs as $input ) {
553
-				        $input_name = 'input_' . str_replace( '.', '_', $input['id'] );
554
-				        $entry[ strval( $input['id'] ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
553
+				        $input_name = 'input_' . str_replace( '.', '_', $input[ 'id' ] );
554
+				        $entry[ strval( $input[ 'id' ] ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry[ 'id' ], $entry );
555 555
 				    }
556 556
 				} else {
557
-				    $input_name = 'input_' . str_replace( '.', '_', $calc_field->id);
558
-				    $entry[ strval( $calc_field->id ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
557
+				    $input_name = 'input_' . str_replace( '.', '_', $calc_field->id );
558
+				    $entry[ strval( $calc_field->id ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry[ 'id' ], $entry );
559 559
 				}
560 560
 			}
561 561
 
562 562
 		}
563 563
 
564
-		if( $update ) {
564
+		if ( $update ) {
565 565
 
566 566
 			$return_entry = GFAPI::update_entry( $entry );
567 567
 
568
-			if( is_wp_error( $return_entry ) ) {
568
+			if ( is_wp_error( $return_entry ) ) {
569 569
 				gravityview()->log->error( 'Updating the entry calculation fields failed', array( 'data' => $return_entry ) );
570 570
 			} else {
571 571
 				gravityview()->log->debug( 'Updating the entry calculation fields succeeded' );
@@ -596,19 +596,19 @@  discard block
 block discarded – undo
596 596
 
597 597
 		$input_name = 'input_' . $field_id;
598 598
 
599
-		if ( !empty( $_FILES[ $input_name ]['name'] ) ) {
599
+		if ( ! empty( $_FILES[ $input_name ][ 'name' ] ) ) {
600 600
 
601 601
 			// We have a new image
602 602
 
603
-			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'] );
603
+			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ] );
604 604
 
605 605
 			$ary = ! empty( $value ) ? explode( '|:|', $value ) : array();
606 606
 	        $ary = stripslashes_deep( $ary );
607 607
 			$img_url = \GV\Utils::get( $ary, 0 );
608 608
 
609
-			$img_title       = count( $ary ) > 1 ? $ary[1] : '';
610
-			$img_caption     = count( $ary ) > 2 ? $ary[2] : '';
611
-			$img_description = count( $ary ) > 3 ? $ary[3] : '';
609
+			$img_title       = count( $ary ) > 1 ? $ary[ 1 ] : '';
610
+			$img_caption     = count( $ary ) > 2 ? $ary[ 2 ] : '';
611
+			$img_description = count( $ary ) > 3 ? $ary[ 3 ] : '';
612 612
 
613 613
 			$image_meta = array(
614 614
 				'post_excerpt' => $img_caption,
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
 
618 618
 			//adding title only if it is not empty. It will default to the file name if it is not in the array
619 619
 			if ( ! empty( $img_title ) ) {
620
-				$image_meta['post_title'] = $img_title;
620
+				$image_meta[ 'post_title' ] = $img_title;
621 621
 			}
622 622
 
623 623
 			/**
@@ -675,15 +675,15 @@  discard block
 block discarded – undo
675 675
 	 */
676 676
 	private function maybe_update_post_fields( $form ) {
677 677
 
678
-		if( empty( $this->entry['post_id'] ) ) {
678
+		if ( empty( $this->entry[ 'post_id' ] ) ) {
679 679
 	        gravityview()->log->debug( 'This entry has no post fields. Continuing...' );
680 680
 			return;
681 681
 		}
682 682
 
683
-		$post_id = $this->entry['post_id'];
683
+		$post_id = $this->entry[ 'post_id' ];
684 684
 
685 685
 		// Security check
686
-		if( false === GVCommon::has_cap( 'edit_post', $post_id ) ) {
686
+		if ( false === GVCommon::has_cap( 'edit_post', $post_id ) ) {
687 687
 			gravityview()->log->error( 'The current user does not have the ability to edit Post #{post_id}', array( 'post_id' => $post_id ) );
688 688
 			return;
689 689
 		}
@@ -696,25 +696,25 @@  discard block
 block discarded – undo
696 696
 
697 697
 			$field = RGFormsModel::get_field( $form, $field_id );
698 698
 
699
-			if( ! $field ) {
699
+			if ( ! $field ) {
700 700
 				continue;
701 701
 			}
702 702
 
703
-			if( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) {
703
+			if ( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) {
704 704
 
705 705
 				// Get the value of the field, including $_POSTed value
706 706
 				$value = RGFormsModel::get_field_value( $field );
707 707
 
708 708
 				// Use temporary entry variable, to make values available to fill_post_template() and update_post_image()
709 709
 				$entry_tmp = $this->entry;
710
-				$entry_tmp["{$field_id}"] = $value;
710
+				$entry_tmp[ "{$field_id}" ] = $value;
711 711
 
712
-				switch( $field->type ) {
712
+				switch ( $field->type ) {
713 713
 
714 714
 				    case 'post_title':
715 715
 				        $post_title = $value;
716 716
 				        if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) {
717
-				            $post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
717
+				            $post_title = $this->fill_post_template( $form[ 'postTitleTemplate' ], $form, $entry_tmp );
718 718
 				        }
719 719
 				        $updated_post->post_title = $post_title;
720 720
 				        $updated_post->post_name  = $post_title;
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
 				    case 'post_content':
725 725
 				        $post_content = $value;
726 726
 				        if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) {
727
-				            $post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
727
+				            $post_content = $this->fill_post_template( $form[ 'postContentTemplate' ], $form, $entry_tmp, true );
728 728
 				        }
729 729
 				        $updated_post->post_content = $post_content;
730 730
 				        unset( $post_content );
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
 							$value = $value[ $field_id ];
743 743
 						}
744 744
 
745
-				        if( ! empty( $field->customFieldTemplateEnabled ) ) {
745
+				        if ( ! empty( $field->customFieldTemplateEnabled ) ) {
746 746
 				            $value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
747 747
 				        }
748 748
 
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
 				}
761 761
 
762 762
 				// update entry after
763
-				$this->entry["{$field_id}"] = $value;
763
+				$this->entry[ "{$field_id}" ] = $value;
764 764
 
765 765
 				$update_entry = true;
766 766
 
@@ -769,11 +769,11 @@  discard block
 block discarded – undo
769 769
 
770 770
 		}
771 771
 
772
-		if( $update_entry ) {
772
+		if ( $update_entry ) {
773 773
 
774 774
 			$return_entry = GFAPI::update_entry( $this->entry );
775 775
 
776
-			if( is_wp_error( $return_entry ) ) {
776
+			if ( is_wp_error( $return_entry ) ) {
777 777
 				gravityview()->log->error( 'Updating the entry post fields failed', array( 'data' => array( '$this->entry' => $this->entry, '$return_entry' => $return_entry ) ) );
778 778
 			} else {
779 779
 				gravityview()->log->debug( 'Updating the entry post fields for post #{post_id} succeeded', array( 'post_id' => $post_id ) );
@@ -783,7 +783,7 @@  discard block
 block discarded – undo
783 783
 
784 784
 		$return_post = wp_update_post( $updated_post, true );
785 785
 
786
-		if( is_wp_error( $return_post ) ) {
786
+		if ( is_wp_error( $return_post ) ) {
787 787
 			$return_post->add_data( $updated_post, '$updated_post' );
788 788
 			gravityview()->log->error( 'Updating the post content failed', array( 'data' => compact( 'updated_post', 'return_post' ) ) );
789 789
 		} else {
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
 		$input_type = RGFormsModel::get_input_type( $field );
806 806
 
807 807
 	    // Only certain custom field types are supported
808
-	    switch( $input_type ) {
808
+	    switch ( $input_type ) {
809 809
 		    case 'fileupload':
810 810
 		    case 'list':
811 811
 		    case 'multiselect':
@@ -842,7 +842,7 @@  discard block
 block discarded – undo
842 842
 		$output = GFCommon::replace_variables( $output, $form, $entry, false, false, false );
843 843
 
844 844
 		// replace conditional shortcodes
845
-		if( $do_shortcode ) {
845
+		if ( $do_shortcode ) {
846 846
 			$output = do_shortcode( $output );
847 847
 		}
848 848
 
@@ -861,19 +861,19 @@  discard block
 block discarded – undo
861 861
 	 */
862 862
 	private function after_update() {
863 863
 
864
-		do_action( 'gform_after_update_entry', $this->form, $this->entry['id'], self::$original_entry );
865
-		do_action( "gform_after_update_entry_{$this->form['id']}", $this->form, $this->entry['id'], self::$original_entry );
864
+		do_action( 'gform_after_update_entry', $this->form, $this->entry[ 'id' ], self::$original_entry );
865
+		do_action( "gform_after_update_entry_{$this->form[ 'id' ]}", $this->form, $this->entry[ 'id' ], self::$original_entry );
866 866
 
867 867
 		// Re-define the entry now that we've updated it.
868
-		$entry = RGFormsModel::get_lead( $this->entry['id'] );
868
+		$entry = RGFormsModel::get_lead( $this->entry[ 'id' ] );
869 869
 
870 870
 		$entry = GFFormsModel::set_entry_meta( $entry, $this->form );
871 871
 
872 872
 		if ( version_compare( GFFormsModel::get_database_version(), '2.3-dev-1', '<' ) ) {
873 873
 			// We need to clear the cache because Gravity Forms caches the field values, which
874 874
 			// we have just updated.
875
-			foreach ($this->form['fields'] as $key => $field) {
876
-				GFFormsModel::refresh_lead_field_value( $entry['id'], $field->id );
875
+			foreach ( $this->form[ 'fields' ] as $key => $field ) {
876
+				GFFormsModel::refresh_lead_field_value( $entry[ 'id' ], $field->id );
877 877
 			}
878 878
 		}
879 879
 
@@ -892,7 +892,7 @@  discard block
 block discarded – undo
892 892
 
893 893
 		<div class="gv-edit-entry-wrapper"><?php
894 894
 
895
-			$javascript = gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/inline-javascript.php', $this );
895
+			$javascript = gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/inline-javascript.php', $this );
896 896
 
897 897
 			/**
898 898
 			 * Fixes weird wpautop() issue
@@ -908,7 +908,7 @@  discard block
 block discarded – undo
908 908
 				     * @param string $edit_entry_title Modify the "Edit Entry" title
909 909
 				     * @param GravityView_Edit_Entry_Render $this This object
910 910
 				     */
911
-				    $edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
911
+				    $edit_entry_title = apply_filters( 'gravityview_edit_entry_title', __( 'Edit Entry', 'gravityview' ), $this );
912 912
 
913 913
 				    echo esc_attr( $edit_entry_title );
914 914
 			?></span>
@@ -958,16 +958,16 @@  discard block
 block discarded – undo
958 958
 
959 959
 			$back_link = esc_url( remove_query_arg( array( 'page', 'view', 'edit' ) ) );
960 960
 
961
-			if( ! $this->is_valid ){
961
+			if ( ! $this->is_valid ) {
962 962
 
963 963
 				// Keeping this compatible with Gravity Forms.
964
-				$validation_message = "<div class='validation_error'>" . __('There was a problem with your submission.', 'gravityview') . " " . __('Errors have been highlighted below.', 'gravityview') . "</div>";
965
-				$message = apply_filters("gform_validation_message_{$this->form['id']}", apply_filters("gform_validation_message", $validation_message, $this->form), $this->form);
964
+				$validation_message = "<div class='validation_error'>" . __( 'There was a problem with your submission.', 'gravityview' ) . " " . __( 'Errors have been highlighted below.', 'gravityview' ) . "</div>";
965
+				$message = apply_filters( "gform_validation_message_{$this->form[ 'id' ]}", apply_filters( "gform_validation_message", $validation_message, $this->form ), $this->form );
966 966
 
967
-				echo GVCommon::generate_notice( $message , 'gv-error' );
967
+				echo GVCommon::generate_notice( $message, 'gv-error' );
968 968
 
969 969
 			} else {
970
-				$entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturn to Entry%s', 'gravityview'), '<a href="'. $back_link .'">', '</a>' );
970
+				$entry_updated_message = sprintf( esc_attr__( 'Entry Updated. %sReturn to Entry%s', 'gravityview' ), '<a href="' . $back_link . '">', '</a>' );
971 971
 
972 972
 				/**
973 973
 				 * @filter `gravityview/edit_entry/success` Modify the edit entry success message (including the anchor link)
@@ -977,7 +977,7 @@  discard block
 block discarded – undo
977 977
 				 * @param array $entry Gravity Forms entry array
978 978
 				 * @param string $back_link URL to return to the original entry. @since 1.6
979 979
 				 */
980
-				$message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message , $this->view_id, $this->entry, $back_link );
980
+				$message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message, $this->view_id, $this->entry, $back_link );
981 981
 
982 982
 				echo GVCommon::generate_notice( $message );
983 983
 			}
@@ -1001,21 +1001,21 @@  discard block
 block discarded – undo
1001 1001
 		 */
1002 1002
 		do_action( 'gravityview/edit-entry/render/before', $this );
1003 1003
 
1004
-		add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields'), 5000, 3 );
1005
-		add_filter( 'gform_submit_button', array( $this, 'render_form_buttons') );
1004
+		add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000, 3 );
1005
+		add_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) );
1006 1006
 		add_filter( 'gform_disable_view_counter', '__return_true' );
1007 1007
 
1008 1008
 		add_filter( 'gform_field_input', array( $this, 'verify_user_can_edit_post' ), 5, 5 );
1009 1009
 		add_filter( 'gform_field_input', array( $this, 'modify_edit_field_input' ), 10, 5 );
1010 1010
 
1011 1011
 		// We need to remove the fake $_GET['page'] arg to avoid rendering form as if in admin.
1012
-		unset( $_GET['page'] );
1012
+		unset( $_GET[ 'page' ] );
1013 1013
 
1014 1014
 		// TODO: Verify multiple-page forms
1015 1015
 
1016 1016
 		ob_start(); // Prevent PHP warnings possibly caused by prefilling list fields for conditional logic
1017 1017
 
1018
-		$html = GFFormDisplay::get_form( $this->form['id'], false, false, true, $this->entry );
1018
+		$html = GFFormDisplay::get_form( $this->form[ 'id' ], false, false, true, $this->entry );
1019 1019
 
1020 1020
 		ob_get_clean();
1021 1021
 
@@ -1041,7 +1041,7 @@  discard block
 block discarded – undo
1041 1041
 	 * @return string
1042 1042
 	 */
1043 1043
 	public function render_form_buttons() {
1044
-		return gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/form-buttons.php', $this );
1044
+		return gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/form-buttons.php', $this );
1045 1045
 	}
1046 1046
 
1047 1047
 
@@ -1061,10 +1061,10 @@  discard block
 block discarded – undo
1061 1061
 	public function filter_modify_form_fields( $form, $ajax = false, $field_values = '' ) {
1062 1062
 
1063 1063
 		// In case we have validated the form, use it to inject the validation results into the form render
1064
-		if( isset( $this->form_after_validation ) ) {
1064
+		if ( isset( $this->form_after_validation ) ) {
1065 1065
 			$form = $this->form_after_validation;
1066 1066
 		} else {
1067
-			$form['fields'] = $this->get_configured_edit_fields( $form, $this->view_id );
1067
+			$form[ 'fields' ] = $this->get_configured_edit_fields( $form, $this->view_id );
1068 1068
 		}
1069 1069
 
1070 1070
 		$form = $this->filter_conditional_logic( $form );
@@ -1072,8 +1072,8 @@  discard block
 block discarded – undo
1072 1072
 		$form = $this->prefill_conditional_logic( $form );
1073 1073
 
1074 1074
 		// for now we don't support Save and Continue feature.
1075
-		if( ! self::$supports_save_and_continue ) {
1076
-	        unset( $form['save'] );
1075
+		if ( ! self::$supports_save_and_continue ) {
1076
+	        unset( $form[ 'save' ] );
1077 1077
 		}
1078 1078
 
1079 1079
 		$form = $this->unselect_default_values( $form );
@@ -1096,31 +1096,31 @@  discard block
 block discarded – undo
1096 1096
 	 */
1097 1097
 	public function verify_user_can_edit_post( $field_content = '', $field, $value, $lead_id = 0, $form_id ) {
1098 1098
 
1099
-		if( ! GFCommon::is_post_field( $field ) ) {
1099
+		if ( ! GFCommon::is_post_field( $field ) ) {
1100 1100
 			return $field_content;
1101 1101
 		}
1102 1102
 
1103 1103
         $message = null;
1104 1104
 
1105 1105
         // First, make sure they have the capability to edit the post.
1106
-        if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) {
1106
+        if ( false === current_user_can( 'edit_post', $this->entry[ 'post_id' ] ) ) {
1107 1107
 
1108 1108
             /**
1109 1109
              * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post
1110 1110
              * @param string $message The existing "You don't have permission..." text
1111 1111
              */
1112
-            $message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don&rsquo;t have permission to edit this post.', 'gravityview') );
1112
+            $message = apply_filters( 'gravityview/edit_entry/unsupported_post_field_text', __( 'You don&rsquo;t have permission to edit this post.', 'gravityview' ) );
1113 1113
 
1114
-        } elseif( null === get_post( $this->entry['post_id'] ) ) {
1114
+        } elseif ( null === get_post( $this->entry[ 'post_id' ] ) ) {
1115 1115
             /**
1116 1116
              * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists
1117 1117
              * @param string $message The existing "This field is not editable; the post no longer exists." text
1118 1118
              */
1119
-            $message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) );
1119
+            $message = apply_filters( 'gravityview/edit_entry/no_post_text', __( 'This field is not editable; the post no longer exists.', 'gravityview' ) );
1120 1120
         }
1121 1121
 
1122
-        if( $message ) {
1123
-            $field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1122
+        if ( $message ) {
1123
+            $field_content = sprintf( '<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1124 1124
         }
1125 1125
 
1126 1126
         return $field_content;
@@ -1144,8 +1144,8 @@  discard block
 block discarded – undo
1144 1144
 
1145 1145
 		// If the form has been submitted, then we don't need to pre-fill the values,
1146 1146
 		// Except for fileupload type and when a field input is overridden- run always!!
1147
-		if(
1148
-			( $this->is_edit_entry_submission() && !in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
1147
+		if (
1148
+			( $this->is_edit_entry_submission() && ! in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
1149 1149
 			&& false === ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) )
1150 1150
 			&& ! GFCommon::is_product_field( $field->type )
1151 1151
 			|| ! empty( $field_content )
@@ -1165,7 +1165,7 @@  discard block
 block discarded – undo
1165 1165
 	    $return = null;
1166 1166
 
1167 1167
 		/** @var GravityView_Field $gv_field */
1168
-		if( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1168
+		if ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1169 1169
 			$return = $gv_field->get_field_input( $this->form, $field_value, $this->entry, $field );
1170 1170
 		} else {
1171 1171
 	        $return = $field->get_field_input( $this->form, $field_value, $this->entry );
@@ -1174,7 +1174,7 @@  discard block
 block discarded – undo
1174 1174
 	    // If there was output, it's an error
1175 1175
 	    $warnings = ob_get_clean();
1176 1176
 
1177
-	    if( !empty( $warnings ) ) {
1177
+	    if ( ! empty( $warnings ) ) {
1178 1178
 		    gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1179 1179
 	    }
1180 1180
 
@@ -1199,7 +1199,7 @@  discard block
 block discarded – undo
1199 1199
 		$override_saved_value = apply_filters( 'gravityview/edit_entry/pre_populate/override', false, $field );
1200 1200
 
1201 1201
 		// We're dealing with multiple inputs (e.g. checkbox) but not time or date (as it doesn't store data in input IDs)
1202
-		if( isset( $field->inputs ) && is_array( $field->inputs ) && !in_array( $field->type, array( 'time', 'date' ) ) ) {
1202
+		if ( isset( $field->inputs ) && is_array( $field->inputs ) && ! in_array( $field->type, array( 'time', 'date' ) ) ) {
1203 1203
 
1204 1204
 			$field_value = array();
1205 1205
 
@@ -1208,10 +1208,10 @@  discard block
 block discarded – undo
1208 1208
 
1209 1209
 			foreach ( (array)$field->inputs as $input ) {
1210 1210
 
1211
-				$input_id = strval( $input['id'] );
1211
+				$input_id = strval( $input[ 'id' ] );
1212 1212
 				
1213 1213
 				if ( isset( $this->entry[ $input_id ] ) && ! gv_empty( $this->entry[ $input_id ], false, false ) ) {
1214
-				    $field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1214
+				    $field_value[ $input_id ] = 'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1215 1215
 				    $allow_pre_populated = false;
1216 1216
 				}
1217 1217
 
@@ -1219,7 +1219,7 @@  discard block
 block discarded – undo
1219 1219
 
1220 1220
 			$pre_value = $field->get_value_submission( array(), false );
1221 1221
 
1222
-			$field_value = ! $allow_pre_populated && ! ( $override_saved_value && !gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
1222
+			$field_value = ! $allow_pre_populated && ! ( $override_saved_value && ! gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
1223 1223
 
1224 1224
 		} else {
1225 1225
 
@@ -1230,13 +1230,13 @@  discard block
 block discarded – undo
1230 1230
 
1231 1231
 			// saved field entry value (if empty, fallback to the pre-populated value, if exists)
1232 1232
 			// or pre-populated value if not empty and set to override saved value
1233
-			$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;
1233
+			$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;
1234 1234
 
1235 1235
 			// in case field is post_category but inputType is select, multi-select or radio, convert value into array of category IDs.
1236
-			if ( 'post_category' === $field->type && !gv_empty( $field_value, false, false ) ) {
1236
+			if ( 'post_category' === $field->type && ! gv_empty( $field_value, false, false ) ) {
1237 1237
 				$categories = array();
1238 1238
 				foreach ( explode( ',', $field_value ) as $cat_string ) {
1239
-				    $categories[] = GFCommon::format_post_category( $cat_string, true );
1239
+				    $categories[ ] = GFCommon::format_post_category( $cat_string, true );
1240 1240
 				}
1241 1241
 				$field_value = 'multiselect' === $field->get_input_type() ? $categories : implode( '', $categories );
1242 1242
 			}
@@ -1264,7 +1264,7 @@  discard block
 block discarded – undo
1264 1264
 	     * @param GF_Field $field Gravity Forms field object
1265 1265
 	     * @param GravityView_Edit_Entry_Render $this Current object
1266 1266
 	     */
1267
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1267
+	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type, $field_value, $field, $this );
1268 1268
 
1269 1269
 		return $field_value;
1270 1270
 	}
@@ -1281,12 +1281,12 @@  discard block
 block discarded – undo
1281 1281
 	 */
1282 1282
 	public function gform_pre_validation( $form ) {
1283 1283
 
1284
-		if( ! $this->verify_nonce() ) {
1284
+		if ( ! $this->verify_nonce() ) {
1285 1285
 			return $form;
1286 1286
 		}
1287 1287
 
1288 1288
 		// Fix PHP warning regarding undefined index.
1289
-		foreach ( $form['fields'] as &$field) {
1289
+		foreach ( $form[ 'fields' ] as &$field ) {
1290 1290
 
1291 1291
 			// This is because we're doing admin form pretending to be front-end, so Gravity Forms
1292 1292
 			// expects certain field array items to be set.
@@ -1294,7 +1294,7 @@  discard block
 block discarded – undo
1294 1294
 	            $field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1295 1295
 			}
1296 1296
 
1297
-			switch( RGFormsModel::get_input_type( $field ) ) {
1297
+			switch ( RGFormsModel::get_input_type( $field ) ) {
1298 1298
 
1299 1299
 				/**
1300 1300
 				 * 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.
@@ -1308,26 +1308,26 @@  discard block
 block discarded – undo
1308 1308
 				    // Set the previous value
1309 1309
 				    $entry = $this->get_entry();
1310 1310
 
1311
-				    $input_name = 'input_'.$field->id;
1312
-				    $form_id = $form['id'];
1311
+				    $input_name = 'input_' . $field->id;
1312
+				    $form_id = $form[ 'id' ];
1313 1313
 
1314 1314
 				    $value = NULL;
1315 1315
 
1316 1316
 				    // Use the previous entry value as the default.
1317
-				    if( isset( $entry[ $field->id ] ) ) {
1317
+				    if ( isset( $entry[ $field->id ] ) ) {
1318 1318
 				        $value = $entry[ $field->id ];
1319 1319
 				    }
1320 1320
 
1321 1321
 				    // If this is a single upload file
1322
-				    if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1323
-				        $file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1324
-				        $value = $file_path['url'];
1322
+				    if ( ! empty( $_FILES[ $input_name ] ) && ! empty( $_FILES[ $input_name ][ 'name' ] ) ) {
1323
+				        $file_path = GFFormsModel::get_file_upload_path( $form[ 'id' ], $_FILES[ $input_name ][ 'name' ] );
1324
+				        $value = $file_path[ 'url' ];
1325 1325
 
1326 1326
 				    } else {
1327 1327
 
1328 1328
 				        // Fix PHP warning on line 1498 of form_display.php for post_image fields
1329 1329
 				        // Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1330
-				        $_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1330
+				        $_FILES[ $input_name ] = array( 'name' => '', 'size' => '' );
1331 1331
 
1332 1332
 				    }
1333 1333
 
@@ -1335,10 +1335,10 @@  discard block
 block discarded – undo
1335 1335
 
1336 1336
 				        // If there are fresh uploads, process and merge them.
1337 1337
 				        // Otherwise, use the passed values, which should be json-encoded array of URLs
1338
-				        if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) {
1338
+				        if ( isset( GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] ) ) {
1339 1339
 				            $value = empty( $value ) ? '[]' : $value;
1340 1340
 				            $value = stripslashes_deep( $value );
1341
-				            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array());
1341
+				            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ], array() );
1342 1342
 				        }
1343 1343
 
1344 1344
 				    } else {
@@ -1356,8 +1356,8 @@  discard block
 block discarded – undo
1356 1356
 
1357 1357
 				case 'number':
1358 1358
 				    // Fix "undefined index" issue at line 1286 in form_display.php
1359
-				    if( !isset( $_POST['input_'.$field->id ] ) ) {
1360
-				        $_POST['input_'.$field->id ] = NULL;
1359
+				    if ( ! isset( $_POST[ 'input_' . $field->id ] ) ) {
1360
+				        $_POST[ 'input_' . $field->id ] = NULL;
1361 1361
 				    }
1362 1362
 				    break;
1363 1363
 			}
@@ -1394,7 +1394,7 @@  discard block
 block discarded – undo
1394 1394
 		 * You can enter whatever you want!
1395 1395
 		 * We try validating, and customize the results using `self::custom_validation()`
1396 1396
 		 */
1397
-		add_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10, 4);
1397
+		add_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10, 4 );
1398 1398
 
1399 1399
 		// Needed by the validate funtion
1400 1400
 		$failed_validation_page = NULL;
@@ -1402,14 +1402,14 @@  discard block
 block discarded – undo
1402 1402
 
1403 1403
 		// Prevent entry limit from running when editing an entry, also
1404 1404
 		// prevent form scheduling from preventing editing
1405
-		unset( $this->form['limitEntries'], $this->form['scheduleForm'] );
1405
+		unset( $this->form[ 'limitEntries' ], $this->form[ 'scheduleForm' ] );
1406 1406
 
1407 1407
 		// Hide fields depending on Edit Entry settings
1408
-		$this->form['fields'] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1408
+		$this->form[ 'fields' ] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1409 1409
 
1410 1410
 		$this->is_valid = GFFormDisplay::validate( $this->form, $field_values, 1, $failed_validation_page );
1411 1411
 
1412
-		remove_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10 );
1412
+		remove_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10 );
1413 1413
 	}
1414 1414
 
1415 1415
 
@@ -1432,7 +1432,7 @@  discard block
 block discarded – undo
1432 1432
 
1433 1433
 		$gv_valid = true;
1434 1434
 
1435
-		foreach ( $validation_results['form']['fields'] as $key => &$field ) {
1435
+		foreach ( $validation_results[ 'form' ][ 'fields' ] as $key => &$field ) {
1436 1436
 
1437 1437
 			$value = RGFormsModel::get_field_value( $field );
1438 1438
 			$field_type = RGFormsModel::get_input_type( $field );
@@ -1445,35 +1445,35 @@  discard block
 block discarded – undo
1445 1445
 				case 'post_image':
1446 1446
 
1447 1447
 				    // in case nothing is uploaded but there are already files saved
1448
-				    if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) {
1448
+				    if ( ! empty( $field->failed_validation ) && ! empty( $field->isRequired ) && ! empty( $value ) ) {
1449 1449
 				        $field->failed_validation = false;
1450 1450
 				        unset( $field->validation_message );
1451 1451
 				    }
1452 1452
 
1453 1453
 				    // validate if multi file upload reached max number of files [maxFiles] => 2
1454
-				    if( \GV\Utils::get( $field, 'maxFiles') && \GV\Utils::get( $field, 'multipleFiles') ) {
1454
+				    if ( \GV\Utils::get( $field, 'maxFiles' ) && \GV\Utils::get( $field, 'multipleFiles' ) ) {
1455 1455
 
1456 1456
 				        $input_name = 'input_' . $field->id;
1457 1457
 				        //uploaded
1458
-				        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1458
+				        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] : array();
1459 1459
 
1460 1460
 				        //existent
1461 1461
 				        $entry = $this->get_entry();
1462 1462
 				        $value = NULL;
1463
-				        if( isset( $entry[ $field->id ] ) ) {
1463
+				        if ( isset( $entry[ $field->id ] ) ) {
1464 1464
 				            $value = json_decode( $entry[ $field->id ], true );
1465 1465
 				        }
1466 1466
 
1467 1467
 				        // count uploaded files and existent entry files
1468 1468
 				        $count_files = count( $file_names ) + count( $value );
1469 1469
 
1470
-				        if( $count_files > $field->maxFiles ) {
1470
+				        if ( $count_files > $field->maxFiles ) {
1471 1471
 				            $field->validation_message = __( 'Maximum number of files reached', 'gravityview' );
1472 1472
 				            $field->failed_validation = 1;
1473 1473
 				            $gv_valid = false;
1474 1474
 
1475 1475
 				            // in case of error make sure the newest upload files are removed from the upload input
1476
-				            GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1476
+				            GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ] = null;
1477 1477
 				        }
1478 1478
 
1479 1479
 				    }
@@ -1484,7 +1484,7 @@  discard block
 block discarded – undo
1484 1484
 			}
1485 1485
 
1486 1486
 			// This field has failed validation.
1487
-			if( !empty( $field->failed_validation ) ) {
1487
+			if ( ! empty( $field->failed_validation ) ) {
1488 1488
 
1489 1489
 				gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field is invalid.', array( 'data' => array( 'field' => $field, 'value' => $value ) ) );
1490 1490
 
@@ -1502,19 +1502,19 @@  discard block
 block discarded – undo
1502 1502
 				}
1503 1503
 
1504 1504
 				// You can't continue inside a switch, so we do it after.
1505
-				if( empty( $field->failed_validation ) ) {
1505
+				if ( empty( $field->failed_validation ) ) {
1506 1506
 				    continue;
1507 1507
 				}
1508 1508
 
1509 1509
 				// checks if the No Duplicates option is not validating entry against itself, since
1510 1510
 				// we're editing a stored entry, it would also assume it's a duplicate.
1511
-				if( !empty( $field->noDuplicates ) ) {
1511
+				if ( ! empty( $field->noDuplicates ) ) {
1512 1512
 
1513 1513
 				    $entry = $this->get_entry();
1514 1514
 
1515 1515
 				    // If the value of the entry is the same as the stored value
1516 1516
 				    // Then we can assume it's not a duplicate, it's the same.
1517
-				    if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1517
+				    if ( ! empty( $entry ) && $value == $entry[ $field->id ] ) {
1518 1518
 				        //if value submitted was not changed, then don't validate
1519 1519
 				        $field->failed_validation = false;
1520 1520
 
@@ -1527,7 +1527,7 @@  discard block
 block discarded – undo
1527 1527
 				}
1528 1528
 
1529 1529
 				// if here then probably we are facing the validation 'At least one field must be filled out'
1530
-				if( GFFormDisplay::is_empty( $field, $this->form_id  ) && empty( $field->isRequired ) ) {
1530
+				if ( GFFormDisplay::is_empty( $field, $this->form_id ) && empty( $field->isRequired ) ) {
1531 1531
 				    unset( $field->validation_message );
1532 1532
 	                $field->validation_message = false;
1533 1533
 				    continue;
@@ -1539,12 +1539,12 @@  discard block
 block discarded – undo
1539 1539
 
1540 1540
 		}
1541 1541
 
1542
-		$validation_results['is_valid'] = $gv_valid;
1542
+		$validation_results[ 'is_valid' ] = $gv_valid;
1543 1543
 
1544 1544
 		gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Validation results.', array( 'data' => $validation_results ) );
1545 1545
 
1546 1546
 		// We'll need this result when rendering the form ( on GFFormDisplay::get_form )
1547
-		$this->form_after_validation = $validation_results['form'];
1547
+		$this->form_after_validation = $validation_results[ 'form' ];
1548 1548
 
1549 1549
 		return $validation_results;
1550 1550
 	}
@@ -1557,7 +1557,7 @@  discard block
 block discarded – undo
1557 1557
 	 */
1558 1558
 	public function get_entry() {
1559 1559
 
1560
-		if( empty( $this->entry ) ) {
1560
+		if ( empty( $this->entry ) ) {
1561 1561
 			// Get the database value of the entry that's being edited
1562 1562
 			$this->entry = gravityview_get_entry( GravityView_frontend::is_single_entry() );
1563 1563
 		}
@@ -1589,10 +1589,10 @@  discard block
 block discarded – undo
1589 1589
 		}
1590 1590
 
1591 1591
 		// If edit tab not yet configured, show all fields
1592
-		$edit_fields = !empty( $properties['edit_edit-fields'] ) ? $properties['edit_edit-fields'] : NULL;
1592
+		$edit_fields = ! empty( $properties[ 'edit_edit-fields' ] ) ? $properties[ 'edit_edit-fields' ] : NULL;
1593 1593
 
1594 1594
 		// Hide fields depending on admin settings
1595
-		$fields = $this->filter_fields( $form['fields'], $edit_fields );
1595
+		$fields = $this->filter_fields( $form[ 'fields' ], $edit_fields );
1596 1596
 
1597 1597
 	    // If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1598 1598
 	    $fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
@@ -1624,7 +1624,7 @@  discard block
 block discarded – undo
1624 1624
 	 */
1625 1625
 	private function filter_fields( $fields, $configured_fields ) {
1626 1626
 
1627
-		if( empty( $fields ) || !is_array( $fields ) ) {
1627
+		if ( empty( $fields ) || ! is_array( $fields ) ) {
1628 1628
 			return $fields;
1629 1629
 		}
1630 1630
 
@@ -1637,18 +1637,18 @@  discard block
 block discarded – undo
1637 1637
 
1638 1638
 			// Remove the fields that have calculation properties and keep them to be used later
1639 1639
 			// @since 1.16.2
1640
-			if( $field->has_calculation() ) {
1641
-				$this->fields_with_calculation[] = $field;
1640
+			if ( $field->has_calculation() ) {
1641
+				$this->fields_with_calculation[ ] = $field;
1642 1642
 				// don't remove the calculation fields on form render.
1643 1643
 			}
1644 1644
 
1645
-			if( in_array( $field->type, $field_type_blacklist ) ) {
1645
+			if ( in_array( $field->type, $field_type_blacklist ) ) {
1646 1646
 				unset( $fields[ $key ] );
1647 1647
 			}
1648 1648
 		}
1649 1649
 
1650 1650
 		// The Edit tab has not been configured, so we return all fields by default.
1651
-		if( empty( $configured_fields ) ) {
1651
+		if ( empty( $configured_fields ) ) {
1652 1652
 			return $fields;
1653 1653
 		}
1654 1654
 
@@ -1657,8 +1657,8 @@  discard block
 block discarded – undo
1657 1657
 
1658 1658
 	        /** @var GF_Field $field */
1659 1659
 	        foreach ( $fields as $field ) {
1660
-				if( intval( $configured_field['id'] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1661
-				    $edit_fields[] = $this->merge_field_properties( $field, $configured_field );
1660
+				if ( intval( $configured_field[ 'id' ] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1661
+				    $edit_fields[ ] = $this->merge_field_properties( $field, $configured_field );
1662 1662
 				    break;
1663 1663
 				}
1664 1664
 
@@ -1681,14 +1681,14 @@  discard block
 block discarded – undo
1681 1681
 
1682 1682
 		$return_field = $field;
1683 1683
 
1684
-		if( empty( $field_setting['show_label'] ) ) {
1684
+		if ( empty( $field_setting[ 'show_label' ] ) ) {
1685 1685
 			$return_field->label = '';
1686
-		} elseif ( !empty( $field_setting['custom_label'] ) ) {
1687
-			$return_field->label = $field_setting['custom_label'];
1686
+		} elseif ( ! empty( $field_setting[ 'custom_label' ] ) ) {
1687
+			$return_field->label = $field_setting[ 'custom_label' ];
1688 1688
 		}
1689 1689
 
1690
-		if( !empty( $field_setting['custom_class'] ) ) {
1691
-			$return_field->cssClass .= ' '. gravityview_sanitize_html_class( $field_setting['custom_class'] );
1690
+		if ( ! empty( $field_setting[ 'custom_class' ] ) ) {
1691
+			$return_field->cssClass .= ' ' . gravityview_sanitize_html_class( $field_setting[ 'custom_class' ] );
1692 1692
 		}
1693 1693
 
1694 1694
 		/**
@@ -1726,16 +1726,16 @@  discard block
 block discarded – undo
1726 1726
 	     */
1727 1727
 	    $use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
1728 1728
 
1729
-	    if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
1730
-			foreach( $fields as $k => $field ) {
1731
-				if( $field->adminOnly ) {
1729
+	    if ( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry[ 'id' ] ) ) {
1730
+			foreach ( $fields as $k => $field ) {
1731
+				if ( $field->adminOnly ) {
1732 1732
 				    unset( $fields[ $k ] );
1733 1733
 				}
1734 1734
 			}
1735 1735
 			return $fields;
1736 1736
 		}
1737 1737
 
1738
-	    foreach( $fields as &$field ) {
1738
+	    foreach ( $fields as &$field ) {
1739 1739
 		    $field->adminOnly = false;
1740 1740
 		}
1741 1741
 
@@ -1756,7 +1756,7 @@  discard block
 block discarded – undo
1756 1756
 	 */
1757 1757
 	private function unselect_default_values( $form ) {
1758 1758
 
1759
-	    foreach ( $form['fields'] as &$field ) {
1759
+	    foreach ( $form[ 'fields' ] as &$field ) {
1760 1760
 
1761 1761
 			if ( empty( $field->choices ) ) {
1762 1762
                 continue;
@@ -1764,7 +1764,7 @@  discard block
 block discarded – undo
1764 1764
 
1765 1765
             foreach ( $field->choices as &$choice ) {
1766 1766
 				if ( \GV\Utils::get( $choice, 'isSelected' ) ) {
1767
-					$choice['isSelected'] = false;
1767
+					$choice[ 'isSelected' ] = false;
1768 1768
 				}
1769 1769
 			}
1770 1770
 		}
@@ -1789,22 +1789,22 @@  discard block
 block discarded – undo
1789 1789
 	 */
1790 1790
 	function prefill_conditional_logic( $form ) {
1791 1791
 
1792
-		if( ! GFFormDisplay::has_conditional_logic( $form ) ) {
1792
+		if ( ! GFFormDisplay::has_conditional_logic( $form ) ) {
1793 1793
 			return $form;
1794 1794
 		}
1795 1795
 
1796 1796
 		// Have Conditional Logic pre-fill fields as if the data were default values
1797 1797
 		/** @var GF_Field $field */
1798
-		foreach ( $form['fields'] as &$field ) {
1798
+		foreach ( $form[ 'fields' ] as &$field ) {
1799 1799
 
1800
-			if( 'checkbox' === $field->type ) {
1800
+			if ( 'checkbox' === $field->type ) {
1801 1801
 				foreach ( $field->get_entry_inputs() as $key => $input ) {
1802
-				    $input_id = $input['id'];
1802
+				    $input_id = $input[ 'id' ];
1803 1803
 				    $choice = $field->choices[ $key ];
1804 1804
 				    $value = \GV\Utils::get( $this->entry, $input_id );
1805 1805
 				    $match = RGFormsModel::choice_value_match( $field, $choice, $value );
1806
-				    if( $match ) {
1807
-				        $field->choices[ $key ]['isSelected'] = true;
1806
+				    if ( $match ) {
1807
+				        $field->choices[ $key ][ 'isSelected' ] = true;
1808 1808
 				    }
1809 1809
 				}
1810 1810
 			} else {
@@ -1812,15 +1812,15 @@  discard block
 block discarded – undo
1812 1812
 				// We need to run through each field to set the default values
1813 1813
 				foreach ( $this->entry as $field_id => $field_value ) {
1814 1814
 
1815
-				    if( floatval( $field_id ) === floatval( $field->id ) ) {
1815
+				    if ( floatval( $field_id ) === floatval( $field->id ) ) {
1816 1816
 
1817
-				        if( 'list' === $field->type ) {
1817
+				        if ( 'list' === $field->type ) {
1818 1818
 				            $list_rows = maybe_unserialize( $field_value );
1819 1819
 
1820 1820
 				            $list_field_value = array();
1821
-				            foreach ( (array) $list_rows as $row ) {
1822
-				                foreach ( (array) $row as $column ) {
1823
-				                    $list_field_value[] = $column;
1821
+				            foreach ( (array)$list_rows as $row ) {
1822
+				                foreach ( (array)$row as $column ) {
1823
+				                    $list_field_value[ ] = $column;
1824 1824
 				                }
1825 1825
 				            }
1826 1826
 
@@ -1855,16 +1855,16 @@  discard block
 block discarded – undo
1855 1855
 		 */
1856 1856
 		$use_conditional_logic = apply_filters( 'gravityview/edit_entry/conditional_logic', true, $form );
1857 1857
 
1858
-		if( $use_conditional_logic ) {
1858
+		if ( $use_conditional_logic ) {
1859 1859
 			return $form;
1860 1860
 		}
1861 1861
 
1862
-		foreach( $form['fields'] as &$field ) {
1862
+		foreach ( $form[ 'fields' ] as &$field ) {
1863 1863
 			/* @var GF_Field $field */
1864 1864
 			$field->conditionalLogic = null;
1865 1865
 		}
1866 1866
 
1867
-		unset( $form['button']['conditionalLogic'] );
1867
+		unset( $form[ 'button' ][ 'conditionalLogic' ] );
1868 1868
 
1869 1869
 		return $form;
1870 1870
 
@@ -1881,7 +1881,7 @@  discard block
 block discarded – undo
1881 1881
 	 */
1882 1882
 	public function manage_conditional_logic( $has_conditional_logic, $form ) {
1883 1883
 
1884
-		if( ! $this->is_edit_entry() ) {
1884
+		if ( ! $this->is_edit_entry() ) {
1885 1885
 			return $has_conditional_logic;
1886 1886
 		}
1887 1887
 
@@ -1913,44 +1913,44 @@  discard block
 block discarded – undo
1913 1913
 		 *  2. There are two entries embedded using oEmbed
1914 1914
 		 *  3. One of the entries has just been saved
1915 1915
 		 */
1916
-		if( !empty( $_POST['lid'] ) && !empty( $_GET['entry'] ) && ( $_POST['lid'] !== $_GET['entry'] ) ) {
1916
+		if ( ! empty( $_POST[ 'lid' ] ) && ! empty( $_GET[ 'entry' ] ) && ( $_POST[ 'lid' ] !== $_GET[ 'entry' ] ) ) {
1917 1917
 
1918 1918
 			$error = true;
1919 1919
 
1920 1920
 		}
1921 1921
 
1922
-		if( !empty( $_GET['entry'] ) && (string)$this->entry['id'] !== $_GET['entry'] ) {
1922
+		if ( ! empty( $_GET[ 'entry' ] ) && (string)$this->entry[ 'id' ] !== $_GET[ 'entry' ] ) {
1923 1923
 
1924 1924
 			$error = true;
1925 1925
 
1926
-		} elseif( ! $this->verify_nonce() ) {
1926
+		} elseif ( ! $this->verify_nonce() ) {
1927 1927
 
1928 1928
 			/**
1929 1929
 			 * If the Entry is embedded, there may be two entries on the same page.
1930 1930
 			 * If that's the case, and one is being edited, the other should fail gracefully and not display an error.
1931 1931
 			 */
1932
-			if( GravityView_oEmbed::getInstance()->get_entry_id() ) {
1932
+			if ( GravityView_oEmbed::getInstance()->get_entry_id() ) {
1933 1933
 				$error = true;
1934 1934
 			} else {
1935
-				$error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview');
1935
+				$error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview' );
1936 1936
 			}
1937 1937
 
1938 1938
 		}
1939 1939
 
1940
-		if( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
1941
-			$error = __( 'You do not have permission to edit this entry.', 'gravityview');
1940
+		if ( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
1941
+			$error = __( 'You do not have permission to edit this entry.', 'gravityview' );
1942 1942
 		}
1943 1943
 
1944
-		if( $this->entry['status'] === 'trash' ) {
1945
-			$error = __('You cannot edit the entry; it is in the trash.', 'gravityview' );
1944
+		if ( $this->entry[ 'status' ] === 'trash' ) {
1945
+			$error = __( 'You cannot edit the entry; it is in the trash.', 'gravityview' );
1946 1946
 		}
1947 1947
 
1948 1948
 		// No errors; everything's fine here!
1949
-		if( empty( $error ) ) {
1949
+		if ( empty( $error ) ) {
1950 1950
 			return true;
1951 1951
 		}
1952 1952
 
1953
-		if( $echo && $error !== true ) {
1953
+		if ( $echo && $error !== true ) {
1954 1954
 
1955 1955
 	        $error = esc_html( $error );
1956 1956
 
@@ -1958,10 +1958,10 @@  discard block
 block discarded – undo
1958 1958
 	         * @since 1.9
1959 1959
 	         */
1960 1960
 	        if ( ! empty( $this->entry ) ) {
1961
-		        $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;" ) );
1961
+		        $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;" ) );
1962 1962
 	        }
1963 1963
 
1964
-			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error');
1964
+			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error' );
1965 1965
 		}
1966 1966
 
1967 1967
 		gravityview()->log->error( '{error}', array( 'error' => $error ) );
@@ -1981,17 +1981,17 @@  discard block
 block discarded – undo
1981 1981
 
1982 1982
 		$error = NULL;
1983 1983
 
1984
-		if( ! $this->check_user_cap_edit_field( $field ) ) {
1985
-			$error = __( 'You do not have permission to edit this field.', 'gravityview');
1984
+		if ( ! $this->check_user_cap_edit_field( $field ) ) {
1985
+			$error = __( 'You do not have permission to edit this field.', 'gravityview' );
1986 1986
 		}
1987 1987
 
1988 1988
 		// No errors; everything's fine here!
1989
-		if( empty( $error ) ) {
1989
+		if ( empty( $error ) ) {
1990 1990
 			return true;
1991 1991
 		}
1992 1992
 
1993
-		if( $echo ) {
1994
-			echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error');
1993
+		if ( $echo ) {
1994
+			echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error' );
1995 1995
 		}
1996 1996
 
1997 1997
 		gravityview()->log->error( '{error}', array( 'error' => $error ) );
@@ -2012,14 +2012,14 @@  discard block
 block discarded – undo
2012 2012
 	private function check_user_cap_edit_field( $field ) {
2013 2013
 
2014 2014
 		// If they can edit any entries (as defined in Gravity Forms), we're good.
2015
-		if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
2015
+		if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
2016 2016
 			return true;
2017 2017
 		}
2018 2018
 
2019
-		$field_cap = isset( $field['allow_edit_cap'] ) ? $field['allow_edit_cap'] : false;
2019
+		$field_cap = isset( $field[ 'allow_edit_cap' ] ) ? $field[ 'allow_edit_cap' ] : false;
2020 2020
 
2021
-		if( $field_cap ) {
2022
-			return GVCommon::has_cap( $field['allow_edit_cap'] );
2021
+		if ( $field_cap ) {
2022
+			return GVCommon::has_cap( $field[ 'allow_edit_cap' ] );
2023 2023
 		}
2024 2024
 
2025 2025
 		return false;
@@ -2033,17 +2033,17 @@  discard block
 block discarded – undo
2033 2033
 	public function verify_nonce() {
2034 2034
 
2035 2035
 		// Verify form submitted for editing single
2036
-		if( $this->is_edit_entry_submission() ) {
2036
+		if ( $this->is_edit_entry_submission() ) {
2037 2037
 			$valid = wp_verify_nonce( $_POST[ self::$nonce_field ], self::$nonce_field );
2038 2038
 		}
2039 2039
 
2040 2040
 		// Verify
2041
-		else if( ! $this->is_edit_entry() ) {
2041
+		else if ( ! $this->is_edit_entry() ) {
2042 2042
 			$valid = false;
2043 2043
 		}
2044 2044
 
2045 2045
 		else {
2046
-			$valid = wp_verify_nonce( $_GET['edit'], self::$nonce_key );
2046
+			$valid = wp_verify_nonce( $_GET[ 'edit' ], self::$nonce_key );
2047 2047
 		}
2048 2048
 
2049 2049
 		/**
Please login to merge, or discard this patch.
includes/helper-functions.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -32,19 +32,19 @@  discard block
 block discarded – undo
32 32
 	// If there's an overriding CSS file in the current template folder, use it.
33 33
 	$template_css_path = trailingslashit( get_stylesheet_directory() ) . 'gravityview/css/' . $css_file;
34 34
 
35
-	if( file_exists( $template_css_path ) ) {
35
+	if ( file_exists( $template_css_path ) ) {
36 36
 		$path = trailingslashit( get_stylesheet_directory_uri() ) . 'gravityview/css/' . $css_file;
37 37
 		gravityview()->log->debug( 'Stylesheet override ({css_file})', array( 'css_file' => esc_attr( $css_file ) ) );
38 38
 	} else {
39 39
 		// Default: use GravityView CSS file
40 40
 
41 41
 		// If no path is provided, assume default plugin templates CSS folder
42
-		if( '' === $dir_path ) {
42
+		if ( '' === $dir_path ) {
43 43
 			$dir_path = GRAVITYVIEW_DIR . 'templates/css/';
44 44
 		}
45 45
 		
46 46
 		// plugins_url() expects a path to a file, not directory. We append a file to be stripped.
47
-		$path = plugins_url( $css_file, trailingslashit( $dir_path )  . 'stripped-by-plugin_basename.php' );
47
+		$path = plugins_url( $css_file, trailingslashit( $dir_path ) . 'stripped-by-plugin_basename.php' );
48 48
 	}
49 49
 
50 50
 	return $path;
@@ -82,9 +82,9 @@  discard block
 block discarded – undo
82 82
 
83 83
 	$parsed_permalink = parse_url( get_permalink( $id ) );
84 84
 
85
-	$permalink_args =  isset( $parsed_permalink['query'] ) ? $parsed_permalink['query'] : false;
85
+	$permalink_args = isset( $parsed_permalink[ 'query' ] ) ? $parsed_permalink[ 'query' ] : false;
86 86
 
87
-	if( empty( $permalink_args ) ) {
87
+	if ( empty( $permalink_args ) ) {
88 88
 		return array();
89 89
 	}
90 90
 
@@ -109,15 +109,15 @@  discard block
 block discarded – undo
109 109
 function gv_selected( $value, $current, $echo = true, $type = 'selected' ) {
110 110
 
111 111
 	$output = '';
112
-	if( is_array( $current ) ) {
113
-		if( in_array( $value, $current ) ) {
112
+	if ( is_array( $current ) ) {
113
+		if ( in_array( $value, $current ) ) {
114 114
 			$output = __checked_selected_helper( true, true, false, $type );
115 115
 		}
116 116
 	} else {
117 117
 		$output = __checked_selected_helper( $value, $current, false, $type );
118 118
 	}
119 119
 
120
-	if( $echo ) {
120
+	if ( $echo ) {
121 121
 		echo $output;
122 122
 	}
123 123
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 }
126 126
 
127 127
 
128
-if( ! function_exists( 'gravityview_sanitize_html_class' ) ) {
128
+if ( ! function_exists( 'gravityview_sanitize_html_class' ) ) {
129 129
 
130 130
 	/**
131 131
 	 * sanitize_html_class doesn't handle spaces (multiple classes). We remedy that.
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
  */
172 172
 function gravityview_strip_whitespace( $string ) {
173 173
 	$string = normalize_whitespace( $string );
174
-	return preg_replace('/[\r\n\t ]+/', ' ', $string );
174
+	return preg_replace( '/[\r\n\t ]+/', ' ', $string );
175 175
 }
176 176
 
177 177
 /**
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
  * @return string Included file contents
186 186
  */
187 187
 function gravityview_ob_include( $file_path, $object = NULL ) {
188
-	if( ! file_exists( $file_path ) ) {
188
+	if ( ! file_exists( $file_path ) ) {
189 189
 		gravityview()->log->error( 'File path does not exist. {path}', array( 'path' => $file_path ) );
190 190
 		return '';
191 191
 	}
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 
210 210
 	$width = $height * 0.7586206897;
211 211
 
212
-	if( function_exists('is_rtl') && is_rtl() ) {
212
+	if ( function_exists( 'is_rtl' ) && is_rtl() ) {
213 213
 		$style = 'margin:10px 10px 10px 0;';
214 214
 		$css_class = is_string( $css_class ) ? $css_class : 'alignright';
215 215
 	} else {
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 		$css_class = is_string( $css_class ) ? $css_class : 'alignleft';
218 218
 	}
219 219
 
220
-	return '<img src="'. esc_url( plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ) ) .'" class="'. gravityview_sanitize_html_class( $css_class ).'" height="'.intval( $height ).'" width="'.round( $width, 2 ).'" alt="The GravityView Astronaut Says:" style="'.$style.'" />';
220
+	return '<img src="' . esc_url( plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ) ) . '" class="' . gravityview_sanitize_html_class( $css_class ) . '" height="' . intval( $height ) . '" width="' . round( $width, 2 ) . '" alt="The GravityView Astronaut Says:" style="' . $style . '" />';
221 221
 }
222 222
 
223 223
 /**
@@ -240,9 +240,9 @@  discard block
 block discarded – undo
240 240
 function gravityview_number_format( $number, $decimals = '' ) {
241 241
 	global $wp_locale;
242 242
 
243
-	if( '' === $decimals ) {
243
+	if ( '' === $decimals ) {
244 244
 
245
-		$decimal_point = isset( $wp_locale ) ? $wp_locale->number_format['decimal_point'] : '.';
245
+		$decimal_point = isset( $wp_locale ) ? $wp_locale->number_format[ 'decimal_point' ] : '.';
246 246
 
247 247
 		/**
248 248
 		 * Calculate the position of the decimal point in the number
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 	$parts = parse_url( $value );
272 272
 
273 273
 	// No domain? Strange...show the original text.
274
-	if( empty( $parts['host'] ) ) {
274
+	if ( empty( $parts[ 'host' ] ) ) {
275 275
 		return $value;
276 276
 	}
277 277
 
@@ -284,16 +284,16 @@  discard block
 block discarded – undo
284 284
 	 * @param boolean $enable Whether to strip the scheme. Return false to show scheme. (default: true)\n
285 285
 	 * If true: `http://example.com => example.com`
286 286
 	 */
287
-	if( false === apply_filters('gravityview_anchor_text_striphttp', true) ) {
287
+	if ( false === apply_filters( 'gravityview_anchor_text_striphttp', true ) ) {
288 288
 
289
-		if( isset( $parts['scheme'] ) ) {
290
-			$return .= $parts['scheme'];
289
+		if ( isset( $parts[ 'scheme' ] ) ) {
290
+			$return .= $parts[ 'scheme' ];
291 291
 		}
292 292
 
293 293
 	}
294 294
 
295 295
 	// The domain, which may contain a subdomain
296
-	$domain = $parts['host'];
296
+	$domain = $parts[ 'host' ];
297 297
 
298 298
 	/**
299 299
 	 * @filter `gravityview_anchor_text_stripwww` Strip www from the domain?
@@ -301,10 +301,10 @@  discard block
 block discarded – undo
301 301
 	 * @param boolean $enable Whether to strip www. Return false to show www. (default: true)\n
302 302
 	 * If true: `www.example.com => example.com`
303 303
 	 */
304
-	$strip_www = apply_filters('gravityview_anchor_text_stripwww', true );
304
+	$strip_www = apply_filters( 'gravityview_anchor_text_stripwww', true );
305 305
 
306
-	if( $strip_www ) {
307
-		$domain = str_replace('www.', '', $domain );
306
+	if ( $strip_www ) {
307
+		$domain = str_replace( 'www.', '', $domain );
308 308
 	}
309 309
 
310 310
 	/**
@@ -314,11 +314,11 @@  discard block
 block discarded – undo
314 314
 	 * If true: `http://demo.example.com => example.com` \n
315 315
 	 * If false: `http://demo.example.com => demo.example.com`
316 316
 	 */
317
-	$strip_subdomains = apply_filters('gravityview_anchor_text_nosubdomain', true);
317
+	$strip_subdomains = apply_filters( 'gravityview_anchor_text_nosubdomain', true );
318 318
 
319
-	if( $strip_subdomains ) {
319
+	if ( $strip_subdomains ) {
320 320
 
321
-		$domain = _gravityview_strip_subdomain( $parts['host'] );
321
+		$domain = _gravityview_strip_subdomain( $parts[ 'host' ] );
322 322
 
323 323
 	}
324 324
 
@@ -332,12 +332,12 @@  discard block
 block discarded – undo
332 332
 	 * If true: `http://example.com/sub/directory/page.html => example.com`  \n
333 333
 	 * If false: `http://example.com/sub/directory/page.html => example.com/sub/directory/page.html`
334 334
 	 */
335
-	$root_only = apply_filters('gravityview_anchor_text_rootonly', true);
335
+	$root_only = apply_filters( 'gravityview_anchor_text_rootonly', true );
336 336
 
337
-	if( empty( $root_only ) ) {
337
+	if ( empty( $root_only ) ) {
338 338
 
339
-		if( isset( $parts['path'] ) ) {
340
-			$return .= $parts['path'];
339
+		if ( isset( $parts[ 'path' ] ) ) {
340
+			$return .= $parts[ 'path' ];
341 341
 		}
342 342
 	}
343 343
 
@@ -347,12 +347,12 @@  discard block
 block discarded – undo
347 347
 	 * @param boolean $enable Whether to enable "root only". Return false to show full path. (default: true)\n
348 348
 	 * If true: `http://example.com/?query=example => example.com`
349 349
 	 */
350
-	$strip_query_string = apply_filters('gravityview_anchor_text_noquerystring', true );
350
+	$strip_query_string = apply_filters( 'gravityview_anchor_text_noquerystring', true );
351 351
 
352
-	if( empty( $strip_query_string ) ) {
352
+	if ( empty( $strip_query_string ) ) {
353 353
 
354
-		if( isset( $parts['query'] ) ) {
355
-			$return .= '?'.$parts['query'];
354
+		if ( isset( $parts[ 'query' ] ) ) {
355
+			$return .= '?' . $parts[ 'query' ];
356 356
 		}
357 357
 
358 358
 	}
@@ -369,8 +369,8 @@  discard block
 block discarded – undo
369 369
  */
370 370
 function _gravityview_strip_subdomain( $string_maybe_has_subdomain ) {
371 371
 
372
-	if( preg_match("/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.(?:com\.|co\.|net\.|org\.|firm\.|me\.|school\.|law\.|gov\.|mod\.|msk\.|irkutsks\.|sa\.|act\.|police\.|plc\.|ac\.|tm\.|asso\.|biz\.|pro\.|cg\.|telememo\.)?[a-z\.]{2,6})$/i", $string_maybe_has_subdomain, $matches ) ) {
373
-		return $matches['domain'];
372
+	if ( preg_match( "/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.(?:com\.|co\.|net\.|org\.|firm\.|me\.|school\.|law\.|gov\.|mod\.|msk\.|irkutsks\.|sa\.|act\.|police\.|plc\.|ac\.|tm\.|asso\.|biz\.|pro\.|cg\.|telememo\.)?[a-z\.]{2,6})$/i", $string_maybe_has_subdomain, $matches ) ) {
373
+		return $matches[ 'domain' ];
374 374
 	} else {
375 375
 		return $string_maybe_has_subdomain;
376 376
 	}
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 
440 440
 		if ( in_array( $value, array( 'yes', 'true' ), true ) ) {
441 441
 			$value = true;
442
-		} else if( in_array( $value, array( 'no', 'false' ), true ) ) {
442
+		} else if ( in_array( $value, array( 'no', 'false' ), true ) ) {
443 443
 			$value = false;
444 444
 		}
445 445
 	}
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
  */
469 469
 function gv_maybe_json_decode( $value, $assoc = false, $depth = 512, $options = 0 ) {
470 470
 
471
-	if( ! is_string( $value ) ) {
471
+	if ( ! is_string( $value ) ) {
472 472
 		return $value;
473 473
 	}
474 474
 
@@ -479,12 +479,12 @@  discard block
 block discarded – undo
479 479
 	}
480 480
 
481 481
 	// There was a JSON error (PHP 5.3+)
482
-	if( function_exists('json_last_error') && JSON_ERROR_NONE !== json_last_error() ) {
482
+	if ( function_exists( 'json_last_error' ) && JSON_ERROR_NONE !== json_last_error() ) {
483 483
 		return $value;
484 484
 	}
485 485
 
486 486
 	// It wasn't JSON (PHP < 5.3 fallback)
487
-	if( is_null( $decoded ) ) {
487
+	if ( is_null( $decoded ) ) {
488 488
 		return $value;
489 489
 	}
490 490
 
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
 
508 508
 	// Use the original function, if exists.
509 509
 	// Requires WP 4.4+
510
-	if( function_exists( 'map_deep') ) {
510
+	if ( function_exists( 'map_deep' ) ) {
511 511
 		return map_deep( $value, $callback );
512 512
 	}
513 513
 
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
 
573 573
 	$exploded = explode( '.', "{$field_id}" );
574 574
 
575
-	return isset( $exploded[1] ) ? intval( $exploded[1] ) : false;
575
+	return isset( $exploded[ 1 ] ) ? intval( $exploded[ 1 ] ) : false;
576 576
 }
577 577
 
578 578
 /**
@@ -613,13 +613,13 @@  discard block
 block discarded – undo
613 613
 	 */
614 614
 	$args = apply_filters( 'gravityview_get_terms_choices_args', $args );
615 615
 
616
-	$terms = get_terms( $args['taxonomy'], $args );
616
+	$terms = get_terms( $args[ 'taxonomy' ], $args );
617 617
 
618 618
 	$choices = array();
619 619
 
620 620
 	if ( is_array( $terms ) ) {
621 621
 		foreach ( $terms as $term_id => $term_name ) {
622
-			$choices[] = array(
622
+			$choices[ ] = array(
623 623
 				'text'  => $term_name,
624 624
 				'value' => $term_id
625 625
 			);
@@ -643,21 +643,21 @@  discard block
 block discarded – undo
643 643
 function _gravityview_process_posted_fields() {
644 644
 	$fields = array();
645 645
 
646
-	if( !empty( $_POST['gv_fields'] ) ) {
647
-		if ( ! is_array( $_POST['gv_fields'] ) ) {
646
+	if ( ! empty( $_POST[ 'gv_fields' ] ) ) {
647
+		if ( ! is_array( $_POST[ 'gv_fields' ] ) ) {
648 648
 
649 649
 			// We are not using parse_str() due to max_input_vars limitation with large View configurations
650 650
 			$fields_holder = array();
651
-			GVCommon::gv_parse_str( $_POST['gv_fields'], $fields_holder );
651
+			GVCommon::gv_parse_str( $_POST[ 'gv_fields' ], $fields_holder );
652 652
 
653
-			if ( isset( $fields_holder['fields'] ) ) {
654
-				$fields = $fields_holder['fields'];
653
+			if ( isset( $fields_holder[ 'fields' ] ) ) {
654
+				$fields = $fields_holder[ 'fields' ];
655 655
 			} else {
656 656
 				gravityview()->log->error( 'No `fields` key was found after parsing $fields string', array( 'data' => $fields_holder ) );
657 657
 			}
658 658
 
659 659
 		} else {
660
-			$fields = $_POST['gv_fields'];
660
+			$fields = $_POST[ 'gv_fields' ];
661 661
 		}
662 662
 	}
663 663
 
Please login to merge, or discard this patch.
includes/class-admin-installer.php 1 patch
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 */
54 54
 	public function register_noconflict( $items ) {
55 55
 
56
-		$items[] = 'gravityview-admin-installer';
56
+		$items[ ] = 'gravityview-admin-installer';
57 57
 
58 58
 		return $items;
59 59
 	}
@@ -72,17 +72,17 @@  discard block
 block discarded – undo
72 72
 			return;
73 73
 		}
74 74
 
75
-		add_filter( 'plugins_api', function ( $data, $action, $args ) use ( $downloads_data ) {
75
+		add_filter( 'plugins_api', function( $data, $action, $args ) use ( $downloads_data ) {
76 76
 			foreach ( $downloads_data as $extension ) {
77
-				if ( empty( $extension['info'] ) || empty( $args->slug ) || $args->slug !== $extension['info']['slug'] ) {
77
+				if ( empty( $extension[ 'info' ] ) || empty( $args->slug ) || $args->slug !== $extension[ 'info' ][ 'slug' ] ) {
78 78
 					continue;
79 79
 				}
80 80
 
81
-				return (object) array(
82
-					'slug'          => $extension['info']['slug'],
83
-					'name'          => $extension['info']['title'],
84
-					'version'       => $extension['licensing']['version'],
85
-					'download_link' => $extension['files'][0]['file'],
81
+				return (object)array(
82
+					'slug'          => $extension[ 'info' ][ 'slug' ],
83
+					'name'          => $extension[ 'info' ][ 'title' ],
84
+					'version'       => $extension[ 'licensing' ][ 'version' ],
85
+					'download_link' => $extension[ 'files' ][ 0 ][ 'file' ],
86 86
 				);
87 87
 			}
88 88
 
@@ -144,13 +144,13 @@  discard block
 block discarded – undo
144 144
 
145 145
 		foreach ( $all_plugins as $path => $plugin ) {
146 146
 
147
-			if ( empty( $plugin['TextDomain'] ) ) {
147
+			if ( empty( $plugin[ 'TextDomain' ] ) ) {
148 148
 				continue;
149 149
 			}
150 150
 
151
-			$wp_plugins[ $plugin['TextDomain'] ] = array(
151
+			$wp_plugins[ $plugin[ 'TextDomain' ] ] = array(
152 152
 				'path'      => $path,
153
-				'version'   => $plugin['Version'],
153
+				'version'   => $plugin[ 'Version' ],
154 154
 				'activated' => is_plugin_active( $path )
155 155
 			);
156 156
 		}
@@ -232,13 +232,13 @@  discard block
 block discarded – undo
232 232
 
233 233
 		$downloads_data = json_decode( wp_remote_retrieve_body( $response ), true );
234 234
 
235
-		if ( empty( $downloads_data['products'] ) ) {
235
+		if ( empty( $downloads_data[ 'products' ] ) ) {
236 236
 			return array();
237 237
 		}
238 238
 
239
-		$this->set_downloads_data( $downloads_data['products'] );
239
+		$this->set_downloads_data( $downloads_data[ 'products' ] );
240 240
 
241
-		return $downloads_data['products'];
241
+		return $downloads_data[ 'products' ];
242 242
 	}
243 243
 
244 244
 	/**
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
 
312 312
 				foreach ( $downloads_data as $extension ) {
313 313
 
314
-					if ( empty( $extension['info'] ) ) {
314
+					if ( empty( $extension[ 'info' ] ) ) {
315 315
 						continue;
316 316
 					}
317 317
 
@@ -340,29 +340,29 @@  discard block
 block discarded – undo
340 340
 
341 341
         $details = $this->get_download_display_details( $download, $wp_plugins );
342 342
 
343
-        $download_info = $details['download_info'];
343
+        $download_info = $details[ 'download_info' ];
344 344
 
345 345
 		?>
346
-        <div class="item <?php echo esc_attr( $details['item_class'] ); ?>">
346
+        <div class="item <?php echo esc_attr( $details[ 'item_class' ] ); ?>">
347 347
             <div class="addon-inner">
348
-                <a href="<?php echo esc_url( $download_info['link'] ); ?>" rel="external noreferrer noopener" title="<?php esc_html_e( 'Visit the plugin page', 'gravityview' ); ?>"><img class="thumbnail" src="<?php echo esc_attr( $download_info['thumbnail'] ); ?>" alt="" /></a>
349
-                <h3><?php echo esc_html( \GV\Utils::get( $download_info, 'installer_title', $download_info['title'] ) ); ?></h3>
348
+                <a href="<?php echo esc_url( $download_info[ 'link' ] ); ?>" rel="external noreferrer noopener" title="<?php esc_html_e( 'Visit the plugin page', 'gravityview' ); ?>"><img class="thumbnail" src="<?php echo esc_attr( $download_info[ 'thumbnail' ] ); ?>" alt="" /></a>
349
+                <h3><?php echo esc_html( \GV\Utils::get( $download_info, 'installer_title', $download_info[ 'title' ] ) ); ?></h3>
350 350
                 <div>
351
-                    <?php if( $details['status_label'] ) { ?>
352
-                    <div class="status <?php echo esc_attr( $details['status'] ); ?>" title="<?php printf( esc_attr__( 'Plugin status: %s', 'gravityview' ), esc_html( $details['status_label'] ) ); ?>">
353
-                        <span class="dashicons dashicons-admin-plugins"></span> <span class="status-label"><?php echo esc_html( $details['status_label'] ); ?></span>
351
+                    <?php if ( $details[ 'status_label' ] ) { ?>
352
+                    <div class="status <?php echo esc_attr( $details[ 'status' ] ); ?>" title="<?php printf( esc_attr__( 'Plugin status: %s', 'gravityview' ), esc_html( $details[ 'status_label' ] ) ); ?>">
353
+                        <span class="dashicons dashicons-admin-plugins"></span> <span class="status-label"><?php echo esc_html( $details[ 'status_label' ] ); ?></span>
354 354
                     </div>
355 355
 			        <?php } ?>
356 356
 
357
-                    <a data-status="<?php echo esc_attr( $details['status'] ); ?>" data-plugin-path="<?php echo esc_attr( $details['plugin_path'] ); ?>" href="<?php echo esc_url( $details['href'] ); ?>" class="button <?php echo esc_attr( $details['button_class'] ); ?>" title="<?php echo esc_attr( $details['button_title'] ); ?>">
358
-                        <span class="title"><?php echo esc_html( $details['button_label'] ); ?></span>
359
-                        <?php if( $details['spinner'] ) { ?><span class="spinner"></span><?php } ?>
357
+                    <a data-status="<?php echo esc_attr( $details[ 'status' ] ); ?>" data-plugin-path="<?php echo esc_attr( $details[ 'plugin_path' ] ); ?>" href="<?php echo esc_url( $details[ 'href' ] ); ?>" class="button <?php echo esc_attr( $details[ 'button_class' ] ); ?>" title="<?php echo esc_attr( $details[ 'button_title' ] ); ?>">
358
+                        <span class="title"><?php echo esc_html( $details[ 'button_label' ] ); ?></span>
359
+                        <?php if ( $details[ 'spinner' ] ) { ?><span class="spinner"></span><?php } ?>
360 360
                     </a>
361 361
                 </div>
362 362
 
363 363
                 <div class="addon-excerpt"><?php
364 364
 
365
-                    $excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info['excerpt'] );
365
+                    $excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info[ 'excerpt' ] );
366 366
 
367 367
                     // Allow some pure HTML tags, but remove everything else from the excerpt.
368 368
                     $tags = array( '<strong>', '</strong>', '<em>', '</em>', '<code>', '</code>' );
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
 	 */
403 403
 	private function get_download_display_details( $download, $wp_plugins ) {
404 404
 
405
-		$download_info = wp_parse_args( (array) $download['info'], array(
405
+		$download_info = wp_parse_args( (array)$download[ 'info' ], array(
406 406
 			'thumbnail' => '',
407 407
 			'title' => '',
408 408
 			'textdomain' => '',
@@ -414,9 +414,9 @@  discard block
 block discarded – undo
414 414
 			'installer_excerpt' => null, // May not be defined
415 415
 		) );
416 416
 
417
-		$wp_plugin = \GV\Utils::get( $wp_plugins, $download_info['textdomain'], false );
417
+		$wp_plugin = \GV\Utils::get( $wp_plugins, $download_info[ 'textdomain' ], false );
418 418
 
419
-		$has_access = ! empty( $download['files'] );
419
+		$has_access = ! empty( $download[ 'files' ] );
420 420
 		$spinner = true;
421 421
 		$href = $plugin_path = '#';
422 422
 		$status = $item_class = $button_title = $button_class = '';
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
 		$required_license = $galactic_only ? __( 'All Access', 'gravityview' ) : __( 'Core + Extensions', 'gravityview' );
427 427
 
428 428
 		// The license is not active - no matter what level, this should not work
429
-		if( ! $is_active  && empty( $base_price ) ) {
429
+		if ( ! $is_active && empty( $base_price ) ) {
430 430
 			$spinner      = false;
431 431
 			$button_class = 'disabled disabled-license';
432 432
 			$button_label = sprintf( __( 'Active %s License is Required.', 'gravityview' ), $required_license );
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 			$status_label = '';
439 439
 			$button_label = sprintf( __( 'Purchase Now for %s', 'gravityview' ), '$' . $base_price );
440 440
 			$button_class = 'button-primary button-large';
441
-			$href         = $download_info['link'];
441
+			$href         = $download_info[ 'link' ];
442 442
 			$item_class   = 'featured';
443 443
 		}
444 444
 
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
 			$href         = 'https://gravityview.co/pricing/?utm_source=admin-installer&utm_medium=admin&utm_campaign=Admin%20Notice&utm_content=' . $required_license;
452 452
 		}
453 453
 
454
-        elseif ( ! empty( $download_info['coming_soon'] ) ) {
454
+        elseif ( ! empty( $download_info[ 'coming_soon' ] ) ) {
455 455
 	        $spinner      = false;
456 456
 	        $status       = 'notinstalled';
457 457
 	        $status_label = __( 'Coming Soon', 'gravityview' );
@@ -466,8 +466,8 @@  discard block
 block discarded – undo
466 466
 			$href = add_query_arg(
467 467
 				array(
468 468
 					'action'   => 'install-plugin',
469
-					'plugin'   => $download_info['slug'],
470
-					'_wpnonce' => wp_create_nonce( 'install-plugin_' . $download_info['slug'] ),
469
+					'plugin'   => $download_info[ 'slug' ],
470
+					'_wpnonce' => wp_create_nonce( 'install-plugin_' . $download_info[ 'slug' ] ),
471 471
 				),
472 472
 				self_admin_url( 'update.php' )
473 473
 			);
@@ -479,25 +479,25 @@  discard block
 block discarded – undo
479 479
 		}
480 480
 
481 481
 		// Access and the plugin is installed but not active
482
-		elseif ( false === $wp_plugin['activated'] ) {
482
+		elseif ( false === $wp_plugin[ 'activated' ] ) {
483 483
 			$status = 'inactive';
484 484
 			$status_label = __( 'Inactive', 'gravityview' );
485 485
 			$button_label = __( 'Activate', 'gravityview' );
486
-			$plugin_path = $wp_plugin['path'];
486
+			$plugin_path = $wp_plugin[ 'path' ];
487 487
 
488 488
 		}
489 489
 
490 490
 		// Access and the plugin is installed and active
491 491
 		else {
492 492
 
493
-			$plugin_path = $wp_plugin['path'];
493
+			$plugin_path = $wp_plugin[ 'path' ];
494 494
 			$status = 'active';
495 495
 			$status_label = __( 'Active', 'gravityview' );
496 496
 			$button_label = __( 'Deactivate', 'gravityview' );
497 497
 
498 498
 		}
499 499
 
500
-		return compact( 'download_info','plugin_path', 'status', 'status_label', 'button_title', 'button_class', 'button_label', 'href', 'spinner', 'item_class', 'required_license', 'is_active' );
500
+		return compact( 'download_info', 'plugin_path', 'status', 'status_label', 'button_title', 'button_class', 'button_label', 'href', 'spinner', 'item_class', 'required_license', 'is_active' );
501 501
     }
502 502
 
503 503
 	/**
@@ -512,11 +512,11 @@  discard block
 block discarded – undo
512 512
 	    $base_price = \GV\Utils::get( $download, 'pricing/amount', 0 );
513 513
 		$base_price = \GFCommon::to_number( $base_price );
514 514
 
515
-		unset( $download['pricing']['amount'] );
515
+		unset( $download[ 'pricing' ][ 'amount' ] );
516 516
 
517 517
 		// Price options array, not single price
518
-		if ( ! $base_price && ! empty( $download['pricing'] ) ) {
519
-			$base_price = array_shift( $download['pricing'] );
518
+		if ( ! $base_price && ! empty( $download[ 'pricing' ] ) ) {
519
+			$base_price = array_shift( $download[ 'pricing' ] );
520 520
 		}
521 521
 
522 522
 		return floatval( $base_price );
@@ -530,13 +530,13 @@  discard block
 block discarded – undo
530 530
 	public function activate_download() {
531 531
 		$data = \GV\Utils::_POST( 'data', array() );
532 532
 
533
-		if ( empty( $data['path'] ) ) {
533
+		if ( empty( $data[ 'path' ] ) ) {
534 534
 			return;
535 535
 		}
536 536
 
537
-		$result = activate_plugin( $data['path'] );
537
+		$result = activate_plugin( $data[ 'path' ] );
538 538
 
539
-		if ( is_wp_error( $result ) || ! is_plugin_active( $data['path'] ) ) {
539
+		if ( is_wp_error( $result ) || ! is_plugin_active( $data[ 'path' ] ) ) {
540 540
 			wp_send_json_error( array(
541 541
                 'error' => sprintf( __( 'Plugin activation failed: %s', 'gravityview' ), $result->get_error_message() )
542 542
             ) );
@@ -553,13 +553,13 @@  discard block
 block discarded – undo
553 553
 	public function deactivate_download() {
554 554
 		$data = \GV\Utils::_POST( 'data', array() );
555 555
 
556
-		if ( empty( $data['path'] ) ) {
556
+		if ( empty( $data[ 'path' ] ) ) {
557 557
 			return;
558 558
 		}
559 559
 
560
-		deactivate_plugins( $data['path'] );
560
+		deactivate_plugins( $data[ 'path' ] );
561 561
 
562
-		if( is_plugin_active( $data['path'] ) ) {
562
+		if ( is_plugin_active( $data[ 'path' ] ) ) {
563 563
             wp_send_json_error( array(
564 564
                 'error' => sprintf( __( 'Plugin deactivation failed.', 'gravityview' ) )
565 565
             ) );
Please login to merge, or discard this patch.
future/includes/rest/class-gv-rest-views-route.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 			'total' => wp_count_posts( 'gravityview' )->publish,
64 64
 		);
65 65
 		foreach ( $items as $item ) {
66
-			$data['views'][] = $this->prepare_view_for_response( $item, $request );
66
+			$data[ 'views' ][ ] = $this->prepare_view_for_response( $item, $request );
67 67
 		}
68 68
 
69 69
 		return new \WP_REST_Response( $data, 200 );
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 
83 83
 		$url = $request->get_url_params();
84 84
 
85
-		$view_id = intval( $url['id'] );
85
+		$view_id = intval( $url[ 'id' ] );
86 86
 
87 87
 		$item = get_post( $view_id );
88 88
 
@@ -166,10 +166,10 @@  discard block
 block discarded – undo
166 166
 	public function get_sub_items( $request ) {
167 167
 
168 168
 		$url     = $request->get_url_params();
169
-		$view_id = intval( $url['id'] );
169
+		$view_id = intval( $url[ 'id' ] );
170 170
 		$format  = \GV\Utils::get( $url, 'format', 'json' );
171 171
 
172
-		if( $post_id = $request->get_param('post_id') ) {
172
+		if ( $post_id = $request->get_param( 'post_id' ) ) {
173 173
 			global $post;
174 174
 
175 175
 			$post = get_post( $post_id );
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 
261 261
 		$data = array( 'entries' => $entries->all(), 'total' => $entries->total() );
262 262
 
263
-		foreach ( $data['entries'] as &$entry ) {
263
+		foreach ( $data[ 'entries' ] as &$entry ) {
264 264
 			$entry = $this->prepare_entry_for_response( $view, $entry, $request, 'directory' );
265 265
 		}
266 266
 
@@ -279,8 +279,8 @@  discard block
 block discarded – undo
279 279
 	 */
280 280
 	public function get_sub_item( $request ) {
281 281
 		$url      = $request->get_url_params();
282
-		$view_id  = intval( $url['id'] );
283
-		$entry_id = intval( $url['s_id'] );
282
+		$view_id  = intval( $url[ 'id' ] );
283
+		$entry_id = intval( $url[ 's_id' ] );
284 284
 		$format   = \GV\Utils::get( $url, 'format', 'json' );
285 285
 
286 286
 		$view  = \GV\View::by_id( $view_id );
@@ -315,32 +315,32 @@  discard block
 block discarded – undo
315 315
 		// Add all the WP_Post data
316 316
 		$view_post = $view_post->to_array();
317 317
 
318
-		unset( $view_post['to_ping'], $view_post['ping_status'], $view_post['pinged'], $view_post['post_type'], $view_post['filter'], $view_post['post_category'], $view_post['tags_input'], $view_post['post_content'], $view_post['post_content_filtered'] );
318
+		unset( $view_post[ 'to_ping' ], $view_post[ 'ping_status' ], $view_post[ 'pinged' ], $view_post[ 'post_type' ], $view_post[ 'filter' ], $view_post[ 'post_category' ], $view_post[ 'tags_input' ], $view_post[ 'post_content' ], $view_post[ 'post_content_filtered' ] );
319 319
 
320 320
 		$return = wp_parse_args( $item, $view_post );
321 321
 
322
-		$return['title'] = $return['post_title'];
322
+		$return[ 'title' ] = $return[ 'post_title' ];
323 323
 
324
-		$return['settings'] = isset( $return['atts'] ) ? $return['atts'] : array();
325
-		unset( $return['atts'], $return['view_id'] );
324
+		$return[ 'settings' ] = isset( $return[ 'atts' ] ) ? $return[ 'atts' ] : array();
325
+		unset( $return[ 'atts' ], $return[ 'view_id' ] );
326 326
 
327
-		$return['search_criteria'] = array(
327
+		$return[ 'search_criteria' ] = array(
328 328
 			'page_size' => rgars( $return, 'settings/page_size' ),
329 329
 			'sort_field' => rgars( $return, 'settings/sort_field' ),
330 330
 			'sort_direction' => rgars( $return, 'settings/sort_direction' ),
331 331
 			'offset' => rgars( $return, 'settings/offset' ),
332 332
 		);
333 333
 
334
-		unset( $return['settings']['page_size'], $return['settings']['sort_field'], $return['settings']['sort_direction'] );
334
+		unset( $return[ 'settings' ][ 'page_size' ], $return[ 'settings' ][ 'sort_field' ], $return[ 'settings' ][ 'sort_direction' ] );
335 335
 
336 336
 		// Redact for non-logged ins
337 337
 		if ( ! \GVCommon::has_cap( 'edit_others_gravityviews' ) ) {
338
-			unset( $return['settings'] );
339
-			unset( $return['search_criteria'] );
338
+			unset( $return[ 'settings' ] );
339
+			unset( $return[ 'search_criteria' ] );
340 340
 		}
341 341
 		
342 342
 		if ( ! \GFCommon::current_user_can_any( 'gravityforms_edit_forms' ) ) {
343
-			unset( $return['form'] );
343
+			unset( $return[ 'form' ] );
344 344
 		}
345 345
 
346 346
 		return $return;
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 			$view_id = func_get_arg( 1 ); // $view_id override
357 357
 		} else {
358 358
 			$url     = $request->get_url_params();
359
-			$view_id = intval( $url['id'] );
359
+			$view_id = intval( $url[ 'id' ] );
360 360
 		}
361 361
 
362 362
 		if ( ! $view = \GV\View::by_id( $view_id ) ) {
@@ -400,8 +400,8 @@  discard block
 block discarded – undo
400 400
 		}
401 401
 
402 402
 		$url     = $request->get_url_params();
403
-		$view_id = intval( $url['id'] );
404
-		$entry_id = intval( $url['s_id'] );
403
+		$view_id = intval( $url[ 'id' ] );
404
+		$entry_id = intval( $url[ 's_id' ] );
405 405
 
406 406
 		$view = \GV\View::by_id( $view_id );
407 407
 
@@ -409,11 +409,11 @@  discard block
 block discarded – undo
409 409
 			return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' );
410 410
 		}
411 411
 
412
-		if ( $entry['form_id'] != $view->form->ID ) {
412
+		if ( $entry[ 'form_id' ] != $view->form->ID ) {
413 413
 			return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' );
414 414
 		}
415 415
 
416
-		if ( $entry['status'] != 'active' ) {
416
+		if ( $entry[ 'status' ] != 'active' ) {
417 417
 			return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' );
418 418
 		}
419 419
 
@@ -421,10 +421,10 @@  discard block
 block discarded – undo
421 421
 			return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' );
422 422
 		}
423 423
 
424
-		$is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap('gravityview_moderate_entries', $view->ID );
424
+		$is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap( 'gravityview_moderate_entries', $view->ID );
425 425
 
426 426
 		if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) {
427
-			if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) )  ) {
427
+			if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) {
428 428
 				return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' );
429 429
 			}
430 430
 		}
Please login to merge, or discard this patch.
includes/class-gravityview-gfformsmodel.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -40,12 +40,12 @@  discard block
 block discarded – undo
40 40
 	public static function is_value_match( $field_value, $target_value, $operation = 'is', $source_field = null, $rule = null, $form = null ) {
41 41
 
42 42
 		if ( 'date_created' === $source_field ) {
43
-			$field_value = is_int( $field_value )? $field_value : strtotime( $field_value );
44
-			$target_value = is_int( $target_value )? $target_value : strtotime( $target_value );
43
+			$field_value = is_int( $field_value ) ? $field_value : strtotime( $field_value );
44
+			$target_value = is_int( $target_value ) ? $target_value : strtotime( $target_value );
45 45
 		}
46 46
 
47 47
 		if ( in_array( $operation, array( 'in', 'not_in' ) ) ) {
48
-			return GVCommon::matches_operation( (array) $field_value, (array) $target_value, $operation );
48
+			return GVCommon::matches_operation( (array)$field_value, (array)$target_value, $operation );
49 49
 		}
50 50
 
51 51
 		return parent::is_value_match( $field_value, $target_value, $operation, $source_field, $rule, $form );
@@ -69,18 +69,18 @@  discard block
 block discarded – undo
69 69
 
70 70
         $post_data = self::get_post_fields( $form, $entry );
71 71
 
72
-        $media = get_attached_media( 'image', $entry['post_id'] );
72
+        $media = get_attached_media( 'image', $entry[ 'post_id' ] );
73 73
 
74 74
         $post_images = array();
75 75
 
76 76
         foreach ( $media as $media_item ) {
77
-            foreach( (array) $post_data['images'] as $post_data_item ) {
78
-                if(
77
+            foreach ( (array)$post_data[ 'images' ] as $post_data_item ) {
78
+                if (
79 79
                     \GV\Utils::get( $post_data_item, 'title' ) === $media_item->post_title &&
80 80
                     \GV\Utils::get( $post_data_item, 'description' ) === $media_item->post_content &&
81 81
                     \GV\Utils::get( $post_data_item, 'caption' ) === $media_item->post_excerpt
82 82
                 ) {
83
-                    $post_images["{$post_data_item['field_id']}"] = $media_item->ID;
83
+                    $post_images[ "{$post_data_item[ 'field_id' ]}" ] = $media_item->ID;
84 84
                 }
85 85
             }
86 86
         }
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
          * If the method changes to public, use Gravity Forms' method
109 109
          * @todo: If/when the method is public, remove the unneeded copied code.
110 110
          */
111
-        if( $reflection->isPublic() ) {
111
+        if ( $reflection->isPublic() ) {
112 112
             return parent::get_post_fields( $form, $entry );
113 113
         }
114 114
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
          * If the method changes to public, use Gravity Forms' method
136 136
          * @todo: If/when the method is public, remove the unneeded copied code.
137 137
          */
138
-        if( $reflection->isPublic() ) {
138
+        if ( $reflection->isPublic() ) {
139 139
             return parent::copy_post_image( $url, $post_id );
140 140
         }
141 141
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
          * If the method changes to public, use Gravity Forms' method
171 171
          * @todo: If/when the method is public, remove the unneeded copied code.
172 172
          */
173
-        if( $reflection->isPublic() ) {
173
+        if ( $reflection->isPublic() ) {
174 174
             return parent::media_handle_upload( $url, $post_id, $post_data );
175 175
         }
176 176
 
Please login to merge, or discard this patch.