Completed
Push — develop ( 67f542...140fbf )
by Zack
16:44
created
includes/class-template.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 	die;
17 17
 }
18 18
 
19
-if( ! class_exists( '\GV\Gamajo_Template_Loader' ) ) {
19
+if ( ! class_exists( '\GV\Gamajo_Template_Loader' ) ) {
20 20
 	require( GRAVITYVIEW_DIR . 'future/lib/class-gamajo-template-loader.php' );
21 21
 }
22 22
 
@@ -164,8 +164,8 @@  discard block
 block discarded – undo
164 164
 			'atts'	  => NULL,
165 165
 		) );
166 166
 
167
-		foreach ($atts as $key => $value) {
168
-			if( is_null( $value ) ) {
167
+		foreach ( $atts as $key => $value ) {
168
+			if ( is_null( $value ) ) {
169 169
 				continue;
170 170
 			}
171 171
 			$this->{$key} = $value;
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	 */
196 196
 	static function getInstance( $passed_post = NULL ) {
197 197
 
198
-		if( empty( self::$instance ) ) {
198
+		if ( empty( self::$instance ) ) {
199 199
 			self::$instance = new self( $passed_post );
200 200
 		}
201 201
 
@@ -208,8 +208,8 @@  discard block
 block discarded – undo
208 208
 	 */
209 209
 	public function getCurrentField( $key = NULL ) {
210 210
 
211
-		if( !empty( $key ) ) {
212
-			if( isset( $this->_current_field[ $key ] ) ) {
211
+		if ( ! empty( $key ) ) {
212
+			if ( isset( $this->_current_field[ $key ] ) ) {
213 213
 				return $this->_current_field[ $key ];
214 214
 			}
215 215
 			return NULL;
@@ -220,16 +220,16 @@  discard block
 block discarded – undo
220 220
 
221 221
 	public function setCurrentFieldSetting( $key, $value ) {
222 222
 
223
-		if( !empty( $this->_current_field ) ) {
224
-			$this->_current_field['field_settings'][ $key ] = $value;
223
+		if ( ! empty( $this->_current_field ) ) {
224
+			$this->_current_field[ 'field_settings' ][ $key ] = $value;
225 225
 		}
226 226
 
227 227
 	}
228 228
 
229 229
 	public function getCurrentFieldSetting( $key ) {
230
-		$settings = $this->getCurrentField('field_settings');
230
+		$settings = $this->getCurrentField( 'field_settings' );
231 231
 
232
-		if( $settings && !empty( $settings[ $key ] ) ) {
232
+		if ( $settings && ! empty( $settings[ $key ] ) ) {
233 233
 			return $settings[ $key ];
234 234
 		}
235 235
 
@@ -260,8 +260,8 @@  discard block
 block discarded – undo
260 260
 	 */
261 261
 	public function getAtts( $key = NULL ) {
262 262
 
263
-		if( !empty( $key ) ) {
264
-			if( isset( $this->atts[ $key ] ) ) {
263
+		if ( ! empty( $key ) ) {
264
+			if ( isset( $this->atts[ $key ] ) ) {
265 265
 				return $this->atts[ $key ];
266 266
 			}
267 267
 			return NULL;
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 
328 328
 		$fields = empty( $this->fields ) ? NULL : $this->fields;
329 329
 
330
-		if( $fields && !empty( $key ) ) {
330
+		if ( $fields && ! empty( $key ) ) {
331 331
 			$fields = isset( $fields[ $key ] ) ? $fields[ $key ] : NULL;
332 332
 		}
333 333
 
@@ -345,18 +345,18 @@  discard block
 block discarded – undo
345 345
 	 */
346 346
 	public function getContextFields( $context = '' ) {
347 347
 
348
-	    if( '' === $context ) {
348
+	    if ( '' === $context ) {
349 349
 	        $context = $this->getContext();
350 350
         }
351 351
 
352 352
 		$fields = $this->getFields();
353 353
 
354
-        foreach ( (array) $fields as $key => $context_fields ) {
354
+        foreach ( (array)$fields as $key => $context_fields ) {
355 355
 
356 356
             // Formatted as `{context}_{template id}-{zone name}`, so we want just the $context to match against
357 357
             $matches = explode( '_', $key );
358 358
 
359
-            if( isset( $matches[0] ) && $matches[0] === $context ) {
359
+            if ( isset( $matches[ 0 ] ) && $matches[ 0 ] === $context ) {
360 360
                 return $context_fields;
361 361
             }
362 362
         }
@@ -377,8 +377,8 @@  discard block
 block discarded – undo
377 377
 	 */
378 378
 	public function getField( $key ) {
379 379
 
380
-		if( !empty( $key ) ) {
381
-			if( isset( $this->fields[ $key ] ) ) {
380
+		if ( ! empty( $key ) ) {
381
+			if ( isset( $this->fields[ $key ] ) ) {
382 382
 				return $this->fields[ $key ];
383 383
 			}
384 384
 		}
@@ -484,8 +484,8 @@  discard block
 block discarded – undo
484 484
 	public function getPaginationCounts() {
485 485
 
486 486
 		$paging = $this->getPaging();
487
-		$offset = $paging['offset'];
488
-		$page_size = $paging['page_size'];
487
+		$offset = $paging[ 'offset' ];
488
+		$page_size = $paging[ 'page_size' ];
489 489
 		$total = $this->getTotalEntries();
490 490
 
491 491
 		if ( empty( $total ) ) {
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
 		 */
507 507
 		list( $first, $last, $total ) = apply_filters( 'gravityview_pagination_counts', array( $first, $last, $total ) );
508 508
 
509
-		return array( 'first' => (int) $first, 'last' => (int) $last, 'total' => (int) $total );
509
+		return array( 'first' => (int)$first, 'last' => (int)$last, 'total' => (int)$total );
510 510
 	}
511 511
 
512 512
 	/**
@@ -602,16 +602,16 @@  discard block
 block discarded – undo
602 602
 	 */
603 603
 	public function getCurrentEntry() {
604 604
 
605
-		if( in_array( $this->getContext(), array( 'edit', 'single') ) ) {
605
+		if ( in_array( $this->getContext(), array( 'edit', 'single' ) ) ) {
606 606
 			$entries = $this->getEntries();
607
-			$entry = $entries[0];
607
+			$entry = $entries[ 0 ];
608 608
 		} else {
609 609
 			$entry = $this->_current_entry;
610 610
 		}
611 611
 
612 612
 		/** @since 1.16 Fixes DataTables empty entry issue */
613
-		if ( empty( $entry ) && ! empty( $this->_current_field['entry'] ) ) {
614
-			$entry = $this->_current_field['entry'];
613
+		if ( empty( $entry ) && ! empty( $this->_current_field[ 'entry' ] ) ) {
614
+			$entry = $this->_current_field[ 'entry' ];
615 615
 		}
616 616
 
617 617
 		return $entry;
@@ -651,7 +651,7 @@  discard block
 block discarded – undo
651 651
 	public function renderZone( $zone = '', $atts = array(), $echo = true ) {
652 652
 
653 653
 		if ( empty( $zone ) ) {
654
-			gravityview()->log->error( 'No zone defined.');
654
+			gravityview()->log->error( 'No zone defined.' );
655 655
 			return NULL;
656 656
 		}
657 657
 
@@ -660,16 +660,16 @@  discard block
 block discarded – undo
660 660
 			'context' => $this->getContext(),
661 661
 			'entry' => $this->getCurrentEntry(),
662 662
 			'form' => $this->getForm(),
663
-			'hide_empty' => $this->getAtts('hide_empty'),
663
+			'hide_empty' => $this->getAtts( 'hide_empty' ),
664 664
 		);
665 665
 
666 666
 		$final_atts = wp_parse_args( $atts, $defaults );
667 667
 
668 668
 		$output = '';
669 669
 
670
-		$final_atts['zone_id'] = "{$final_atts['context']}_{$final_atts['slug']}-{$zone}";
670
+		$final_atts[ 'zone_id' ] = "{$final_atts[ 'context' ]}_{$final_atts[ 'slug' ]}-{$zone}";
671 671
 
672
-		$fields = $this->getField( $final_atts['zone_id'] );
672
+		$fields = $this->getField( $final_atts[ 'zone_id' ] );
673 673
 
674 674
 		// Backward compatibility
675 675
 		if ( 'table' === $this->getTemplatePartSlug() ) {
@@ -679,19 +679,19 @@  discard block
 block discarded – undo
679 679
 			 * @param \GravityView_View $this
680 680
 			 * @deprecated Use `gravityview/template/table/fields`
681 681
 			 */
682
-			$fields = apply_filters("gravityview_table_cells", $fields, $this );
682
+			$fields = apply_filters( "gravityview_table_cells", $fields, $this );
683 683
 		}
684 684
 
685 685
 		if ( empty( $fields ) ) {
686 686
 
687
-			gravityview()->log->warning( 'Empty zone configuration for {zone_id}.', array( 'zone_id' => $final_atts['zone_id'] ) );
687
+			gravityview()->log->warning( 'Empty zone configuration for {zone_id}.', array( 'zone_id' => $final_atts[ 'zone_id' ] ) );
688 688
 
689 689
 			return NULL;
690 690
 		}
691 691
 
692 692
 		$field_output = '';
693 693
 		foreach ( $fields as $field ) {
694
-			$final_atts['field'] = $field;
694
+			$final_atts[ 'field' ] = $field;
695 695
 
696 696
 			$field_output .= gravityview_field_output( $final_atts );
697 697
 		}
@@ -708,17 +708,17 @@  discard block
 block discarded – undo
708 708
 			return NULL;
709 709
 		}
710 710
 
711
-		if( !empty( $final_atts['wrapper_class'] ) ) {
712
-			$output .= '<div class="'.gravityview_sanitize_html_class( $final_atts['wrapper_class'] ).'">';
711
+		if ( ! empty( $final_atts[ 'wrapper_class' ] ) ) {
712
+			$output .= '<div class="' . gravityview_sanitize_html_class( $final_atts[ 'wrapper_class' ] ) . '">';
713 713
 		}
714 714
 
715 715
 		$output .= $field_output;
716 716
 
717
-		if( !empty( $final_atts['wrapper_class'] ) ) {
717
+		if ( ! empty( $final_atts[ 'wrapper_class' ] ) ) {
718 718
 			$output .= '</div>';
719 719
 		}
720 720
 
721
-		if( $echo ) {
721
+		if ( $echo ) {
722 722
 			echo $output;
723 723
 		}
724 724
 
@@ -736,7 +736,7 @@  discard block
 block discarded – undo
736 736
 	 */
737 737
 	function locate_template( $template_names, $load = false, $require_once = true ) {
738 738
 
739
-		if( is_string( $template_names ) && isset( $this->located_templates[ $template_names ] ) ) {
739
+		if ( is_string( $template_names ) && isset( $this->located_templates[ $template_names ] ) ) {
740 740
 
741 741
 			$located = $this->located_templates[ $template_names ];
742 742
 
@@ -745,7 +745,7 @@  discard block
 block discarded – undo
745 745
 			// Set $load to always false so we handle it here.
746 746
 			$located = parent::locate_template( $template_names, false, $require_once );
747 747
 
748
-			if( is_string( $template_names ) ) {
748
+			if ( is_string( $template_names ) ) {
749 749
 				$this->located_templates[ $template_names ] = $located;
750 750
 			}
751 751
 		}
@@ -763,7 +763,7 @@  discard block
 block discarded – undo
763 763
 	 * @return mixed|null    The stored data.
764 764
 	 */
765 765
 	public function __get( $name ) {
766
-		if( isset( $this->{$name} ) ) {
766
+		if ( isset( $this->{$name} ) ) {
767 767
 			return $this->{$name};
768 768
 		} else {
769 769
 			return NULL;
@@ -792,17 +792,17 @@  discard block
 block discarded – undo
792 792
 		$additional = array();
793 793
 
794 794
 		// form-19-table-body.php
795
-		$additional[] = sprintf( 'form-%d-%s-%s.php', $this->getFormId(), $slug, $name );
795
+		$additional[ ] = sprintf( 'form-%d-%s-%s.php', $this->getFormId(), $slug, $name );
796 796
 
797
-		if( $view_id = $this->getViewId() ) {
797
+		if ( $view_id = $this->getViewId() ) {
798 798
 			// view-3-table-body.php
799
-			$additional[] = sprintf( 'view-%d-%s-%s.php', $view_id, $slug, $name );
799
+			$additional[ ] = sprintf( 'view-%d-%s-%s.php', $view_id, $slug, $name );
800 800
 		}
801 801
 
802
-		if( $this->getPostId() ) {
802
+		if ( $this->getPostId() ) {
803 803
 
804 804
 			// page-19-table-body.php
805
-			$additional[] = sprintf( 'page-%d-%s-%s.php', $this->getPostId(), $slug, $name );
805
+			$additional[ ] = sprintf( 'page-%d-%s-%s.php', $this->getPostId(), $slug, $name );
806 806
 		}
807 807
 
808 808
 		// Combine with existing table-body.php and table.php
@@ -824,7 +824,7 @@  discard block
 block discarded – undo
824 824
 
825 825
 		gravityview()->log->debug( 'Rendering Template File: {path}', array( 'path' => $template_file ) );
826 826
 
827
-		if( !empty( $template_file) ) {
827
+		if ( ! empty( $template_file ) ) {
828 828
 
829 829
 			if ( $require_once ) {
830 830
 				require_once( $template_file );
@@ -899,7 +899,7 @@  discard block
 block discarded – undo
899 899
 
900 900
 		// Prevent being called twice
901 901
 		if ( did_action( "gravityview/widgets/$zone/{$view->ID}/rendered" ) ) {
902
-			gravityview()->log->debug( 'Not rendering {zone}; already rendered', array( 'zone' => $zone.'_'.$view->ID.'_widgets' ) );
902
+			gravityview()->log->debug( 'Not rendering {zone}; already rendered', array( 'zone' => $zone . '_' . $view->ID . '_widgets' ) );
903 903
 			return;
904 904
 		}
905 905
 
@@ -921,7 +921,7 @@  discard block
 block discarded – undo
921 921
 		 * @param string $zone Current widget zone, either `header` or `footer`
922 922
 		 * @param array $widgets Array of widget configurations for the current zone, as set by `gravityview_get_current_view_data()['widgets']`
923 923
 		 */
924
-		$css_class = apply_filters('gravityview/widgets/wrapper_css_class', $default_css_class, $zone, $widgets->as_configuration() );
924
+		$css_class = apply_filters( 'gravityview/widgets/wrapper_css_class', $default_css_class, $zone, $widgets->as_configuration() );
925 925
 
926 926
 		$css_class = gravityview_sanitize_html_class( $css_class );
927 927
 
@@ -929,15 +929,15 @@  discard block
 block discarded – undo
929 929
 		?>
930 930
 		<div class="<?php echo $css_class; ?>">
931 931
 			<?php
932
-			foreach( $rows as $row ) {
933
-				foreach( $row as $col => $areas ) {
932
+			foreach ( $rows as $row ) {
933
+				foreach ( $row as $col => $areas ) {
934 934
 					$column = ( $col == '2-2' ) ? '1-2 gv-right' : "$col gv-left";
935 935
 				?>
936 936
 					<div class="gv-grid-col-<?php echo esc_attr( $column ); ?>">
937 937
 						<?php
938 938
 						if ( ! empty( $areas ) ) {
939 939
 							foreach ( $areas as $area ) {
940
-								foreach ( $widgets->by_position( $zone . '_' . $area['areaid'] )->all() as $widget ) {
940
+								foreach ( $widgets->by_position( $zone . '_' . $area[ 'areaid' ] )->all() as $widget ) {
941 941
 									do_action( sprintf( 'gravityview/widgets/%s/render', $widget->get_widget_id() ), $widget->configuration->all(), null, $view_id_or_context );
942 942
 								}
943 943
 							}
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-fileupload.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -26,21 +26,21 @@  discard block
 block discarded – undo
26 26
 
27 27
 	public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) {
28 28
 
29
-		unset( $field_options['search_filter'] );
29
+		unset( $field_options[ 'search_filter' ] );
30 30
 
31
-		if( 'edit' === $context ) {
31
+		if ( 'edit' === $context ) {
32 32
 			return $field_options;
33 33
 		}
34 34
 
35
-		$add_options['link_to_file'] = array(
35
+		$add_options[ 'link_to_file' ] = array(
36 36
 			'type' => 'checkbox',
37 37
 			'label' => __( 'Display as a Link:', 'gk-gravityview' ),
38
-			'desc' => __('Display the uploaded files as links, rather than embedded content.', 'gk-gravityview'),
38
+			'desc' => __( 'Display the uploaded files as links, rather than embedded content.', 'gk-gravityview' ),
39 39
 			'value' => false,
40 40
 			'merge_tags' => false,
41 41
 		);
42 42
 
43
-		$add_options['image_width'] = array(
43
+		$add_options[ 'image_width' ] = array(
44 44
 			'type' => 'text',
45 45
 			'label' => __( 'Custom Width:', 'gk-gravityview' ),
46 46
 			'desc' => __( 'Override the default image width (250).', 'gk-gravityview' ),
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
 		$field = \GV\GF_Field::by_id( \GV\GF_Form::by_id( $form_id ), $field_id );
52 52
 
53 53
 		// Only allow alt text on single files currently.
54
-		if( empty( $field->field->multipleFiles ) ) {
54
+		if ( empty( $field->field->multipleFiles ) ) {
55 55
 
56
-			$add_options['alt_text'] = array(
56
+			$add_options[ 'alt_text' ] = array(
57 57
 				'type'       => 'text',
58 58
 				'label'      => __( 'Alternative text', 'gk-gravityview' ),
59 59
 				'desc'       => __( 'Define an alternative text description of a file. For supported file types only. By default, the field label is used.', 'gk-gravityview' ),
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 
148 148
 			/** A compatibility array that's required by some of the deprecated filters. */
149 149
 			$field_compat = array(
150
-				'form' => (isset($context->source->form) ? $context->source->form : ''),
150
+				'form' => ( isset( $context->source->form ) ? $context->source->form : '' ),
151 151
 				'field_id' => $context->field->ID,
152 152
 				'field' => $field,
153 153
 				'field_settings' => $field_settings,
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 				'format' => 'html',
157 157
 				'entry' => $entry,
158 158
 				'field_type' => $context->field->type,
159
-				'field_path' => (isset($context->template->located_template) ? $context->template->located_template : ''),
159
+				'field_path' => ( isset( $context->template->located_template ) ? $context->template->located_template : '' ),
160 160
 			);
161 161
 		} else {
162 162
 
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 			$base_id = null;
175 175
 
176 176
 			$is_single = gravityview_get_context() === 'single';
177
-			$lightbox = ! empty( $gravityview_view->atts['lightbox'] );
177
+			$lightbox = ! empty( $gravityview_view->atts[ 'lightbox' ] );
178 178
 			$field_compat = $gravityview_view->getCurrentField();
179 179
 		}
180 180
 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 		$gf_form    = \GV\GF_Form::by_id( $context->field->field->formId );
183 183
 
184 184
 		// Get an array of file paths for the field.
185
-		$file_paths = (int) \GV\Utils::get( $field, 'multipleFiles' ) !== 1 ? array( $value ) : $value;
185
+		$file_paths = (int)\GV\Utils::get( $field, 'multipleFiles' ) !== 1 ? array( $value ) : $value;
186 186
 
187 187
 		// The $value JSON was probably truncated; let's check lead_detail_long.
188 188
 		if ( ! is_array( $file_paths ) ) {
@@ -203,18 +203,18 @@  discard block
 block discarded – undo
203 203
 
204 204
 			$file_info = self::get_file_info( $file_path, $field, $field_settings, $context, $index );
205 205
 
206
-			$file_path = $file_info['file_path'];
207
-			$basename = $file_info['basename'];
208
-			$extension = $file_info['extension'];
209
-			$insecure_file_path = $file_info['insecure_file_path'];
210
-			$secure_file_path = $file_info['secure_file_path'];
211
-			$is_secure = $file_info['is_secure'];
206
+			$file_path = $file_info[ 'file_path' ];
207
+			$basename = $file_info[ 'basename' ];
208
+			$extension = $file_info[ 'extension' ];
209
+			$insecure_file_path = $file_info[ 'insecure_file_path' ];
210
+			$secure_file_path = $file_info[ 'secure_file_path' ];
211
+			$is_secure = $file_info[ 'is_secure' ];
212 212
 
213 213
 			$disable_lightbox = false;
214 214
 			$text             = $basename;
215 215
 
216 216
 			$alt = \GV\Utils::get( $field_settings, 'alt_text' );
217
-			$alt = ( '' === $alt ) ? $field_settings['label'] : $alt;
217
+			$alt = ( '' === $alt ) ? $field_settings[ 'label' ] : $alt;
218 218
 			$alt = GFCommon::replace_variables( $alt, $gf_form->form, $entry );
219 219
 
220 220
 			// Audio
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 					 */
231 231
 					$audio_settings = apply_filters( 'gravityview_audio_settings', array(
232 232
 						'src' => $insecure_file_path, // Needs to be insecure path so WP can parse extension
233
-						'class' => 'wp-audio-shortcode gv-audio gv-field-id-'.$field_settings['id']
233
+						'class' => 'wp-audio-shortcode gv-audio gv-field-id-' . $field_settings[ 'id' ]
234 234
 					), $context );
235 235
 
236 236
 					/**
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 					 */
260 260
 					$video_settings = apply_filters( 'gravityview_video_settings', array(
261 261
 						'src' => $insecure_file_path, // Needs to be insecure path so WP can parse extension
262
-						'class' => 'wp-video-shortcode gv-video gv-field-id-'.$field_settings['id']
262
+						'class' => 'wp-video-shortcode gv-video gv-field-id-' . $field_settings[ 'id' ]
263 263
 					), $context );
264 264
 
265 265
 					/**
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 					$file_path = add_query_arg( array( 'gv-iframe' => 'true' ), $file_path );
284 284
 				}
285 285
 
286
-				$field_settings['link_to_file'] = true;
286
+				$field_settings[ 'link_to_file' ] = true;
287 287
 
288 288
 			// Images
289 289
 			} else if ( in_array( $extension, GravityView_Image::get_image_extensions() ) ) {
@@ -291,13 +291,13 @@  discard block
 block discarded – undo
291 291
 
292 292
 				$image_atts = array(
293 293
 					'src'   => $file_path,
294
-					'class' => 'gv-image gv-field-id-' . $field_settings['id'],
294
+					'class' => 'gv-image gv-field-id-' . $field_settings[ 'id' ],
295 295
 					'alt'   => $alt,
296
-					'width' => ( $is_single ? null : ( $width ? $width: 250 ) )
296
+					'width' => ( $is_single ? null : ( $width ? $width : 250 ) )
297 297
 				);
298 298
 
299 299
 				if ( $is_secure ) {
300
-					$image_atts['validate_src'] = false;
300
+					$image_atts[ 'validate_src' ] = false;
301 301
 				}
302 302
 
303 303
 				/**
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 
319 319
 				unset( $gv_entry );
320 320
 
321
-				if ( $lightbox && empty( $field_settings['show_as_link'] ) ) {
321
+				if ( $lightbox && empty( $field_settings[ 'show_as_link' ] ) ) {
322 322
 
323 323
 					$lightbox_link_atts = array(
324 324
 						'rel'   => sprintf( "%s-%s", $gv_class, $entry_slug ),
@@ -333,13 +333,13 @@  discard block
 block discarded – undo
333 333
 				}
334 334
 
335 335
 				// Show as link should render the image regardless.
336
-				if ( ! empty( $field_settings['show_as_link'] ) ) {
336
+				if ( ! empty( $field_settings[ 'show_as_link' ] ) ) {
337 337
 					$text = $rendered;
338 338
 				}
339 339
 			}
340 340
 			// For all other non-media file types (ZIP, for example), always show as a link regardless of setting.
341 341
 			else {
342
-				$field_settings['link_to_file'] = true;
342
+				$field_settings[ 'link_to_file' ] = true;
343 343
 				$disable_lightbox = true;
344 344
 			}
345 345
 
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 			$disable_wrapped_link = apply_filters( 'gravityview/fields/fileupload/disable_link', false, $field_compat, $context );
356 356
 
357 357
 			// Output textualized content where
358
-			if ( ! $disable_wrapped_link && ( ! empty( $field_settings['link_to_file'] ) || ! empty( $field_settings['show_as_link'] ) ) ) {
358
+			if ( ! $disable_wrapped_link && ( ! empty( $field_settings[ 'link_to_file' ] ) || ! empty( $field_settings[ 'show_as_link' ] ) ) ) {
359 359
 				/**
360 360
 				 * Modify the link text (defaults to the file name)
361 361
 				 *
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 				 */
369 369
 				$content = apply_filters( 'gravityview/fields/fileupload/link_content', $text, $field_compat, $context );
370 370
 
371
-				if ( empty( $field_settings['show_as_link'] ) ) {
371
+				if ( empty( $field_settings[ 'show_as_link' ] ) ) {
372 372
 					/**
373 373
 					 * @filter `gravityview/fields/fileupload/link_atts` Modify the link attributes for a file upload field
374 374
 					 * @since 2.0 Added $context
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 				$content = empty( $rendered ) ? $text : $rendered;
390 390
 			}
391 391
 
392
-			$output_arr[] = array(
392
+			$output_arr[ ] = array(
393 393
 				'file_path' => $file_path,
394 394
 				'content' => $content
395 395
 			);
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 		$file_path_info = pathinfo( $file_path );
441 441
 
442 442
 		// If pathinfo() gave us the extension of the file, run the switch statement using that.
443
-		$extension = empty( $file_path_info['extension'] ) ? null : strtolower( $file_path_info['extension'] );
443
+		$extension = empty( $file_path_info[ 'extension' ] ) ? null : strtolower( $file_path_info[ 'extension' ] );
444 444
 
445 445
 		/**
446 446
 		 * @filter `gravityview/fields/fileupload/extension` Modify the file extension before it's used in display logic
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
 		 */
452 452
 		$extension = apply_filters( 'gravityview/fields/fileupload/extension', $extension, $file_path );
453 453
 
454
-		$basename = $file_path_info['basename'];
454
+		$basename = $file_path_info[ 'basename' ];
455 455
 
456 456
 		// Get the secure download URL
457 457
 		$is_secure          = false;
Please login to merge, or discard this patch.
includes/class-api.php 1 patch
Spacing   +112 added lines, -112 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
 		$form = $gravityview_view->getForm();
32 32
 
33
-		if ( defined( 'DOING_GRAVITYVIEW_TESTS' ) && ! empty( $GLOBALS['GravityView_API_field_label_override'] ) ) {
33
+		if ( defined( 'DOING_GRAVITYVIEW_TESTS' ) && ! empty( $GLOBALS[ 'GravityView_API_field_label_override' ] ) ) {
34 34
 			/** Allow to fall through for back compatibility testing purposes. */
35 35
 		} else {
36 36
 			return \GV\Mocks\GravityView_API_field_label( $form, $field, $entry, $force_show_label );
@@ -38,29 +38,29 @@  discard block
 block discarded – undo
38 38
 
39 39
 		$label = '';
40 40
 
41
-		if( !empty( $field['show_label'] ) || $force_show_label ) {
41
+		if ( ! empty( $field[ 'show_label' ] ) || $force_show_label ) {
42 42
 
43
-			$label = $field['label'];
43
+			$label = $field[ 'label' ];
44 44
 
45 45
 			// Support Gravity Forms 1.9+
46
-			if( class_exists( 'GF_Field' ) ) {
46
+			if ( class_exists( 'GF_Field' ) ) {
47 47
 
48
-				$field_object = RGFormsModel::get_field( $form, $field['id'] );
48
+				$field_object = RGFormsModel::get_field( $form, $field[ 'id' ] );
49 49
 
50
-				if( $field_object ) {
50
+				if ( $field_object ) {
51 51
 
52
-					$input = GFFormsModel::get_input( $field_object, $field['id'] );
52
+					$input = GFFormsModel::get_input( $field_object, $field[ 'id' ] );
53 53
 
54 54
 					// This is a complex field, with labels on a per-input basis
55
-					if( $input ) {
55
+					if ( $input ) {
56 56
 
57 57
 						// Does the input have a custom label on a per-input basis? Otherwise, default label.
58
-						$label = ! empty( $input['customLabel'] ) ? $input['customLabel'] : $input['label'];
58
+						$label = ! empty( $input[ 'customLabel' ] ) ? $input[ 'customLabel' ] : $input[ 'label' ];
59 59
 
60 60
 					} else {
61 61
 
62 62
 						// This is a field with one label
63
-						$label = $field_object->get_field_label( true, $field['label'] );
63
+						$label = $field_object->get_field_label( true, $field[ 'label' ] );
64 64
 
65 65
 					}
66 66
 
@@ -69,9 +69,9 @@  discard block
 block discarded – undo
69 69
 			}
70 70
 
71 71
 			// Use Gravity Forms label by default, but if a custom label is defined in GV, use it.
72
-			if ( !empty( $field['custom_label'] ) ) {
72
+			if ( ! empty( $field[ 'custom_label' ] ) ) {
73 73
 
74
-				$label = self::replace_variables( $field['custom_label'], $form, $entry );
74
+				$label = self::replace_variables( $field[ 'custom_label' ], $form, $entry );
75 75
 
76 76
 			}
77 77
 
@@ -133,11 +133,11 @@  discard block
 block discarded – undo
133 133
 
134 134
 		$width = NULL;
135 135
 
136
-		if( !empty( $field['width'] ) ) {
137
-			$width = absint( $field['width'] );
136
+		if ( ! empty( $field[ 'width' ] ) ) {
137
+			$width = absint( $field[ 'width' ] );
138 138
 
139 139
 			// If using percentages, limit to 100%
140
-			if( '%d%%' === $format && $width > 100 ) {
140
+			if ( '%d%%' === $format && $width > 100 ) {
141 141
 				$width = 100;
142 142
 			}
143 143
 
@@ -157,42 +157,42 @@  discard block
 block discarded – undo
157 157
 	public static function field_class( $field, $form = NULL, $entry = NULL ) {
158 158
 		$classes = array();
159 159
 
160
-		if( !empty( $field['custom_class'] ) ) {
160
+		if ( ! empty( $field[ 'custom_class' ] ) ) {
161 161
 
162
-            $custom_class = $field['custom_class'];
162
+            $custom_class = $field[ 'custom_class' ];
163 163
 
164
-            if( !empty( $entry ) ) {
164
+            if ( ! empty( $entry ) ) {
165 165
 
166 166
                 // We want the merge tag to be formatted as a class. The merge tag may be
167 167
                 // replaced by a multiple-word value that should be output as a single class.
168 168
                 // "Office Manager" will be formatted as `.OfficeManager`, not `.Office` and `.Manager`
169
-                add_filter('gform_merge_tag_filter', 'sanitize_html_class');
169
+                add_filter( 'gform_merge_tag_filter', 'sanitize_html_class' );
170 170
 
171
-                $custom_class = self::replace_variables( $custom_class, $form, $entry);
171
+                $custom_class = self::replace_variables( $custom_class, $form, $entry );
172 172
 
173 173
                 // And then we want life to return to normal
174
-                remove_filter('gform_merge_tag_filter', 'sanitize_html_class');
174
+                remove_filter( 'gform_merge_tag_filter', 'sanitize_html_class' );
175 175
             }
176 176
 
177 177
 			// And now we want the spaces to be handled nicely.
178
-			$classes[] = gravityview_sanitize_html_class( $custom_class );
178
+			$classes[ ] = gravityview_sanitize_html_class( $custom_class );
179 179
 
180 180
 		}
181 181
 
182
-		if(!empty($field['id'])) {
183
-			if( !empty( $form ) && !empty( $form['id'] ) ) {
184
-				$form_id = '-'.$form['id'];
182
+		if ( ! empty( $field[ 'id' ] ) ) {
183
+			if ( ! empty( $form ) && ! empty( $form[ 'id' ] ) ) {
184
+				$form_id = '-' . $form[ 'id' ];
185 185
 			} else {
186 186
 				// @deprecated path. Form should always be given.
187 187
 				gravityview()->log->warning( 'GravityView_View::getInstance() legacy API called' );
188 188
 				$gravityview_view = GravityView_View::getInstance();
189
-				$form_id = $gravityview_view->getFormId() ? '-'. $gravityview_view->getFormId() : '';
189
+				$form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : '';
190 190
 			}
191 191
 
192
-			$classes[] = 'gv-field'.$form_id.'-'.$field['id'];
192
+			$classes[ ] = 'gv-field' . $form_id . '-' . $field[ 'id' ];
193 193
 		}
194 194
 
195
-		return esc_attr(implode(' ', $classes));
195
+		return esc_attr( implode( ' ', $classes ) );
196 196
 	}
197 197
 
198 198
 	/**
@@ -207,11 +207,11 @@  discard block
 block discarded – undo
207 207
 	 * @return string Sanitized unique HTML `id` attribute for the field
208 208
 	 */
209 209
 	public static function field_html_attr_id( $field, $form = array(), $entry = array() ) {
210
-		$id = $field['id'];
210
+		$id = $field[ 'id' ];
211 211
 
212 212
 		if ( ! empty( $id ) ) {
213
-			if ( ! empty( $form ) && ! empty( $form['id'] ) ) {
214
-				$form_id = '-' . $form['id'];
213
+			if ( ! empty( $form ) && ! empty( $form[ 'id' ] ) ) {
214
+				$form_id = '-' . $form[ 'id' ];
215 215
 			} else {
216 216
 				// @deprecated path. Form should always be given.
217 217
 				gravityview()->log->warning( 'GravityView_View::getInstance() legacy API called' );
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 				$form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : '';
220 220
 			}
221 221
 
222
-			$id = 'gv-field' . $form_id . '-' . $field['id'];
222
+			$id = 'gv-field' . $form_id . '-' . $field[ 'id' ];
223 223
 		}
224 224
 
225 225
 		return esc_attr( $id );
@@ -258,14 +258,14 @@  discard block
 block discarded – undo
258 258
 	 */
259 259
 	public static function entry_link_html( $entry = array(), $anchor_text = '', $passed_tag_atts = array(), $field_settings = array(), $base_id = null ) {
260 260
 
261
-		if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry['id'] ) ) {
261
+		if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry[ 'id' ] ) ) {
262 262
 			gravityview()->log->debug( 'Entry not defined; returning null', array( 'data' => $entry ) );
263 263
 			return NULL;
264 264
 		}
265 265
 
266 266
 		$href = self::entry_link( $entry, $base_id );
267 267
 
268
-		if( '' === $href ) {
268
+		if ( '' === $href ) {
269 269
 			return NULL;
270 270
 		}
271 271
 
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 		} else {
303 303
 			$gravityview_view = GravityView_View::getInstance();
304 304
 
305
-			if( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) {
305
+			if ( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) {
306 306
 				$is_search = true;
307 307
 			}
308 308
 		}
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 
314 314
 			$output = esc_html__( 'This search returned no results.', 'gk-gravityview' );
315 315
 
316
-			if( $context ) {
316
+			if ( $context ) {
317 317
 				$setting = $context->view->settings->get( 'no_search_results_text', $output );
318 318
 			}
319 319
 
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 
322 322
 			$output = esc_html__( 'No entries match your request.', 'gk-gravityview' );
323 323
 
324
-			if( $context ) {
324
+			if ( $context ) {
325 325
 				$setting = $context->view->settings->get( 'no_results_text', $output );
326 326
 			}
327 327
 		}
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 			$link = $directory_links[ 'gv_directory_link_' . $post_id ];
454 454
 		}
455 455
 
456
-		if ( (int) $post_id === (int) get_option( 'page_on_front' ) ) {
456
+		if ( (int)$post_id === (int)get_option( 'page_on_front' ) ) {
457 457
 			$link = home_url();
458 458
 		}
459 459
 
@@ -468,13 +468,13 @@  discard block
 block discarded – undo
468 468
 
469 469
 			$args = array();
470 470
 
471
-			if( $pagenum = \GV\Utils::_GET( 'pagenum' ) ) {
472
-				$args['pagenum'] = intval( $pagenum );
471
+			if ( $pagenum = \GV\Utils::_GET( 'pagenum' ) ) {
472
+				$args[ 'pagenum' ] = intval( $pagenum );
473 473
 			}
474 474
 
475
-			if( $sort = \GV\Utils::_GET( 'sort' ) ) {
476
-				$args['sort'] = $sort;
477
-				$args['dir'] = \GV\Utils::_GET( 'dir' );
475
+			if ( $sort = \GV\Utils::_GET( 'sort' ) ) {
476
+				$args[ 'sort' ] = $sort;
477
+				$args[ 'dir' ] = \GV\Utils::_GET( 'dir' );
478 478
 			}
479 479
 
480 480
 			$link = add_query_arg( $args, $link );
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
 	private static function get_custom_entry_slug( $id, $entry = array() ) {
512 512
 
513 513
 		// Generate an unique hash to use as the default value
514
-		$slug = substr( wp_hash( $id, 'gravityview'.$id ), 0, 8 );
514
+		$slug = substr( wp_hash( $id, 'gravityview' . $id ), 0, 8 );
515 515
 
516 516
 		/**
517 517
 		 * @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}`
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
 		$slug = apply_filters( 'gravityview_entry_slug', $slug, $id, $entry );
523 523
 
524 524
 		// Make sure we have something - use the original ID as backup.
525
-		if( empty( $slug ) ) {
525
+		if ( empty( $slug ) ) {
526 526
 			$slug = $id;
527 527
 		}
528 528
 
@@ -616,15 +616,15 @@  discard block
 block discarded – undo
616 616
          * @param boolean $custom Should we process the custom entry slug?
617 617
          */
618 618
         $custom = apply_filters( 'gravityview_custom_entry_slug', false );
619
-        if( $custom ) {
619
+        if ( $custom ) {
620 620
             // create the gravityview_unique_id and save it
621 621
 
622 622
             // Get the entry hash
623
-            $hash = self::get_custom_entry_slug( $entry['id'], $entry );
623
+            $hash = self::get_custom_entry_slug( $entry[ 'id' ], $entry );
624 624
 
625
-	        gravityview()->log->debug( 'Setting hash for entry {entry_id}: {hash}', array( 'entry_id' => $entry['id'], 'hash' => $hash ) );
625
+	        gravityview()->log->debug( 'Setting hash for entry {entry_id}: {hash}', array( 'entry_id' => $entry[ 'id' ], 'hash' => $hash ) );
626 626
 
627
-            gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash, \GV\Utils::get( $entry, 'form_id' ) );
627
+            gform_update_meta( $entry[ 'id' ], 'gravityview_unique_id', $hash, \GV\Utils::get( $entry, 'form_id' ) );
628 628
 
629 629
         }
630 630
     }
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
 
651 651
 		if ( ! empty( $entry ) && ! is_array( $entry ) ) {
652 652
 			$entry = GVCommon::get_entry( $entry );
653
-		} else if( empty( $entry ) ) {
653
+		} else if ( empty( $entry ) ) {
654 654
 			// @deprecated path
655 655
 			$entry = GravityView_frontend::getInstance()->getEntry();
656 656
 		}
@@ -670,32 +670,32 @@  discard block
 block discarded – undo
670 670
 
671 671
 		$query_arg_name = \GV\Entry::get_endpoint_name();
672 672
 
673
-		if ( ! empty( $entry['_multi'] ) ) {
673
+		if ( ! empty( $entry[ '_multi' ] ) ) {
674 674
 			$entry_slugs = array();
675 675
 
676
-			foreach ( $entry['_multi'] as $_multi ) {
676
+			foreach ( $entry[ '_multi' ] as $_multi ) {
677 677
 
678
-				if( $gv_multi = \GV\GF_Entry::from_entry( $_multi ) ) {
679
-					$entry_slugs[] = $gv_multi->get_slug();
678
+				if ( $gv_multi = \GV\GF_Entry::from_entry( $_multi ) ) {
679
+					$entry_slugs[ ] = $gv_multi->get_slug();
680 680
 				} else {
681 681
 					// TODO: This path isn't covered by unit tests
682
-					$entry_slugs[] = \GravityView_API::get_entry_slug( $_multi['id'], $_multi );
682
+					$entry_slugs[ ] = \GravityView_API::get_entry_slug( $_multi[ 'id' ], $_multi );
683 683
 				}
684 684
 
685 685
 				unset( $gv_multi );
686 686
 
687
-				$forms[] = $_multi['form_id'];
687
+				$forms[ ] = $_multi[ 'form_id' ];
688 688
 			}
689 689
 
690 690
 			$entry_slug = implode( ',', $entry_slugs );
691 691
 		} else {
692 692
 
693 693
 			// Fallback when
694
-			if( $gv_entry = \GV\GF_Entry::from_entry( $entry ) ) {
694
+			if ( $gv_entry = \GV\GF_Entry::from_entry( $entry ) ) {
695 695
 				$entry_slug = $gv_entry->get_slug();
696 696
 			} else {
697 697
 				// TODO: This path isn't covered by unit tests
698
-				$entry_slug = \GravityView_API::get_entry_slug( $entry['id'], $entry );
698
+				$entry_slug = \GravityView_API::get_entry_slug( $entry[ 'id' ], $entry );
699 699
 			}
700 700
 
701 701
 			unset( $gv_entry );
@@ -714,7 +714,7 @@  discard block
 block discarded – undo
714 714
 			$args = gv_get_query_args();
715 715
 		}
716 716
 
717
-		if ( get_option('permalink_structure') && ! is_preview() ) {
717
+		if ( get_option( 'permalink_structure' ) && ! is_preview() ) {
718 718
 
719 719
 			/**
720 720
 			 * Make sure the $directory_link doesn't contain any query otherwise it will break when adding the entry slug.
@@ -722,13 +722,13 @@  discard block
 block discarded – undo
722 722
 			 */
723 723
 			$link_parts = explode( '?', $directory_link );
724 724
 
725
-			$query = !empty( $link_parts[1] ) ? '?'.$link_parts[1] : '';
725
+			$query = ! empty( $link_parts[ 1 ] ) ? '?' . $link_parts[ 1 ] : '';
726 726
 
727
-			$directory_link = trailingslashit( $link_parts[0] ) . $query_arg_name . '/'. $entry_slug .'/' . $query;
727
+			$directory_link = trailingslashit( $link_parts[ 0 ] ) . $query_arg_name . '/' . $entry_slug . '/' . $query;
728 728
 
729 729
 		} else {
730 730
 
731
-			$args[] = array( $query_arg_name => $entry_slug );
731
+			$args[ ] = array( $query_arg_name => $entry_slug );
732 732
 		}
733 733
 
734 734
 		/**
@@ -736,21 +736,21 @@  discard block
 block discarded – undo
736 736
 		 */
737 737
 		if ( $add_directory_args ) {
738 738
 
739
-			if ( ! empty( $_GET['pagenum'] ) ) {
740
-				$args['pagenum'] = intval( $_GET['pagenum'] );
739
+			if ( ! empty( $_GET[ 'pagenum' ] ) ) {
740
+				$args[ 'pagenum' ] = intval( $_GET[ 'pagenum' ] );
741 741
 			}
742 742
 
743 743
 			/**
744 744
 			 * @since 1.7
745 745
 			 */
746 746
 			if ( $sort = \GV\Utils::_GET( 'sort' ) ) {
747
-				$args['sort'] = $sort;
748
-				$args['dir'] = \GV\Utils::_GET( 'dir' );
747
+				$args[ 'sort' ] = $sort;
748
+				$args[ 'dir' ] = \GV\Utils::_GET( 'dir' );
749 749
 			}
750 750
 
751 751
 		}
752 752
 
753
-		if( $post_id ) {
753
+		if ( $post_id ) {
754 754
 			$passed_post = get_post( $post_id );
755 755
 			$views       = \GV\View_Collection::from_post( $passed_post );
756 756
 			$has_multiple_views = $views->count() > 1;
@@ -759,7 +759,7 @@  discard block
 block discarded – undo
759 759
 		}
760 760
 
761 761
 		if ( $has_multiple_views ) {
762
-			$args['gvid'] = $view_id ? $view_id : gravityview_get_view_id();
762
+			$args[ 'gvid' ] = $view_id ? $view_id : gravityview_get_view_id();
763 763
 		}
764 764
 
765 765
 		return add_query_arg( $args, $directory_link );
@@ -831,7 +831,7 @@  discard block
 block discarded – undo
831 831
 }
832 832
 
833 833
 function gv_class( $field, $form = NULL, $entry = array() ) {
834
-	return GravityView_API::field_class( $field, $form, $entry  );
834
+	return GravityView_API::field_class( $field, $form, $entry );
835 835
 }
836 836
 
837 837
 /**
@@ -854,7 +854,7 @@  discard block
 block discarded – undo
854 854
 		$view_id = 0;
855 855
 		if ( $context->view ) {
856 856
 			$view_id = $context->view->ID;
857
-			if( $context->view->settings->get( 'hide_until_searched' ) ) {
857
+			if ( $context->view->settings->get( 'hide_until_searched' ) ) {
858 858
 				$hide_until_searched = ( empty( $context->entry ) && ! $context->request->is_search() );
859 859
 			}
860 860
 		}
@@ -886,7 +886,7 @@  discard block
 block discarded – undo
886 886
 		$default_css_class .= ' ' . $context->view->settings->get( 'class', '' );
887 887
 	}
888 888
 
889
-	$css_class = trim( $passed_css_class . ' '. $default_css_class );
889
+	$css_class = trim( $passed_css_class . ' ' . $default_css_class );
890 890
 
891 891
 	/**
892 892
 	 * @filter `gravityview/render/container/class` Modify the CSS class to be added to the wrapper <div> of a View
@@ -913,7 +913,7 @@  discard block
 block discarded – undo
913 913
 
914 914
 	$value = GravityView_API::field_value( $entry, $field );
915 915
 
916
-	if( $value === '' ) {
916
+	if ( $value === '' ) {
917 917
 		/**
918 918
 		 * @filter `gravityview_empty_value` What to display when a field is empty
919 919
 		 * @param string $value (empty string)
@@ -1026,7 +1026,7 @@  discard block
 block discarded – undo
1026 1026
  */
1027 1027
 function gravityview_get_field_value( $entry, $field_id, $display_value ) {
1028 1028
 
1029
-	if( floatval( $field_id ) === floor( floatval( $field_id ) ) ) {
1029
+	if ( floatval( $field_id ) === floor( floatval( $field_id ) ) ) {
1030 1030
 
1031 1031
 		// For the complete field value as generated by Gravity Forms
1032 1032
 		return $display_value;
@@ -1060,16 +1060,16 @@  discard block
 block discarded – undo
1060 1060
 		$terms = explode( ', ', $value );
1061 1061
 	}
1062 1062
 
1063
-	foreach ($terms as $term_name ) {
1063
+	foreach ( $terms as $term_name ) {
1064 1064
 
1065 1065
 		// If we're processing a category,
1066
-		if( $taxonomy === 'category' ) {
1066
+		if ( $taxonomy === 'category' ) {
1067 1067
 
1068 1068
 			// Use rgexplode to prevent errors if : doesn't exist
1069 1069
 			list( $term_name, $term_id ) = rgexplode( ':', $term_name, 2 );
1070 1070
 
1071 1071
 			// The explode was succesful; we have the category ID
1072
-			if( !empty( $term_id )) {
1072
+			if ( ! empty( $term_id ) ) {
1073 1073
 				$term = get_term_by( 'id', $term_id, $taxonomy );
1074 1074
 			} else {
1075 1075
 			// We have to fall back to the name
@@ -1082,7 +1082,7 @@  discard block
 block discarded – undo
1082 1082
 		}
1083 1083
 
1084 1084
 		// There's still a tag/category here.
1085
-		if( $term ) {
1085
+		if ( $term ) {
1086 1086
 
1087 1087
 			$term_link = get_term_link( $term, $taxonomy );
1088 1088
 
@@ -1091,11 +1091,11 @@  discard block
 block discarded – undo
1091 1091
 			    continue;
1092 1092
 			}
1093 1093
 
1094
-			$output[] = gravityview_get_link( $term_link, esc_html( $term->name ) );
1094
+			$output[ ] = gravityview_get_link( $term_link, esc_html( $term->name ) );
1095 1095
 		}
1096 1096
 	}
1097 1097
 
1098
-	return implode(', ', $output );
1098
+	return implode( ', ', $output );
1099 1099
 }
1100 1100
 
1101 1101
 /**
@@ -1109,8 +1109,8 @@  discard block
 block discarded – undo
1109 1109
 
1110 1110
 	$output = get_the_term_list( $post_id, $taxonomy, NULL, ', ' );
1111 1111
 
1112
-	if( empty( $link ) ) {
1113
-		return strip_tags( $output);
1112
+	if ( empty( $link ) ) {
1113
+		return strip_tags( $output );
1114 1114
 	}
1115 1115
 
1116 1116
 	return $output;
@@ -1129,7 +1129,7 @@  discard block
 block discarded – undo
1129 1129
 	$fe = GravityView_frontend::getInstance();
1130 1130
 
1131 1131
 	// Solve problem when loading content via admin-ajax.php
1132
-	if( ! $fe->getGvOutputData() ) {
1132
+	if ( ! $fe->getGvOutputData() ) {
1133 1133
 
1134 1134
 		gravityview()->log->debug( 'gv_output_data not defined; parsing content.' );
1135 1135
 
@@ -1137,7 +1137,7 @@  discard block
 block discarded – undo
1137 1137
 	}
1138 1138
 
1139 1139
 	// Make 100% sure that we're dealing with a properly called situation
1140
-	if( !is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) {
1140
+	if ( ! is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) {
1141 1141
 
1142 1142
 		gravityview()->log->debug( 'gv_output_data not an object or get_view not callable.', array( 'data' => $fe->getGvOutputData() ) );
1143 1143
 
@@ -1368,12 +1368,12 @@  discard block
 block discarded – undo
1368 1368
 function gravityview_get_files_array( $value, $gv_class = '', $context = null ) {
1369 1369
 	/** @define "GRAVITYVIEW_DIR" "../" */
1370 1370
 
1371
-	if( !class_exists( 'GravityView_Field' ) ) {
1372
-		include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field.php' );
1371
+	if ( ! class_exists( 'GravityView_Field' ) ) {
1372
+		include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field.php' );
1373 1373
 	}
1374 1374
 
1375
-	if( !class_exists( 'GravityView_Field_FileUpload' ) ) {
1376
-		include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field-fileupload.php' );
1375
+	if ( ! class_exists( 'GravityView_Field_FileUpload' ) ) {
1376
+		include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field-fileupload.php' );
1377 1377
 	}
1378 1378
 
1379 1379
 	if ( is_null( $context ) ) {
@@ -1484,21 +1484,21 @@  discard block
 block discarded – undo
1484 1484
 	} else {
1485 1485
 		// @deprecated path
1486 1486
 		// Required fields.
1487
-		if ( empty( $args['field'] ) || empty( $args['form'] ) ) {
1487
+		if ( empty( $args[ 'field' ] ) || empty( $args[ 'form' ] ) ) {
1488 1488
 			gravityview()->log->error( 'Field or form are empty.', array( 'data' => $args ) );
1489 1489
 			return '';
1490 1490
 		}
1491 1491
 	}
1492 1492
 
1493 1493
 	if ( $context instanceof \GV\Template_Context ) {
1494
-		$entry = $args['entry'] ? : ( $context->entry ? $context->entry->as_entry() : array() );
1495
-		$field = $args['field'] ? : ( $context->field ? $context->field->as_configuration() : array() );
1496
-		$form = $args['form'] ? : ( $context->view->form ? $context->view->form->form : array() );
1494
+		$entry = $args[ 'entry' ] ?: ( $context->entry ? $context->entry->as_entry() : array() );
1495
+		$field = $args[ 'field' ] ?: ( $context->field ? $context->field->as_configuration() : array() );
1496
+		$form = $args[ 'form' ] ?: ( $context->view->form ? $context->view->form->form : array() );
1497 1497
 	} else {
1498 1498
 		// @deprecated path
1499
-		$entry = empty( $args['entry'] ) ? array() : $args['entry'];
1500
-		$field = $args['field'];
1501
-		$form = $args['form'];
1499
+		$entry = empty( $args[ 'entry' ] ) ? array() : $args[ 'entry' ];
1500
+		$field = $args[ 'field' ];
1501
+		$form = $args[ 'form' ];
1502 1502
 	}
1503 1503
 
1504 1504
 	/**
@@ -1518,43 +1518,43 @@  discard block
 block discarded – undo
1518 1518
 	);
1519 1519
 
1520 1520
 	if ( $context instanceof \GV\Template_Context ) {
1521
-		$placeholders['value'] = \GV\Utils::get( $args, 'value', '' );
1521
+		$placeholders[ 'value' ] = \GV\Utils::get( $args, 'value', '' );
1522 1522
 	} else {
1523 1523
 		// @deprecated path
1524
-		$placeholders['value'] = gv_value( $entry, $field );
1524
+		$placeholders[ 'value' ] = gv_value( $entry, $field );
1525 1525
 	}
1526 1526
 
1527 1527
 	// If the value is empty and we're hiding empty, return empty.
1528
-	if ( $placeholders['value'] === '' && ! empty( $args['hide_empty'] ) ) {
1528
+	if ( $placeholders[ 'value' ] === '' && ! empty( $args[ 'hide_empty' ] ) ) {
1529 1529
 		return '';
1530 1530
 	}
1531 1531
 
1532
-	if ( $placeholders['value'] !== '' && ! empty( $args['wpautop'] ) ) {
1533
-		$placeholders['value'] = wpautop( $placeholders['value'] );
1532
+	if ( $placeholders[ 'value' ] !== '' && ! empty( $args[ 'wpautop' ] ) ) {
1533
+		$placeholders[ 'value' ] = wpautop( $placeholders[ 'value' ] );
1534 1534
 	}
1535 1535
 
1536 1536
 	// Get width setting, if exists
1537
-	$placeholders['width'] = GravityView_API::field_width( $field );
1537
+	$placeholders[ 'width' ] = GravityView_API::field_width( $field );
1538 1538
 
1539 1539
 	// If replacing with CSS inline formatting, let's do it.
1540
-	$placeholders['width:style'] = (string) GravityView_API::field_width( $field, 'width:' . $placeholders['width'] . '%;' );
1540
+	$placeholders[ 'width:style' ] = (string)GravityView_API::field_width( $field, 'width:' . $placeholders[ 'width' ] . '%;' );
1541 1541
 
1542 1542
 	// Grab the Class using `gv_class`
1543
-	$placeholders['class'] = gv_class( $field, $form, $entry );
1544
-	$placeholders['field_id'] = GravityView_API::field_html_attr_id( $field, $form, $entry );
1543
+	$placeholders[ 'class' ] = gv_class( $field, $form, $entry );
1544
+	$placeholders[ 'field_id' ] = GravityView_API::field_html_attr_id( $field, $form, $entry );
1545 1545
 
1546 1546
 	if ( $context instanceof \GV\Template_Context ) {
1547
-		$placeholders['label_value'] = \GV\Utils::get( $args, 'label', '' );
1547
+		$placeholders[ 'label_value' ] = \GV\Utils::get( $args, 'label', '' );
1548 1548
 	} else {
1549 1549
 		// Default Label value
1550
-		$placeholders['label_value'] = gv_label( $field, $entry );
1550
+		$placeholders[ 'label_value' ] = gv_label( $field, $entry );
1551 1551
 	}
1552 1552
 
1553
-	$placeholders['label_value:data-label'] = trim( esc_attr( strip_tags( str_replace( '>&nbsp;', '>', $placeholders['label_value'] ) ) ) );
1554
-	$placeholders['label_value:esc_attr'] = esc_attr( $placeholders['label_value'] );
1553
+	$placeholders[ 'label_value:data-label' ] = trim( esc_attr( strip_tags( str_replace( '>&nbsp;', '>', $placeholders[ 'label_value' ] ) ) ) );
1554
+	$placeholders[ 'label_value:esc_attr' ] = esc_attr( $placeholders[ 'label_value' ] );
1555 1555
 
1556
-	if ( empty( $placeholders['label'] ) && ! empty( $placeholders['label_value'] ) ){
1557
-		$placeholders['label'] = '<span class="gv-field-label">{{ label_value }}</span>';
1556
+	if ( empty( $placeholders[ 'label' ] ) && ! empty( $placeholders[ 'label_value' ] ) ) {
1557
+		$placeholders[ 'label' ] = '<span class="gv-field-label">{{ label_value }}</span>';
1558 1558
 	}
1559 1559
 
1560 1560
 	/**
@@ -1565,7 +1565,7 @@  discard block
 block discarded – undo
1565 1565
 	 * @since 2.0
1566 1566
 	 * @param \GV\Template_Context $context The context.
1567 1567
 	 */
1568
-	$html = apply_filters( 'gravityview/field_output/pre_html', $args['markup'], $args, $context );
1568
+	$html = apply_filters( 'gravityview/field_output/pre_html', $args[ 'markup' ], $args, $context );
1569 1569
 
1570 1570
 	/**
1571 1571
 	 * @filter `gravityview/field_output/open_tag` Modify the opening tags for the template content placeholders
@@ -1592,7 +1592,7 @@  discard block
 block discarded – undo
1592 1592
 	foreach ( $placeholders as $tag => $value ) {
1593 1593
 
1594 1594
 		// If the tag doesn't exist just skip it
1595
-		if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ){
1595
+		if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ) {
1596 1596
 			continue;
1597 1597
 		}
1598 1598
 
@@ -1613,7 +1613,7 @@  discard block
 block discarded – undo
1613 1613
 		$value = apply_filters( 'gravityview/field_output/context/' . $tag, $value, $args, $context );
1614 1614
 
1615 1615
 		// Finally do the replace
1616
-		$html = str_replace( $search, (string) $value, $html );
1616
+		$html = str_replace( $search, (string)$value, $html );
1617 1617
 	}
1618 1618
 
1619 1619
 	/**
Please login to merge, or discard this patch.