Completed
Pull Request — develop (#1303)
by Zack
42:06 queued 25:42
created
future/_mocks.php 1 patch
Spacing   +44 added lines, -47 removed lines patch added patch discarded remove patch
@@ -102,8 +102,7 @@  discard block
 block discarded – undo
102 102
 			$entries = $view->get_entries( gravityview()->request );
103 103
 		}
104 104
 
105
-		$page = \GV\Utils::get( $parameters['paging'], 'current_page' ) ?
106
-			: ( ( ( $parameters['paging']['offset'] - $view->settings->get( 'offset' ) ) / $parameters['paging']['page_size'] ) + 1 );
105
+		$page = \GV\Utils::get( $parameters[ 'paging' ], 'current_page' ) ?: ( ( ( $parameters[ 'paging' ][ 'offset' ] - $view->settings->get( 'offset' ) ) / $parameters[ 'paging' ][ 'page_size' ] ) + 1 );
107 106
 
108 107
 		/** Set paging, count and unwrap the entries. */
109 108
 		$paging = array(
@@ -142,17 +141,17 @@  discard block
 block discarded – undo
142 141
  * @return null|string The value of a field in an entry.
143 142
  */
144 143
 function GravityView_API_field_value( $entry, $field_settings, $format ) {
145
-	if ( empty( $entry['form_id'] ) || empty( $field_settings['id'] ) ) {
144
+	if ( empty( $entry[ 'form_id' ] ) || empty( $field_settings[ 'id' ] ) ) {
146 145
 		gravityview()->log->error( 'No entry or field_settings[id] supplied', array( 'data' => array( func_get_args() ) ) );
147 146
 		return null;
148 147
 	}
149 148
 
150
-	if ( ! empty( $entry['_multi'] ) && ! empty( $field_settings['form_id'] ) && ! empty( $entry['_multi'][ $field_settings['form_id'] ] ) ) {
151
-		$multientry = \GV\Multi_Entry::from_entries( array_map( '\GV\GF_Entry::from_entry', $entry['_multi'] ) );
152
-		$entry = $entry['_multi'][ $field_settings['form_id'] ];
149
+	if ( ! empty( $entry[ '_multi' ] ) && ! empty( $field_settings[ 'form_id' ] ) && ! empty( $entry[ '_multi' ][ $field_settings[ 'form_id' ] ] ) ) {
150
+		$multientry = \GV\Multi_Entry::from_entries( array_map( '\GV\GF_Entry::from_entry', $entry[ '_multi' ] ) );
151
+		$entry = $entry[ '_multi' ][ $field_settings[ 'form_id' ] ];
153 152
 	}
154 153
 
155
-	if ( empty( $entry['id'] ) || ! $entry = \GV\GF_Entry::by_id( $entry['id'] ) ) {
154
+	if ( empty( $entry[ 'id' ] ) || ! $entry = \GV\GF_Entry::by_id( $entry[ 'id' ] ) ) {
156 155
 		gravityview()->log->error( 'Invalid \GV\GF_Entry supplied', array( 'data' => $entry ) );
157 156
 		return null;
158 157
 	}
@@ -162,18 +161,18 @@  discard block
 block discarded – undo
162 161
 	 *
163 162
 	 * Fields with a numeric ID are Gravity Forms ones.
164 163
 	 */
165
-	$source = is_numeric( $field_settings['id'] ) ? \GV\Source::BACKEND_GRAVITYFORMS : \GV\Source::BACKEND_INTERNAL;;
164
+	$source = is_numeric( $field_settings[ 'id' ] ) ? \GV\Source::BACKEND_GRAVITYFORMS : \GV\Source::BACKEND_INTERNAL; ;
166 165
 
167 166
 	/** Initialize the future field. */
168 167
 	switch ( $source ):
169 168
 		/** The Gravity Forms backend. */
170 169
 		case \GV\Source::BACKEND_GRAVITYFORMS:
171
-			if ( ! $form = \GV\GF_Form::by_id( $entry['form_id'] ) ) {
170
+			if ( ! $form = \GV\GF_Form::by_id( $entry[ 'form_id' ] ) ) {
172 171
 				gravityview()->log->error( 'No form Gravity Form found for entry', array( 'data' => $entry ) );
173 172
 				return null;
174 173
 			}
175 174
 
176
-			if ( ! $field = $form::get_field( $form, $field_settings['id'] ) ) {
175
+			if ( ! $field = $form::get_field( $form, $field_settings[ 'id' ] ) ) {
177 176
 				return null;
178 177
 			}
179 178
 
@@ -181,7 +180,7 @@  discard block
 block discarded – undo
181 180
 
182 181
 		/** Our internal backend. */
183 182
 		case \GV\Source::BACKEND_INTERNAL:
184
-			if ( ! $field = \GV\Internal_Source::get_field( $field_settings['id'] ) ) {
183
+			if ( ! $field = \GV\Internal_Source::get_field( $field_settings[ 'id' ] ) ) {
185 184
 				return null;
186 185
 			}
187 186
 
@@ -215,13 +214,13 @@  discard block
 block discarded – undo
215 214
 
216 215
 	/** A bail condition. */
217 216
 	$bail = function( $label, $field_settings, $entry, $force_show_label, $form ) {
218
-		if ( ! empty( $field_settings['show_label'] ) || $force_show_label ) {
217
+		if ( ! empty( $field_settings[ 'show_label' ] ) || $force_show_label ) {
219 218
 
220
-			$label = isset( $field_settings['label'] ) ? $field_settings['label'] : '';
219
+			$label = isset( $field_settings[ 'label' ] ) ? $field_settings[ 'label' ] : '';
221 220
 
222 221
 			// Use Gravity Forms label by default, but if a custom label is defined in GV, use it.
223
-			if ( ! empty( $field_settings['custom_label'] ) ) {
224
-				$label = \GravityView_API::replace_variables( $field_settings['custom_label'], $form, $entry );
222
+			if ( ! empty( $field_settings[ 'custom_label' ] ) ) {
223
+				$label = \GravityView_API::replace_variables( $field_settings[ 'custom_label' ], $form, $entry );
225 224
 			}
226 225
 
227 226
 			/**
@@ -247,19 +246,19 @@  discard block
 block discarded – undo
247 246
 
248 247
 	$label = '';
249 248
 
250
-	if ( ! empty( $entry['_multi'] ) && ! empty( $field_settings['form_id'] ) && ! empty( $entry['_multi'][ $field_settings['form_id'] ] ) ) {
251
-		$entry = $entry['_multi'][ $field_settings['form_id'] ];
252
-		if ( $_form = \GV\GF_Form::by_id( $field_settings['form_id'] ) ) {
249
+	if ( ! empty( $entry[ '_multi' ] ) && ! empty( $field_settings[ 'form_id' ] ) && ! empty( $entry[ '_multi' ][ $field_settings[ 'form_id' ] ] ) ) {
250
+		$entry = $entry[ '_multi' ][ $field_settings[ 'form_id' ] ];
251
+		if ( $_form = \GV\GF_Form::by_id( $field_settings[ 'form_id' ] ) ) {
253 252
 			$form = $_form->form;
254 253
 		}
255 254
 	}
256 255
 
257
-	if ( empty( $entry['form_id'] ) || empty( $field_settings['id'] ) ) {
256
+	if ( empty( $entry[ 'form_id' ] ) || empty( $field_settings[ 'id' ] ) ) {
258 257
 		gravityview()->log->error( 'No entry or field_settings[id] supplied', array( 'data' => array( func_get_args() ) ) );
259 258
 		return $bail( $label, $field_settings, $entry, $force_show_label, $form );
260 259
 	}
261 260
 
262
-	if ( empty( $entry['id'] ) || ! $gv_entry = \GV\GF_Entry::by_id( $entry['id'] ) ) {
261
+	if ( empty( $entry[ 'id' ] ) || ! $gv_entry = \GV\GF_Entry::by_id( $entry[ 'id' ] ) ) {
263 262
 		gravityview()->log->error( 'Invalid \GV\GF_Entry supplied', array( 'data' => $entry ) );
264 263
 		return $bail( $label, $field_settings, $entry, $force_show_label, $form );
265 264
 	}
@@ -271,31 +270,31 @@  discard block
 block discarded – undo
271 270
 	 *
272 271
 	 * Fields with a numeric ID are Gravity Forms ones.
273 272
 	 */
274
-	$source = is_numeric( $field_settings['id'] ) ? \GV\Source::BACKEND_GRAVITYFORMS : \GV\Source::BACKEND_INTERNAL;
273
+	$source = is_numeric( $field_settings[ 'id' ] ) ? \GV\Source::BACKEND_GRAVITYFORMS : \GV\Source::BACKEND_INTERNAL;
275 274
 
276 275
 	/** Initialize the future field. */
277 276
 	switch ( $source ):
278 277
 		/** The Gravity Forms backend. */
279 278
 		case \GV\Source::BACKEND_GRAVITYFORMS:
280
-			if ( ! $gf_form = \GV\GF_Form::by_id( $entry['form_id'] ) ) {
279
+			if ( ! $gf_form = \GV\GF_Form::by_id( $entry[ 'form_id' ] ) ) {
281 280
 				gravityview()->log->error( 'No form Gravity Form found for entry', array( 'data' => $entry ) );
282 281
 				return $bail( $label, $field_settings, $entry->as_entry(), $force_show_label, $form );
283 282
 			}
284 283
 
285
-			if ( ! $field = $gf_form::get_field( $gf_form, $field_settings['id'] ) ) {
286
-				gravityview()->log->error( 'No field found for specified form and field ID #{field_id}', array( 'field_id' => $field_settings['id'], 'data' => $form ) );
284
+			if ( ! $field = $gf_form::get_field( $gf_form, $field_settings[ 'id' ] ) ) {
285
+				gravityview()->log->error( 'No field found for specified form and field ID #{field_id}', array( 'field_id' => $field_settings[ 'id' ], 'data' => $form ) );
287 286
 				return $bail( $label, $field_settings, $entry->as_entry(), $force_show_label, $gf_form->form );
288 287
 			}
289
-			if ( empty( $field_settings['show_label'] ) ) {
288
+			if ( empty( $field_settings[ 'show_label' ] ) ) {
290 289
 				/** The label never wins... */
291
-				$field_settings['label'] = '';
290
+				$field_settings[ 'label' ] = '';
292 291
 			}
293 292
 
294 293
 			break;
295 294
 
296 295
 		/** Our internal backend. */
297 296
 		case \GV\Source::BACKEND_INTERNAL:
298
-			if ( ! $field = \GV\Internal_Source::get_field( $field_settings['id'] ) ) {
297
+			if ( ! $field = \GV\Internal_Source::get_field( $field_settings[ 'id' ] ) ) {
299 298
 				return $bail( $label, $field_settings, $entry->as_entry(), $force_show_label, $form );
300 299
 			}
301 300
 			break;
@@ -307,8 +306,8 @@  discard block
 block discarded – undo
307 306
 			break;
308 307
 	endswitch;
309 308
 
310
-	if( $force_show_label ) {
311
-		$field_settings['show_label'] = '1';
309
+	if ( $force_show_label ) {
310
+		$field_settings[ 'show_label' ] = '1';
312 311
 	}
313 312
 
314 313
 	/** Add the field settings. */
@@ -443,7 +442,7 @@  discard block
 block discarded – undo
443 442
 			'\GravityView_frontend::entry' => \GravityView_frontend::getInstance()->getEntry(),
444 443
 			'\GravityView_View::_current_entry' => \GravityView_View::getInstance()->getCurrentEntry(),
445 444
 			'\GravityView_View::fields' => \GravityView_View::getInstance()->getFields(),
446
-			'wp_actions[loop_start]' => empty( $wp_actions['loop_start'] ) ? 0 : $wp_actions['loop_start'],
445
+			'wp_actions[loop_start]' => empty( $wp_actions[ 'loop_start' ] ) ? 0 : $wp_actions[ 'loop_start' ],
447 446
 			'wp_query::in_the_loop' => $wp_query->in_the_loop,
448 447
 		);
449 448
 	}
@@ -531,7 +530,7 @@  discard block
 block discarded – undo
531 530
 					break;
532 531
 				case 'wp_actions[loop_start]':
533 532
 					global $wp_actions;
534
-					$wp_actions['loop_start'] = $value;
533
+					$wp_actions[ 'loop_start' ] = $value;
535 534
 					break;
536 535
 				case 'wp_query::in_the_loop':
537 536
 					global $wp_query;
@@ -627,9 +626,7 @@  discard block
 block discarded – undo
627 626
 				case 'request':
628 627
 					self::thaw( array(
629 628
 						'\GravityView_View::context' => (
630
-							$value->is_entry() ? 'single' :
631
-							( $value->is_edit_entry() ? 'edit' :
632
-									( $value->is_view() ? 'directory': null )
629
+							$value->is_entry() ? 'single' : ( $value->is_edit_entry() ? 'edit' : ( $value->is_view() ? 'directory' : null )
633 630
 								)
634 631
 						),
635 632
 						'\GravityView_frontend::is_search' => $value->is_search(),
@@ -683,14 +680,14 @@  discard block
 block discarded – undo
683 680
 		global $wp_query, $wp_actions;
684 681
 
685 682
 		$wp_query->in_the_loop = false;
686
-		$wp_actions['loop_start'] = 0;
683
+		$wp_actions[ 'loop_start' ] = 0;
687 684
 	}
688 685
 }
689 686
 
690 687
 
691 688
 /** Add some global fix for field capability discrepancies. */
692 689
 add_filter( 'gravityview/configuration/fields', function( $fields ) {
693
-	if ( empty( $fields  ) ) {
690
+	if ( empty( $fields ) ) {
694 691
 		return $fields;
695 692
 	}
696 693
 
@@ -717,11 +714,11 @@  discard block
 block discarded – undo
717 714
 		}
718 715
 
719 716
 		foreach ( $_fields as $uid => &$_field ) {
720
-			if ( ! isset( $_field['only_loggedin'] ) ) {
717
+			if ( ! isset( $_field[ 'only_loggedin' ] ) ) {
721 718
 				continue;
722 719
 			}
723 720
 			/** If we do not require login, we don't require a cap. */
724
-			$_field['only_loggedin'] != '1' && ( $_field['only_loggedin_cap'] = '' );
721
+			$_field[ 'only_loggedin' ] != '1' && ( $_field[ 'only_loggedin_cap' ] = '' );
725 722
 		}
726 723
 	}
727 724
 	return $fields;
@@ -752,8 +749,8 @@  discard block
 block discarded – undo
752 749
 		}
753 750
 
754 751
 		foreach ( $_fields as $uid => &$_field ) {
755
-			if ( ! empty( $_field['id'] ) && is_numeric( $_field['id'] ) && empty( $_field['form_id'] ) ) {
756
-				$_field['form_id'] = $view->form->ID;
752
+			if ( ! empty( $_field[ 'id' ] ) && is_numeric( $_field[ 'id' ] ) && empty( $_field[ 'form_id' ] ) ) {
753
+				$_field[ 'form_id' ] = $view->form->ID;
757 754
 			}
758 755
 		}
759 756
 	}
@@ -767,25 +764,25 @@  discard block
 block discarded – undo
767 764
 	if ( class_exists( '\GravityView_frontend' ) ) {
768 765
 		global $wp_filter;
769 766
 
770
-		if ( empty( $wp_filter['gravityview_after'] ) ) {
767
+		if ( empty( $wp_filter[ 'gravityview_after' ] ) ) {
771 768
 			return;
772 769
 		}
773 770
 
774 771
 		/** WordPress 4.6 and lower compatibility, when WP_Hook classes were still absent. */
775
-		if ( is_array( $wp_filter['gravityview_after'] ) ) {
776
-			if ( ! empty( $wp_filter['gravityview_after'][10] ) ) {
777
-				foreach ( $wp_filter['gravityview_after'][10] as $function_key => $callback ) {
772
+		if ( is_array( $wp_filter[ 'gravityview_after' ] ) ) {
773
+			if ( ! empty( $wp_filter[ 'gravityview_after' ][ 10 ] ) ) {
774
+				foreach ( $wp_filter[ 'gravityview_after' ][ 10 ] as $function_key => $callback ) {
778 775
 					if ( strpos( $function_key, 'context_not_configured_warning' ) ) {
779
-						unset( $wp_filter['gravityview_after'][10][ $function_key ] );
776
+						unset( $wp_filter[ 'gravityview_after' ][ 10 ][ $function_key ] );
780 777
 					}
781 778
 				}
782 779
 			}
783 780
 			return;
784 781
 		}
785 782
 
786
-		foreach ( $wp_filter['gravityview_after']->callbacks[10] as $function_key => $callback ) {
783
+		foreach ( $wp_filter[ 'gravityview_after' ]->callbacks[ 10 ] as $function_key => $callback ) {
787 784
 			if ( strpos( $function_key, 'context_not_configured_warning' ) ) {
788
-				unset( $wp_filter['gravityview_after']->callbacks[10][ $function_key ] );
785
+				unset( $wp_filter[ 'gravityview_after' ]->callbacks[ 10 ][ $function_key ] );
789 786
 			}
790 787
 		}
791 788
 	}
Please login to merge, or discard this patch.
includes/class-api.php 1 patch
Spacing   +107 added lines, -107 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
 		}
@@ -403,9 +403,9 @@  discard block
 block discarded – undo
403 403
 
404 404
 		// If we've saved the permalink in memory, use it
405 405
 		// @since 1.3
406
-		$link = wp_cache_get( 'gv_directory_link_'.$post_id );
406
+		$link = wp_cache_get( 'gv_directory_link_' . $post_id );
407 407
 
408
-		if ( (int) $post_id === (int) get_option( 'page_on_front' ) ) {
408
+		if ( (int)$post_id === (int)get_option( 'page_on_front' ) ) {
409 409
 			$link = home_url();
410 410
 		}
411 411
 
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
 
415 415
 			// If not yet saved, cache the permalink.
416 416
 			// @since 1.3
417
-			wp_cache_set( 'gv_directory_link_'.$post_id, $link );
417
+			wp_cache_set( 'gv_directory_link_' . $post_id, $link );
418 418
 		}
419 419
 
420 420
 		// Deal with returning to proper pagination for embedded views
@@ -422,13 +422,13 @@  discard block
 block discarded – undo
422 422
 
423 423
 			$args = array();
424 424
 
425
-			if( $pagenum = \GV\Utils::_GET( 'pagenum' ) ) {
426
-				$args['pagenum'] = intval( $pagenum );
425
+			if ( $pagenum = \GV\Utils::_GET( 'pagenum' ) ) {
426
+				$args[ 'pagenum' ] = intval( $pagenum );
427 427
 			}
428 428
 
429
-			if( $sort = \GV\Utils::_GET( 'sort' ) ) {
430
-				$args['sort'] = $sort;
431
-				$args['dir'] = \GV\Utils::_GET( 'dir' );
429
+			if ( $sort = \GV\Utils::_GET( 'sort' ) ) {
430
+				$args[ 'sort' ] = $sort;
431
+				$args[ 'dir' ] = \GV\Utils::_GET( 'dir' );
432 432
 			}
433 433
 
434 434
 			$link = add_query_arg( $args, $link );
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 	private static function get_custom_entry_slug( $id, $entry = array() ) {
466 466
 
467 467
 		// Generate an unique hash to use as the default value
468
-		$slug = substr( wp_hash( $id, 'gravityview'.$id ), 0, 8 );
468
+		$slug = substr( wp_hash( $id, 'gravityview' . $id ), 0, 8 );
469 469
 
470 470
 		/**
471 471
 		 * @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}`
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
 		$slug = apply_filters( 'gravityview_entry_slug', $slug, $id, $entry );
477 477
 
478 478
 		// Make sure we have something - use the original ID as backup.
479
-		if( empty( $slug ) ) {
479
+		if ( empty( $slug ) ) {
480 480
 			$slug = $id;
481 481
 		}
482 482
 
@@ -570,15 +570,15 @@  discard block
 block discarded – undo
570 570
          * @param boolean $custom Should we process the custom entry slug?
571 571
          */
572 572
         $custom = apply_filters( 'gravityview_custom_entry_slug', false );
573
-        if( $custom ) {
573
+        if ( $custom ) {
574 574
             // create the gravityview_unique_id and save it
575 575
 
576 576
             // Get the entry hash
577
-            $hash = self::get_custom_entry_slug( $entry['id'], $entry );
577
+            $hash = self::get_custom_entry_slug( $entry[ 'id' ], $entry );
578 578
 
579
-	        gravityview()->log->debug( 'Setting hash for entry {entry_id}: {hash}', array( 'entry_id' => $entry['id'], 'hash' => $hash ) );
579
+	        gravityview()->log->debug( 'Setting hash for entry {entry_id}: {hash}', array( 'entry_id' => $entry[ 'id' ], 'hash' => $hash ) );
580 580
 
581
-            gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash, \GV\Utils::get( $entry, 'form_id' ) );
581
+            gform_update_meta( $entry[ 'id' ], 'gravityview_unique_id', $hash, \GV\Utils::get( $entry, 'form_id' ) );
582 582
 
583 583
         }
584 584
     }
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
 
598 598
 		if ( ! empty( $entry ) && ! is_array( $entry ) ) {
599 599
 			$entry = GVCommon::get_entry( $entry );
600
-		} else if( empty( $entry ) ) {
600
+		} else if ( empty( $entry ) ) {
601 601
 			// @deprecated path
602 602
 			$entry = GravityView_frontend::getInstance()->getEntry();
603 603
 		}
@@ -617,18 +617,18 @@  discard block
 block discarded – undo
617 617
 
618 618
 		$query_arg_name = \GV\Entry::get_endpoint_name();
619 619
 
620
-		if ( ! empty( $entry['_multi'] ) ) {
620
+		if ( ! empty( $entry[ '_multi' ] ) ) {
621 621
 			$entry_slugs = array();
622
-			foreach ( $entry['_multi'] as $_multi ) {
623
-				$entry_slugs[] = self::get_entry_slug( $_multi['id'], $_multi );
624
-				$forms[] = $_multi['form_id'];
622
+			foreach ( $entry[ '_multi' ] as $_multi ) {
623
+				$entry_slugs[ ] = self::get_entry_slug( $_multi[ 'id' ], $_multi );
624
+				$forms[ ] = $_multi[ 'form_id' ];
625 625
 			}
626 626
 			$entry_slug = implode( ',', $entry_slugs );
627 627
 		} else {
628
-			$entry_slug = self::get_entry_slug( $entry['id'], $entry );
628
+			$entry_slug = self::get_entry_slug( $entry[ 'id' ], $entry );
629 629
 		}
630 630
 
631
-		if ( get_option('permalink_structure') && !is_preview() ) {
631
+		if ( get_option( 'permalink_structure' ) && ! is_preview() ) {
632 632
 
633 633
 			$args = array();
634 634
 
@@ -638,9 +638,9 @@  discard block
 block discarded – undo
638 638
 			 */
639 639
 			$link_parts = explode( '?', $directory_link );
640 640
 
641
-			$query = !empty( $link_parts[1] ) ? '?'.$link_parts[1] : '';
641
+			$query = ! empty( $link_parts[ 1 ] ) ? '?' . $link_parts[ 1 ] : '';
642 642
 
643
-			$directory_link = trailingslashit( $link_parts[0] ) . $query_arg_name . '/'. $entry_slug .'/' . $query;
643
+			$directory_link = trailingslashit( $link_parts[ 0 ] ) . $query_arg_name . '/' . $entry_slug . '/' . $query;
644 644
 
645 645
 		} else {
646 646
 
@@ -652,21 +652,21 @@  discard block
 block discarded – undo
652 652
 		 */
653 653
 		if ( $add_directory_args ) {
654 654
 
655
-			if ( ! empty( $_GET['pagenum'] ) ) {
656
-				$args['pagenum'] = intval( $_GET['pagenum'] );
655
+			if ( ! empty( $_GET[ 'pagenum' ] ) ) {
656
+				$args[ 'pagenum' ] = intval( $_GET[ 'pagenum' ] );
657 657
 			}
658 658
 
659 659
 			/**
660 660
 			 * @since 1.7
661 661
 			 */
662 662
 			if ( $sort = \GV\Utils::_GET( 'sort' ) ) {
663
-				$args['sort'] = $sort;
664
-				$args['dir'] = \GV\Utils::_GET( 'dir' );
663
+				$args[ 'sort' ] = $sort;
664
+				$args[ 'dir' ] = \GV\Utils::_GET( 'dir' );
665 665
 			}
666 666
 
667 667
 		}
668 668
 
669
-		if( $post_id ) {
669
+		if ( $post_id ) {
670 670
 			$passed_post = get_post( $post_id );
671 671
 			$views       = \GV\View_Collection::from_post( $passed_post );
672 672
 			$has_multiple_views = $views->count() > 1;
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
 		}
676 676
 
677 677
 		if ( $has_multiple_views ) {
678
-			$args['gvid'] = gravityview_get_view_id();
678
+			$args[ 'gvid' ] = gravityview_get_view_id();
679 679
 		}
680 680
 
681 681
 		return add_query_arg( $args, $directory_link );
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
 }
697 697
 
698 698
 function gv_class( $field, $form = NULL, $entry = array() ) {
699
-	return GravityView_API::field_class( $field, $form, $entry  );
699
+	return GravityView_API::field_class( $field, $form, $entry );
700 700
 }
701 701
 
702 702
 /**
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
 		$view_id = 0;
720 720
 		if ( $context->view ) {
721 721
 			$view_id = $context->view->ID;
722
-			if( $context->view->settings->get( 'hide_until_searched' ) ) {
722
+			if ( $context->view->settings->get( 'hide_until_searched' ) ) {
723 723
 				$hide_until_searched = ( empty( $context->entry ) && ! $context->request->is_search() );
724 724
 			}
725 725
 		}
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
 		$default_css_class .= ' gv-container-no-results';
748 748
 	}
749 749
 
750
-	$css_class = trim( $passed_css_class . ' '. $default_css_class );
750
+	$css_class = trim( $passed_css_class . ' ' . $default_css_class );
751 751
 
752 752
 	/**
753 753
 	 * @filter `gravityview/render/container/class` Modify the CSS class to be added to the wrapper <div> of a View
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
 
775 775
 	$value = GravityView_API::field_value( $entry, $field );
776 776
 
777
-	if( $value === '' ) {
777
+	if ( $value === '' ) {
778 778
 		/**
779 779
 		 * @filter `gravityview_empty_value` What to display when a field is empty
780 780
 		 * @param string $value (empty string)
@@ -887,7 +887,7 @@  discard block
 block discarded – undo
887 887
  */
888 888
 function gravityview_get_field_value( $entry, $field_id, $display_value ) {
889 889
 
890
-	if( floatval( $field_id ) === floor( floatval( $field_id ) ) ) {
890
+	if ( floatval( $field_id ) === floor( floatval( $field_id ) ) ) {
891 891
 
892 892
 		// For the complete field value as generated by Gravity Forms
893 893
 		return $display_value;
@@ -921,16 +921,16 @@  discard block
 block discarded – undo
921 921
 		$terms = explode( ', ', $value );
922 922
 	}
923 923
 
924
-	foreach ($terms as $term_name ) {
924
+	foreach ( $terms as $term_name ) {
925 925
 
926 926
 		// If we're processing a category,
927
-		if( $taxonomy === 'category' ) {
927
+		if ( $taxonomy === 'category' ) {
928 928
 
929 929
 			// Use rgexplode to prevent errors if : doesn't exist
930 930
 			list( $term_name, $term_id ) = rgexplode( ':', $term_name, 2 );
931 931
 
932 932
 			// The explode was succesful; we have the category ID
933
-			if( !empty( $term_id )) {
933
+			if ( ! empty( $term_id ) ) {
934 934
 				$term = get_term_by( 'id', $term_id, $taxonomy );
935 935
 			} else {
936 936
 			// We have to fall back to the name
@@ -943,7 +943,7 @@  discard block
 block discarded – undo
943 943
 		}
944 944
 
945 945
 		// There's still a tag/category here.
946
-		if( $term ) {
946
+		if ( $term ) {
947 947
 
948 948
 			$term_link = get_term_link( $term, $taxonomy );
949 949
 
@@ -952,11 +952,11 @@  discard block
 block discarded – undo
952 952
 			    continue;
953 953
 			}
954 954
 
955
-			$output[] = gravityview_get_link( $term_link, esc_html( $term->name ) );
955
+			$output[ ] = gravityview_get_link( $term_link, esc_html( $term->name ) );
956 956
 		}
957 957
 	}
958 958
 
959
-	return implode(', ', $output );
959
+	return implode( ', ', $output );
960 960
 }
961 961
 
962 962
 /**
@@ -970,8 +970,8 @@  discard block
 block discarded – undo
970 970
 
971 971
 	$output = get_the_term_list( $post_id, $taxonomy, NULL, ', ' );
972 972
 
973
-	if( empty( $link ) ) {
974
-		return strip_tags( $output);
973
+	if ( empty( $link ) ) {
974
+		return strip_tags( $output );
975 975
 	}
976 976
 
977 977
 	return $output;
@@ -990,7 +990,7 @@  discard block
 block discarded – undo
990 990
 	$fe = GravityView_frontend::getInstance();
991 991
 
992 992
 	// Solve problem when loading content via admin-ajax.php
993
-	if( ! $fe->getGvOutputData() ) {
993
+	if ( ! $fe->getGvOutputData() ) {
994 994
 
995 995
 		gravityview()->log->debug( 'gv_output_data not defined; parsing content.' );
996 996
 
@@ -998,7 +998,7 @@  discard block
 block discarded – undo
998 998
 	}
999 999
 
1000 1000
 	// Make 100% sure that we're dealing with a properly called situation
1001
-	if( !is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) {
1001
+	if ( ! is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) {
1002 1002
 
1003 1003
 		gravityview()->log->debug( 'gv_output_data not an object or get_view not callable.', array( 'data' => $fe->getGvOutputData() ) );
1004 1004
 
@@ -1220,12 +1220,12 @@  discard block
 block discarded – undo
1220 1220
 function gravityview_get_files_array( $value, $gv_class = '', $context = null ) {
1221 1221
 	/** @define "GRAVITYVIEW_DIR" "../" */
1222 1222
 
1223
-	if( !class_exists( 'GravityView_Field' ) ) {
1224
-		include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field.php' );
1223
+	if ( ! class_exists( 'GravityView_Field' ) ) {
1224
+		include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field.php' );
1225 1225
 	}
1226 1226
 
1227
-	if( !class_exists( 'GravityView_Field_FileUpload' ) ) {
1228
-		include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field-fileupload.php' );
1227
+	if ( ! class_exists( 'GravityView_Field_FileUpload' ) ) {
1228
+		include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field-fileupload.php' );
1229 1229
 	}
1230 1230
 
1231 1231
 	if ( is_null( $context ) ) {
@@ -1328,21 +1328,21 @@  discard block
 block discarded – undo
1328 1328
 	} else {
1329 1329
 		// @deprecated path
1330 1330
 		// Required fields.
1331
-		if ( empty( $args['field'] ) || empty( $args['form'] ) ) {
1331
+		if ( empty( $args[ 'field' ] ) || empty( $args[ 'form' ] ) ) {
1332 1332
 			gravityview()->log->error( 'Field or form are empty.', array( 'data' => $args ) );
1333 1333
 			return '';
1334 1334
 		}
1335 1335
 	}
1336 1336
 
1337 1337
 	if ( $context instanceof \GV\Template_Context ) {
1338
-		$entry = $args['entry'] ? : ( $context->entry ? $context->entry->as_entry() : array() );
1339
-		$field = $args['field'] ? : ( $context->field ? $context->field->as_configuration() : array() );
1340
-		$form = $args['form'] ? : ( $context->view->form ? $context->view->form->form : array() );
1338
+		$entry = $args[ 'entry' ] ?: ( $context->entry ? $context->entry->as_entry() : array() );
1339
+		$field = $args[ 'field' ] ?: ( $context->field ? $context->field->as_configuration() : array() );
1340
+		$form = $args[ 'form' ] ?: ( $context->view->form ? $context->view->form->form : array() );
1341 1341
 	} else {
1342 1342
 		// @deprecated path
1343
-		$entry = empty( $args['entry'] ) ? array() : $args['entry'];
1344
-		$field = $args['field'];
1345
-		$form = $args['form'];
1343
+		$entry = empty( $args[ 'entry' ] ) ? array() : $args[ 'entry' ];
1344
+		$field = $args[ 'field' ];
1345
+		$form = $args[ 'form' ];
1346 1346
 	}
1347 1347
 
1348 1348
 	/**
@@ -1362,43 +1362,43 @@  discard block
 block discarded – undo
1362 1362
 	);
1363 1363
 
1364 1364
 	if ( $context instanceof \GV\Template_Context ) {
1365
-		$placeholders['value'] = \GV\Utils::get( $args, 'value', '' );
1365
+		$placeholders[ 'value' ] = \GV\Utils::get( $args, 'value', '' );
1366 1366
 	} else {
1367 1367
 		// @deprecated path
1368
-		$placeholders['value'] = gv_value( $entry, $field );
1368
+		$placeholders[ 'value' ] = gv_value( $entry, $field );
1369 1369
 	}
1370 1370
 
1371 1371
 	// If the value is empty and we're hiding empty, return empty.
1372
-	if ( $placeholders['value'] === '' && ! empty( $args['hide_empty'] ) ) {
1372
+	if ( $placeholders[ 'value' ] === '' && ! empty( $args[ 'hide_empty' ] ) ) {
1373 1373
 		return '';
1374 1374
 	}
1375 1375
 
1376
-	if ( $placeholders['value'] !== '' && ! empty( $args['wpautop'] ) ) {
1377
-		$placeholders['value'] = wpautop( $placeholders['value'] );
1376
+	if ( $placeholders[ 'value' ] !== '' && ! empty( $args[ 'wpautop' ] ) ) {
1377
+		$placeholders[ 'value' ] = wpautop( $placeholders[ 'value' ] );
1378 1378
 	}
1379 1379
 
1380 1380
 	// Get width setting, if exists
1381
-	$placeholders['width'] = GravityView_API::field_width( $field );
1381
+	$placeholders[ 'width' ] = GravityView_API::field_width( $field );
1382 1382
 
1383 1383
 	// If replacing with CSS inline formatting, let's do it.
1384
-	$placeholders['width:style'] = GravityView_API::field_width( $field, 'width:' . $placeholders['width'] . '%;' );
1384
+	$placeholders[ 'width:style' ] = GravityView_API::field_width( $field, 'width:' . $placeholders[ 'width' ] . '%;' );
1385 1385
 
1386 1386
 	// Grab the Class using `gv_class`
1387
-	$placeholders['class'] = gv_class( $field, $form, $entry );
1388
-	$placeholders['field_id'] = GravityView_API::field_html_attr_id( $field, $form, $entry );
1387
+	$placeholders[ 'class' ] = gv_class( $field, $form, $entry );
1388
+	$placeholders[ 'field_id' ] = GravityView_API::field_html_attr_id( $field, $form, $entry );
1389 1389
 
1390 1390
 	if ( $context instanceof \GV\Template_Context ) {
1391
-		$placeholders['label_value'] = \GV\Utils::get( $args, 'label' );
1391
+		$placeholders[ 'label_value' ] = \GV\Utils::get( $args, 'label' );
1392 1392
 	} else {
1393 1393
 		// Default Label value
1394
-		$placeholders['label_value'] = gv_label( $field, $entry );
1394
+		$placeholders[ 'label_value' ] = gv_label( $field, $entry );
1395 1395
 	}
1396 1396
 
1397
-	$placeholders['label_value:data-label'] = trim( esc_attr( strip_tags( str_replace( '>&nbsp;', '>', $placeholders['label_value'] ) ) ) );
1398
-	$placeholders['label_value:esc_attr'] = esc_attr( $placeholders['label_value'] );
1397
+	$placeholders[ 'label_value:data-label' ] = trim( esc_attr( strip_tags( str_replace( '>&nbsp;', '>', $placeholders[ 'label_value' ] ) ) ) );
1398
+	$placeholders[ 'label_value:esc_attr' ] = esc_attr( $placeholders[ 'label_value' ] );
1399 1399
 
1400
-	if ( empty( $placeholders['label'] ) && ! empty( $placeholders['label_value'] ) ){
1401
-		$placeholders['label'] = '<span class="gv-field-label">{{ label_value }}</span>';
1400
+	if ( empty( $placeholders[ 'label' ] ) && ! empty( $placeholders[ 'label_value' ] ) ) {
1401
+		$placeholders[ 'label' ] = '<span class="gv-field-label">{{ label_value }}</span>';
1402 1402
 	}
1403 1403
 
1404 1404
 	/**
@@ -1409,7 +1409,7 @@  discard block
 block discarded – undo
1409 1409
 	 * @since 2.0
1410 1410
 	 * @param \GV\Template_Context $context The context.
1411 1411
 	 */
1412
-	$html = apply_filters( 'gravityview/field_output/pre_html', $args['markup'], $args, $context );
1412
+	$html = apply_filters( 'gravityview/field_output/pre_html', $args[ 'markup' ], $args, $context );
1413 1413
 
1414 1414
 	/**
1415 1415
 	 * @filter `gravityview/field_output/open_tag` Modify the opening tags for the template content placeholders
@@ -1436,7 +1436,7 @@  discard block
 block discarded – undo
1436 1436
 	foreach ( $placeholders as $tag => $value ) {
1437 1437
 
1438 1438
 		// If the tag doesn't exist just skip it
1439
-		if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ){
1439
+		if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ) {
1440 1440
 			continue;
1441 1441
 		}
1442 1442
 
Please login to merge, or discard this patch.
future/includes/class-gv-template-entry-table.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	 */
27 27
 	public function the_field( \GV\Field $field ) {
28 28
 		$renderer = new Field_Renderer();
29
-		$source = is_numeric( $field->ID ) ? ( GF_Form::by_id( $field->form_id ) ? : $this->view->form ) : new Internal_Source();
29
+		$source = is_numeric( $field->ID ) ? ( GF_Form::by_id( $field->form_id ) ?: $this->view->form ) : new Internal_Source();
30 30
 
31 31
 		return $renderer->render( $field, $this->view, $source, $this->entry->from_field( $field ), $this->request );
32 32
 	}
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 		foreach ( $fields->all() as $field ) {
64 64
 			$context = Template_Context::from_template( $this, compact( 'field' ) );
65 65
 
66
-			$form = \GV\GF_Form::by_id( $field->form_id ) ? : $this->view->form;
66
+			$form = \GV\GF_Form::by_id( $field->form_id ) ?: $this->view->form;
67 67
 			$entry = $this->entry->from_field( $field );
68 68
 
69 69
 			if ( ! $entry ) {
Please login to merge, or discard this patch.
future/includes/class-gv-request.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	 */
46 46
 	public static function is_add_oembed_preview() {
47 47
 		/** The preview request is a parse-embed AJAX call without a type set. */
48
-		return ( self::is_ajax() && ! empty( $_POST['action'] ) && $_POST['action'] == 'parse-embed' && ! isset( $_POST['type'] ) );
48
+		return ( self::is_ajax() && ! empty( $_POST[ 'action' ] ) && $_POST[ 'action' ] == 'parse-embed' && ! isset( $_POST[ 'type' ] ) );
49 49
 	}
50 50
 
51 51
 	/**
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 * @return boolean
64 64
 	 */
65 65
 	public static function is_rest() {
66
-		return ! empty( $GLOBALS['wp']->query_vars['rest_route'] );
66
+		return ! empty( $GLOBALS[ 'wp' ]->query_vars[ 'rest_route' ] );
67 67
 	}
68 68
 
69 69
 	/**
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 						return false;
126 126
 					}
127 127
 
128
-					if ( ! in_array( $e['form_id'], $valid_forms ) ) {
128
+					if ( ! in_array( $e[ 'form_id' ], $valid_forms ) ) {
129 129
 						return false;
130 130
 					}
131 131
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 				}
142 142
 
143 143
 				$entry = Multi_Entry::from_entries( array_filter( $multientry ) );
144
-			}  else {
144
+			} else {
145 145
 				/**
146 146
 				 * A regular one.
147 147
 				 */
@@ -196,15 +196,15 @@  discard block
 block discarded – undo
196 196
 			$get = $_GET;
197 197
 		}
198 198
 
199
-		unset( $get['mode'] );
199
+		unset( $get[ 'mode' ] );
200 200
 
201 201
 		$get = array_filter( $get, 'gravityview_is_not_empty_string' );
202 202
 
203
-		if( $has_field_key = $this->_has_field_key( $get ) ) {
203
+		if ( $has_field_key = $this->_has_field_key( $get ) ) {
204 204
 			return true;
205 205
 		}
206 206
 
207
-		return isset( $get['gv_search'] ) || isset( $get['gv_start'] ) || isset( $get['gv_end'] ) || isset( $get['gv_by'] ) || isset( $get['gv_id'] );
207
+		return isset( $get[ 'gv_search' ] ) || isset( $get[ 'gv_start' ] ) || isset( $get[ 'gv_end' ] ) || isset( $get[ 'gv_by' ] ) || isset( $get[ 'gv_id' ] );
208 208
 	}
209 209
 
210 210
 	/**
@@ -227,13 +227,13 @@  discard block
 block discarded – undo
227 227
 
228 228
 		$meta = array();
229 229
 		foreach ( $fields as $field ) {
230
-			if( empty( $field->_gf_field_class_name ) ) {
231
-				$meta[] = preg_quote( $field->name );
230
+			if ( empty( $field->_gf_field_class_name ) ) {
231
+				$meta[ ] = preg_quote( $field->name );
232 232
 			}
233 233
 		}
234 234
 
235 235
 		foreach ( $get as $key => $value ) {
236
-			if ( preg_match('/^filter_(([0-9_]+)|'. implode( '|', $meta ) .')$/sm', $key ) ) {
236
+			if ( preg_match( '/^filter_(([0-9_]+)|' . implode( '|', $meta ) . ')$/sm', $key ) ) {
237 237
 				$has_field_key = true;
238 238
 				break;
239 239
 			}
Please login to merge, or discard this patch.
future/includes/class-gv-template-entry-list.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	 * @return string
27 27
 	 */
28 28
 	public function the_field( \GV\Field $field, $extras = null ) {
29
-		$form = \GV\GF_Form::by_id( $field->form_id ) ? : $this->view->form;
29
+		$form = \GV\GF_Form::by_id( $field->form_id ) ?: $this->view->form;
30 30
 		$entry = $this->entry->from_field( $field );
31 31
 
32 32
 		if ( ! $entry ) {
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 		}
35 35
 
36 36
 		$renderer = new Field_Renderer();
37
-		$source = is_numeric( $field->ID ) ? ( GF_Form::by_id( $field->form_id ) ? : $this->view->form ) : new Internal_Source();
37
+		$source = is_numeric( $field->ID ) ? ( GF_Form::by_id( $field->form_id ) ?: $this->view->form ) : new Internal_Source();
38 38
 		
39 39
 		$value = $renderer->render( $field, $this->view, $source, $entry, $this->request );
40 40
 		
@@ -62,13 +62,13 @@  discard block
 block discarded – undo
62 62
 		$hide_empty = apply_filters( 'gravityview/render/hide-empty-zone', Utils::get( $extras, 'hide_empty', $this->view->settings->get( 'hide_empty', false ) ), $context );
63 63
 
64 64
 		if ( is_numeric( $field->ID ) ) {
65
-			$extras['field'] = $field->as_configuration();
65
+			$extras[ 'field' ] = $field->as_configuration();
66 66
 		}
67 67
 
68
-		$extras['entry'] = $this->entry->as_entry();
69
-		$extras['hide_empty'] = $hide_empty;
70
-		$extras['label'] = $label;
71
-		$extras['value'] = $value;
68
+		$extras[ 'entry' ] = $this->entry->as_entry();
69
+		$extras[ 'hide_empty' ] = $hide_empty;
70
+		$extras[ 'label' ] = $label;
71
+		$extras[ 'value' ] = $value;
72 72
 
73 73
 		return \gravityview_field_output( $extras, $context );
74 74
 	}
Please login to merge, or discard this patch.
future/includes/class-gv-template-view-list.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
 	public function the_field( \GV\Field $field, \GV\Entry $entry, $extras = null ) {
30 30
 		$form = $this->view->form;
31 31
 
32
-		if ( isset( $this->view->unions[ $entry['form_id'] ] ) ) {
33
-			if ( isset( $this->view->unions[ $entry['form_id'] ][ $field->ID ] ) ) {
34
-				$field = $this->view->unions[ $entry['form_id'] ][ $field->ID ];
32
+		if ( isset( $this->view->unions[ $entry[ 'form_id' ] ] ) ) {
33
+			if ( isset( $this->view->unions[ $entry[ 'form_id' ] ][ $field->ID ] ) ) {
34
+				$field = $this->view->unions[ $entry[ 'form_id' ] ][ $field->ID ];
35 35
 			} elseif ( ! $field instanceof Internal_Field ) {
36 36
 				$field = Internal_Field::from_configuration( array( 'id' => 'custom' ) );
37 37
 			}
@@ -81,13 +81,13 @@  discard block
 block discarded – undo
81 81
 		$hide_empty = apply_filters( 'gravityview/render/hide-empty-zone', Utils::get( $extras, 'hide_empty', $this->view->settings->get( 'hide_empty', false ) ), $context );
82 82
 
83 83
 		if ( is_numeric( $field->ID ) ) {
84
-			$extras['field'] = $field->as_configuration();
84
+			$extras[ 'field' ] = $field->as_configuration();
85 85
 		}
86 86
 
87
-		$extras['entry'] = $entry->as_entry();
88
-		$extras['hide_empty'] = $hide_empty;
89
-		$extras['label'] = $label;
90
-		$extras['value'] = $value;
87
+		$extras[ 'entry' ] = $entry->as_entry();
88
+		$extras[ 'hide_empty' ] = $hide_empty;
89
+		$extras[ 'label' ] = $label;
90
+		$extras[ 'value' ] = $value;
91 91
 
92 92
 		return \gravityview_field_output( $extras, $context );
93 93
 	}
Please login to merge, or discard this patch.
future/includes/class-gv-plugin.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	/**
90 90
 	 * @var string The REST API functionality identifier.
91 91
 	 */
92
-	const FEATURE_REST  = 'rest_api';
92
+	const FEATURE_REST = 'rest_api';
93 93
 
94 94
 	/**
95 95
 	 * Get the global instance of \GV\Plugin.
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 		include_once $this->dir( 'includes/class-frontend-views.php' );
216 216
 		include_once $this->dir( 'includes/class-gravityview-admin-bar.php' );
217 217
 		include_once $this->dir( 'includes/class-gravityview-entry-list.php' );
218
-		include_once $this->dir( 'includes/class-gravityview-merge-tags.php'); /** @since 1.8.4 */
218
+		include_once $this->dir( 'includes/class-gravityview-merge-tags.php' ); /** @since 1.8.4 */
219 219
 		include_once $this->dir( 'includes/class-data.php' );
220 220
 		include_once $this->dir( 'includes/class-gravityview-shortcode.php' );
221 221
 		include_once $this->dir( 'includes/class-gravityview-entry-link-shortcode.php' );
@@ -269,11 +269,11 @@  discard block
 block discarded – undo
269 269
 
270 270
 		// Pre-4.6 loading
271 271
 		// TODO: Remove when GV minimum version is WordPress 4.6.0
272
-		$locale = apply_filters( 'plugin_locale', ( ( function_exists('get_user_locale') && is_admin() ) ? get_user_locale() : get_locale() ), 'gravityview' );
272
+		$locale = apply_filters( 'plugin_locale', ( ( function_exists( 'get_user_locale' ) && is_admin() ) ? get_user_locale() : get_locale() ), 'gravityview' );
273 273
 
274
-		$loaded = load_textdomain( 'gravityview', sprintf( '%s/%s-%s.mo', $this->dir('languages'), $domain, $locale ) );
274
+		$loaded = load_textdomain( 'gravityview', sprintf( '%s/%s-%s.mo', $this->dir( 'languages' ), $domain, $locale ) );
275 275
 
276
-		if( $loaded ) {
276
+		if ( $loaded ) {
277 277
 			return;
278 278
 		}
279 279
 
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 	 */
425 425
 	public function is_compatible_wordpress( $version = null ) {
426 426
 
427
-		if( ! $version ) {
427
+		if ( ! $version ) {
428 428
 			$version = self::$min_wp_version;
429 429
 		}
430 430
 
@@ -465,8 +465,8 @@  discard block
 block discarded – undo
465 465
 	 * @return string The version of PHP.
466 466
 	 */
467 467
 	private function get_php_version() {
468
-		return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] ) ?
469
-			$GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] : phpversion();
468
+		return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE' ] ) ?
469
+			$GLOBALS[ 'GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE' ] : phpversion();
470 470
 	}
471 471
 
472 472
 	/**
@@ -477,8 +477,8 @@  discard block
 block discarded – undo
477 477
 	 * @return string The version of WordPress.
478 478
 	 */
479 479
 	private function get_wordpress_version() {
480
-		return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] ) ?
481
-			$GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] : $GLOBALS['wp_version'];
480
+		return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE' ] ) ?
481
+			$GLOBALS[ 'GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE' ] : $GLOBALS[ 'wp_version' ];
482 482
 	}
483 483
 
484 484
 	/**
@@ -489,13 +489,13 @@  discard block
 block discarded – undo
489 489
 	 * @return string|null The version of Gravity Forms or null if inactive.
490 490
 	 */
491 491
 	private function get_gravityforms_version() {
492
-		if ( ! class_exists( '\GFCommon' ) || ! empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE'] ) ) {
492
+		if ( ! class_exists( '\GFCommon' ) || ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE' ] ) ) {
493 493
 			gravityview()->log->error( 'Gravity Forms is inactive or not installed.' );
494 494
 			return null;
495 495
 		}
496 496
 
497
-		return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] ) ?
498
-			$GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] : \GFCommon::$version;
497
+		return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE' ] ) ?
498
+			$GLOBALS[ 'GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE' ] : \GFCommon::$version;
499 499
 	}
500 500
 
501 501
 	/**
@@ -552,9 +552,9 @@  discard block
 block discarded – undo
552 552
 		$tables = array();
553 553
 
554 554
 		if ( version_compare( \GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) ) {
555
-			$tables []= \GFFormsModel::get_entry_meta_table_name();
555
+			$tables [ ] = \GFFormsModel::get_entry_meta_table_name();
556 556
 		}
557
-		$tables []= \GFFormsModel::get_lead_meta_table_name();
557
+		$tables [ ] = \GFFormsModel::get_lead_meta_table_name();
558 558
 
559 559
 		foreach ( $tables as $meta_table ) {
560 560
 			$sql = "
@@ -572,13 +572,13 @@  discard block
 block discarded – undo
572 572
 		$tables = array();
573 573
 
574 574
 		if ( version_compare( \GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_notes_table_name' ) ) {
575
-			$tables[] = \GFFormsModel::get_entry_notes_table_name();
575
+			$tables[ ] = \GFFormsModel::get_entry_notes_table_name();
576 576
 		}
577 577
 
578
-		$tables[] = \GFFormsModel::get_lead_notes_table_name();
578
+		$tables[ ] = \GFFormsModel::get_lead_notes_table_name();
579 579
 
580
-		$disapproved = __('Disapproved the Entry for GravityView', 'gravityview');
581
-		$approved = __('Approved the Entry for GravityView', 'gravityview');
580
+		$disapproved = __( 'Disapproved the Entry for GravityView', 'gravityview' );
581
+		$approved = __( 'Approved the Entry for GravityView', 'gravityview' );
582 582
 
583 583
 		$suppress = $wpdb->suppress_errors();
584 584
 		foreach ( $tables as $notes_table ) {
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-other-entries.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
 	public function __construct() {
27 27
 		$this->label = esc_html__( 'Other Entries', 'gravityview' );
28
-		$this->description = esc_html__('Display other entries created by the entry creator.', 'gravityview');
28
+		$this->description = esc_html__( 'Display other entries created by the entry creator.', 'gravityview' );
29 29
 		parent::__construct();
30 30
 	}
31 31
 
@@ -35,32 +35,32 @@  discard block
 block discarded – undo
35 35
 	 */
36 36
 	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
37 37
 
38
-		if( 'edit' === $context ) {
38
+		if ( 'edit' === $context ) {
39 39
 			return $field_options;
40 40
 		}
41 41
 
42 42
 		// No "Link to single entry"; all the items will be links to entries!
43
-		unset( $field_options['show_as_link'] );
43
+		unset( $field_options[ 'show_as_link' ] );
44 44
 
45 45
 		$new_options = array();
46 46
 
47
-		$new_options['link_format'] = array(
47
+		$new_options[ 'link_format' ] = array(
48 48
 			'type'  => 'text',
49 49
 			'label' => __( 'Entry link text (required)', 'gravityview' ),
50
-			'value' => __('Entry #{entry_id}', 'gravityview'),
50
+			'value' => __( 'Entry #{entry_id}', 'gravityview' ),
51 51
 			'merge_tags' => 'force',
52 52
 		);
53 53
 
54
-		$new_options['after_link'] = array(
54
+		$new_options[ 'after_link' ] = array(
55 55
 			'type'  => 'textarea',
56 56
 			'label' => __( 'Text or HTML to display after the link (optional)', 'gravityview' ),
57
-			'desc'  => __('This content will be displayed below each entry link.', 'gravityview'),
57
+			'desc'  => __( 'This content will be displayed below each entry link.', 'gravityview' ),
58 58
 			'value' => '',
59 59
 			'merge_tags' => 'force',
60 60
 			'class' => 'widefat code',
61 61
 		);
62 62
 
63
-		$new_options['page_size'] = array(
63
+		$new_options[ 'page_size' ] = array(
64 64
 			'type'  => 'number',
65 65
 			'label' => __( 'Entries to Display', 'gravityview' ),
66 66
 			'desc'  => __( 'What is the maximum number of entries that should be shown?', 'gravityview' ),
@@ -68,14 +68,14 @@  discard block
 block discarded – undo
68 68
 			'merge_tags' => false,
69 69
 		);
70 70
 
71
-		$new_options['no_entries_hide'] = array(
71
+		$new_options[ 'no_entries_hide' ] = array(
72 72
 			'type'  => 'checkbox',
73 73
 			'label' => __( 'Hide if no entries', 'gravityview' ),
74 74
 			'desc'  => __( 'Don\'t display this field if the entry creator has no other entries', 'gravityview' ),
75 75
 			'value' => false,
76 76
 		);
77 77
 
78
-		$new_options['no_entries_text'] = array(
78
+		$new_options[ 'no_entries_text' ] = array(
79 79
 			'type'  => 'text',
80 80
 			'label' => __( 'No Entries Text', 'gravityview' ),
81 81
 			'desc'  => __( 'The text that is shown if the entry creator has no other entries (and "Hide if no entries" is disabled).', 'gravityview' ),
@@ -107,11 +107,11 @@  discard block
 block discarded – undo
107 107
 		foreach ( $filters as $filter ) {
108 108
 			foreach ( $wp_filter[ $filter ] as $priority => $callbacks ) {
109 109
 				foreach ( $callbacks as $id => $callback ) {
110
-					if ( ! is_array( $callback['function'] ) ) {
110
+					if ( ! is_array( $callback[ 'function' ] ) ) {
111 111
 						continue;
112 112
 					}
113
-					if ( $callback['function'][0] instanceof \GV\Widget ) {
114
-						$remove[] = array( $filter, $priority, $id );
113
+					if ( $callback[ 'function' ][ 0 ] instanceof \GV\Widget ) {
114
+						$remove[ ] = array( $filter, $priority, $id );
115 115
 					}
116 116
 				}
117 117
 			}
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 
120 120
 		foreach ( $remove as $r ) {
121 121
 			list( $filter, $priority, $id ) = $r;
122
-			$removed[] = array( $filter, $priority, $id, $wp_filter[ $filter ]->callbacks[ $priority ][ $id ] );
122
+			$removed[ ] = array( $filter, $priority, $id, $wp_filter[ $filter ]->callbacks[ $priority ][ $id ] );
123 123
 			unset( $wp_filter[ $filter ]->callbacks[ $priority ][ $id ] );
124 124
 		}
125 125
 
@@ -143,10 +143,10 @@  discard block
 block discarded – undo
143 143
 	public function filter_entries( $search_criteria, $form_id = null, $args = array(), $force_search_criteria = false ) {
144 144
 		$context = $this->context;
145 145
 
146
-		$created_by = $context->entry['created_by'];
146
+		$created_by = $context->entry[ 'created_by' ];
147 147
 
148 148
 		/** Filter entries by approved and created_by. */
149
-		$search_criteria['field_filters'][] = array(
149
+		$search_criteria[ 'field_filters' ][ ] = array(
150 150
 			'key' => 'created_by',
151 151
 			'value' => $created_by,
152 152
 			'operator' => 'is'
@@ -166,14 +166,14 @@  discard block
 block discarded – undo
166 166
 		$criteria = apply_filters( 'gravityview/field/other_entries/criteria', $search_criteria, $context->view->settings->as_atts(), $context->view->form->ID, $context );
167 167
 
168 168
 		/** Force mode all and filter out our own entry. */
169
-		$search_criteria['field_filters']['mode'] = 'all';
170
-		$search_criteria['field_filters'][] = array(
169
+		$search_criteria[ 'field_filters' ][ 'mode' ] = 'all';
170
+		$search_criteria[ 'field_filters' ][ ] = array(
171 171
 			'key' => 'id',
172 172
 			'value' => $context->entry->ID,
173 173
 			'operator' => 'isnot'
174 174
 		);
175 175
 
176
-		$search_criteria['paging']['page_size'] = $context->field->page_size ? : 10;
176
+		$search_criteria[ 'paging' ][ 'page_size' ] = $context->field->page_size ?: 10;
177 177
 
178 178
 		return $search_criteria;
179 179
 	}
Please login to merge, or discard this patch.
includes/helper-functions.php 1 patch
Spacing   +52 added lines, -52 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,15 +209,15 @@  discard block
 block discarded – undo
209 209
 
210 210
 	$width = $height * 0.7586206897;
211 211
 
212
-	if( function_exists('is_rtl') && is_rtl() ) {
213
-		$style = 'margin:10px 10px 10px 0; height='. $height .'px; width: '. $width .'px;';
212
+	if ( function_exists( 'is_rtl' ) && is_rtl() ) {
213
+		$style = 'margin:10px 10px 10px 0; height=' . $height . 'px; width: ' . $width . 'px;';
214 214
 		$css_class = is_string( $css_class ) ? $css_class : 'alignright';
215 215
 	} else {
216
-		$style = 'margin:10px 10px 10px 0; height='. $height .'px; width: '. $width .'px;';
216
+		$style = 'margin:10px 10px 10px 0; height=' . $height . 'px; width: ' . $width . 'px;';
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( stripslashes( $_POST['gv_fields'] ), $fields_holder );
651
+			GVCommon::gv_parse_str( stripslashes( $_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.