Completed
Push — develop ( 7b688d...d2cfdd )
by Zack
04:19
created
includes/class-api.php 1 patch
Spacing   +225 added lines, -225 removed lines patch added patch discarded remove patch
@@ -23,36 +23,36 @@  discard block
 block discarded – undo
23 23
 	 * @param boolean $force_show_label Whether to always show the label, regardless of field settings
24 24
 	 * @return string
25 25
 	 */
26
-	public static function field_label( $field, $entry = array(), $force_show_label = false ) {
26
+	public static function field_label($field, $entry = array(), $force_show_label = false) {
27 27
 		$gravityview_view = GravityView_View::getInstance();
28 28
 
29 29
 		$form = $gravityview_view->getForm();
30 30
 
31 31
 		$label = '';
32 32
 
33
-		if( !empty( $field['show_label'] ) || $force_show_label ) {
33
+		if (!empty($field['show_label']) || $force_show_label) {
34 34
 
35 35
 			$label = $field['label'];
36 36
 
37 37
 			// Support Gravity Forms 1.9+
38
-			if( class_exists( 'GF_Field' ) ) {
38
+			if (class_exists('GF_Field')) {
39 39
 
40
-				$field_object = RGFormsModel::get_field( $form, $field['id'] );
40
+				$field_object = RGFormsModel::get_field($form, $field['id']);
41 41
 
42
-				if( $field_object ) {
42
+				if ($field_object) {
43 43
 
44
-					$input = GFFormsModel::get_input( $field_object, $field['id'] );
44
+					$input = GFFormsModel::get_input($field_object, $field['id']);
45 45
 
46 46
 					// This is a complex field, with labels on a per-input basis
47
-					if( $input ) {
47
+					if ($input) {
48 48
 
49 49
 						// Does the input have a custom label on a per-input basis? Otherwise, default label.
50
-						$label = ! empty( $input['customLabel'] ) ? $input['customLabel'] : $input['label'];
50
+						$label = !empty($input['customLabel']) ? $input['customLabel'] : $input['label'];
51 51
 
52 52
 					} else {
53 53
 
54 54
 						// This is a field with one label
55
-						$label = $field_object->get_field_label( true, $field['label'] );
55
+						$label = $field_object->get_field_label(true, $field['label']);
56 56
 
57 57
 					}
58 58
 
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
 			}
62 62
 
63 63
 			// Use Gravity Forms label by default, but if a custom label is defined in GV, use it.
64
-			if ( !empty( $field['custom_label'] ) ) {
64
+			if (!empty($field['custom_label'])) {
65 65
 
66
-				$label = self::replace_variables( $field['custom_label'], $form, $entry );
66
+				$label = self::replace_variables($field['custom_label'], $form, $entry);
67 67
 
68 68
 			}
69 69
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 			 * @param[in,out] string $appended_content Content you can add after a label. Empty by default.
73 73
 			 * @param[in] array $field GravityView field array
74 74
 			 */
75
-			$label .= apply_filters( 'gravityview_render_after_label', '', $field );
75
+			$label .= apply_filters('gravityview_render_after_label', '', $field);
76 76
 
77 77
 		} // End $field['show_label']
78 78
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 		 * @param[in] array $form Gravity Forms form array
85 85
 		 * @param[in] array $entry Gravity Forms entry array
86 86
 		 */
87
-		$label = apply_filters( 'gravityview/template/field_label', $label, $field, $form, $entry );
87
+		$label = apply_filters('gravityview/template/field_label', $label, $field, $form, $entry);
88 88
 
89 89
 		return $label;
90 90
 	}
@@ -99,8 +99,8 @@  discard block
 block discarded – undo
99 99
 	 * @param  array      $entry        GF Entry array
100 100
 	 * @return string                  Text with variables maybe replaced
101 101
 	 */
102
-	public static function replace_variables($text, $form, $entry ) {
103
-		return GravityView_Merge_Tags::replace_variables( $text, $form, $entry );
102
+	public static function replace_variables($text, $form, $entry) {
103
+		return GravityView_Merge_Tags::replace_variables($text, $form, $entry);
104 104
 	}
105 105
 
106 106
 	/**
@@ -113,19 +113,19 @@  discard block
 block discarded – undo
113 113
 	 *
114 114
 	 * @return string|null If not empty, string in $format format. Otherwise, null.
115 115
 	 */
116
-	public static function field_width( $field, $format = '%d%%' ) {
116
+	public static function field_width($field, $format = '%d%%') {
117 117
 
118 118
 		$width = NULL;
119 119
 
120
-		if( !empty( $field['width'] ) ) {
121
-			$width = absint( $field['width'] );
120
+		if (!empty($field['width'])) {
121
+			$width = absint($field['width']);
122 122
 
123 123
 			// If using percentages, limit to 100%
124
-			if( '%d%%' === $format && $width > 100 ) {
124
+			if ('%d%%' === $format && $width > 100) {
125 125
 				$width = 100;
126 126
 			}
127 127
 
128
-			$width = sprintf( $format, $width );
128
+			$width = sprintf($format, $width);
129 129
 		}
130 130
 
131 131
 		return $width;
@@ -139,38 +139,38 @@  discard block
 block discarded – undo
139 139
 	 * @param mixed $field
140 140
 	 * @return string
141 141
 	 */
142
-	public static function field_class( $field, $form = NULL, $entry = NULL ) {
142
+	public static function field_class($field, $form = NULL, $entry = NULL) {
143 143
 		$gravityview_view = GravityView_View::getInstance();
144 144
 
145 145
 		$classes = array();
146 146
 
147
-		if( !empty( $field['custom_class'] ) ) {
147
+		if (!empty($field['custom_class'])) {
148 148
 
149 149
             $custom_class = $field['custom_class'];
150 150
 
151
-            if( !empty( $entry ) ) {
151
+            if (!empty($entry)) {
152 152
 
153 153
                 // We want the merge tag to be formatted as a class. The merge tag may be
154 154
                 // replaced by a multiple-word value that should be output as a single class.
155 155
                 // "Office Manager" will be formatted as `.OfficeManager`, not `.Office` and `.Manager`
156 156
                 add_filter('gform_merge_tag_filter', 'sanitize_html_class');
157 157
 
158
-                $custom_class = self::replace_variables( $custom_class, $form, $entry);
158
+                $custom_class = self::replace_variables($custom_class, $form, $entry);
159 159
 
160 160
                 // And then we want life to return to normal
161 161
                 remove_filter('gform_merge_tag_filter', 'sanitize_html_class');
162 162
             }
163 163
 
164 164
 			// And now we want the spaces to be handled nicely.
165
-			$classes[] = gravityview_sanitize_html_class( $custom_class );
165
+			$classes[] = gravityview_sanitize_html_class($custom_class);
166 166
 
167 167
 		}
168 168
 
169
-		if(!empty($field['id'])) {
170
-			if( !empty( $form ) && !empty( $form['id'] ) ) {
169
+		if (!empty($field['id'])) {
170
+			if (!empty($form) && !empty($form['id'])) {
171 171
 				$form_id = '-'.$form['id'];
172 172
 			} else {
173
-				$form_id = $gravityview_view->getFormId() ? '-'. $gravityview_view->getFormId() : '';
173
+				$form_id = $gravityview_view->getFormId() ? '-'.$gravityview_view->getFormId() : '';
174 174
 			}
175 175
 
176 176
 			$classes[] = 'gv-field'.$form_id.'-'.$field['id'];
@@ -191,21 +191,21 @@  discard block
 block discarded – undo
191 191
 	 * @param array $entry Gravity Forms entry array
192 192
 	 * @return string Sanitized unique HTML `id` attribute for the field
193 193
 	 */
194
-	public static function field_html_attr_id( $field, $form = array(), $entry = array() ) {
194
+	public static function field_html_attr_id($field, $form = array(), $entry = array()) {
195 195
 		$gravityview_view = GravityView_View::getInstance();
196 196
 		$id = $field['id'];
197 197
 
198
-		if ( ! empty( $id ) ) {
199
-			if ( ! empty( $form ) && ! empty( $form['id'] ) ) {
200
-				$form_id = '-' . $form['id'];
198
+		if (!empty($id)) {
199
+			if (!empty($form) && !empty($form['id'])) {
200
+				$form_id = '-'.$form['id'];
201 201
 			} else {
202
-				$form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : '';
202
+				$form_id = $gravityview_view->getFormId() ? '-'.$gravityview_view->getFormId() : '';
203 203
 			}
204 204
 
205
-			$id = 'gv-field' . $form_id . '-' . $field['id'];
205
+			$id = 'gv-field'.$form_id.'-'.$field['id'];
206 206
 		}
207 207
 
208
-		return esc_attr( $id );
208
+		return esc_attr($id);
209 209
 	}
210 210
 
211 211
 
@@ -217,15 +217,15 @@  discard block
 block discarded – undo
217 217
 	 * @param integer $field
218 218
 	 * @return null|string
219 219
 	 */
220
-	public static function field_value( $entry, $field_settings, $format = 'html' ) {
220
+	public static function field_value($entry, $field_settings, $format = 'html') {
221 221
 
222
-		if( empty( $entry['form_id'] ) || empty( $field_settings['id'] ) ) {
222
+		if (empty($entry['form_id']) || empty($field_settings['id'])) {
223 223
 			return NULL;
224 224
 		}
225 225
 
226 226
 		$gravityview_view = GravityView_View::getInstance();
227 227
 
228
-		if( class_exists( 'GFCache' ) ) {
228
+		if (class_exists('GFCache')) {
229 229
 			/**
230 230
 			 * Gravity Forms' GFCache function was thrashing the database, causing double the amount of time for the field_value() method to run.
231 231
 			 *
@@ -240,18 +240,18 @@  discard block
 block discarded – undo
240 240
 			 * @param boolean false Tell Gravity Forms not to store this as a transient
241 241
 			 * @param  int 0 Time to store the value. 0 is maximum amount of time possible.
242 242
 			 */
243
-			GFCache::set( "GFFormsModel::get_lead_field_value_" . $entry["id"] . "_" . $field_settings["id"], false, false, 0 );
243
+			GFCache::set("GFFormsModel::get_lead_field_value_".$entry["id"]."_".$field_settings["id"], false, false, 0);
244 244
 		}
245 245
 
246 246
 		$field_id = $field_settings['id'];
247 247
 
248 248
 		$form = $gravityview_view->getForm();
249 249
 
250
-		$field = gravityview_get_field( $form, $field_id );
250
+		$field = gravityview_get_field($form, $field_id);
251 251
 
252 252
 		$field_type = RGFormsModel::get_input_type($field);
253 253
 
254
-		if( $field_type ) {
254
+		if ($field_type) {
255 255
 			$field_type = $field['type'];
256 256
 			$value = RGFormsModel::get_lead_field_value($entry, $field);
257 257
 		} else {
@@ -266,15 +266,15 @@  discard block
 block discarded – undo
266 266
 
267 267
 		$display_value = GFCommon::get_lead_field_display($field, $value, $entry["currency"], false, $format);
268 268
 
269
-		if( $errors = ob_get_clean() ) {
270
-			do_action( 'gravityview_log_error', 'GravityView_API[field_value] Errors when calling GFCommon::get_lead_field_display()', $errors );
269
+		if ($errors = ob_get_clean()) {
270
+			do_action('gravityview_log_error', 'GravityView_API[field_value] Errors when calling GFCommon::get_lead_field_display()', $errors);
271 271
 		}
272 272
 
273 273
 		$display_value = apply_filters("gform_entry_field_value", $display_value, $field, $entry, $form);
274 274
 
275 275
 		// prevent the use of merge_tags for non-admin fields
276
-		if( !empty( $field['adminOnly'] ) ) {
277
-			$display_value = self::replace_variables( $display_value, $form, $entry );
276
+		if (!empty($field['adminOnly'])) {
277
+			$display_value = self::replace_variables($display_value, $form, $entry);
278 278
 		}
279 279
 
280 280
 		// Check whether the field exists in /includes/fields/{$field_type}.php
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 		$field_path = $gravityview_view->locate_template("fields/{$field_type}.php");
283 283
 
284 284
 		// Set the field data to be available in the templates
285
-		$gravityview_view->setCurrentField( array(
285
+		$gravityview_view->setCurrentField(array(
286 286
 			'form' => $form,
287 287
 			'field_id' => $field_id,
288 288
 			'field' => $field,
@@ -294,13 +294,13 @@  discard block
 block discarded – undo
294 294
 			'field_type' => $field_type, /** {@since 1.6} **/
295 295
 		));
296 296
 
297
-		if( ! empty( $field_path ) ) {
297
+		if (!empty($field_path)) {
298 298
 
299
-			do_action( 'gravityview_log_debug', sprintf('[field_value] Rendering %s', $field_path ) );
299
+			do_action('gravityview_log_debug', sprintf('[field_value] Rendering %s', $field_path));
300 300
 
301 301
 			ob_start();
302 302
 
303
-			load_template( $field_path, false );
303
+			load_template($field_path, false);
304 304
 
305 305
 			$output = ob_get_clean();
306 306
 
@@ -319,11 +319,11 @@  discard block
 block discarded – undo
319 319
 		 * Fields can override this by modifying the field data variable inside the field. See /templates/fields/post_image.php for an example.
320 320
 		 *
321 321
 		 */
322
-		if( !empty( $field_settings['show_as_link'] ) ) {
322
+		if (!empty($field_settings['show_as_link'])) {
323 323
 
324
-			$link_atts = empty( $field_settings['new_window'] ) ? array() : array( 'target' => '_blank' );
324
+			$link_atts = empty($field_settings['new_window']) ? array() : array('target' => '_blank');
325 325
 
326
-			$output = self::entry_link_html( $entry, $output, $link_atts, $field_settings );
326
+			$output = self::entry_link_html($entry, $output, $link_atts, $field_settings);
327 327
 
328 328
 		}
329 329
 
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 		 * @param array  $entry The GF entry array
335 335
 		 * @param  array $field_settings Settings for the particular GV field
336 336
 		 */
337
-		$output = apply_filters( 'gravityview_field_entry_value_'.$field_type, $output, $entry, $field_settings, $gravityview_view->getCurrentField() );
337
+		$output = apply_filters('gravityview_field_entry_value_'.$field_type, $output, $entry, $field_settings, $gravityview_view->getCurrentField());
338 338
 
339 339
 		/**
340 340
 		 * @filter `gravityview_field_entry_value` Modify the field value output for all field types
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 		 * @param  array $field_settings Settings for the particular GV field
344 344
 		 * @param array $field_data  {@since 1.6}
345 345
 		 */
346
-		$output = apply_filters( 'gravityview_field_entry_value', $output, $entry, $field_settings, $gravityview_view->getCurrentField() );
346
+		$output = apply_filters('gravityview_field_entry_value', $output, $entry, $field_settings, $gravityview_view->getCurrentField());
347 347
 
348 348
 		return $output;
349 349
 	}
@@ -357,18 +357,18 @@  discard block
 block discarded – undo
357 357
 	 * @param array $entry Gravity Forms entry array
358 358
 	 * @param array $field_settings Array of field settings. Optional, but passed to the `gravityview_field_entry_link` filter
359 359
 	 */
360
-	public static function entry_link_html( $entry = array(), $anchor_text = '', $passed_tag_atts = array(), $field_settings = array() ) {
360
+	public static function entry_link_html($entry = array(), $anchor_text = '', $passed_tag_atts = array(), $field_settings = array()) {
361 361
 
362
-		if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry['id'] ) ) {
362
+		if (empty($entry) || !is_array($entry) || !isset($entry['id'])) {
363 363
 
364
-			do_action( 'gravityview_log_debug', 'GravityView_API[entry_link_tag] Entry not defined; returning null', $entry );
364
+			do_action('gravityview_log_debug', 'GravityView_API[entry_link_tag] Entry not defined; returning null', $entry);
365 365
 
366 366
 			return NULL;
367 367
 		}
368 368
 
369
-		$href = self::entry_link( $entry );
369
+		$href = self::entry_link($entry);
370 370
 
371
-		$link = gravityview_get_link( $href, $anchor_text, $passed_tag_atts );
371
+		$link = gravityview_get_link($href, $anchor_text, $passed_tag_atts);
372 372
 
373 373
 		/**
374 374
 		 * @filter `gravityview_field_entry_link` Modify the link HTML
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 		 * @param array  $entry The GF entry array
378 378
 		 * @param  array $field_settings Settings for the particular GV field
379 379
 		 */
380
-		$output = apply_filters( 'gravityview_field_entry_link', $link, $href, $entry, $field_settings );
380
+		$output = apply_filters('gravityview_field_entry_link', $link, $href, $entry, $field_settings);
381 381
 
382 382
 		return $output;
383 383
 	}
@@ -392,11 +392,11 @@  discard block
 block discarded – undo
392 392
 
393 393
 		$is_search = false;
394 394
 
395
-		if( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) {
395
+		if ($gravityview_view && ($gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search)) {
396 396
 			$is_search = true;
397 397
 		}
398 398
 
399
-		if($is_search) {
399
+		if ($is_search) {
400 400
 			$output = __('This search returned no results.', 'gravityview');
401 401
 		} else {
402 402
 			$output = __('No entries match your request.', 'gravityview');
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
 		 * @param string $output The existing "No Entries" text
408 408
 		 * @param boolean $is_search Is the current page a search result, or just a multiple entries screen?
409 409
 		 */
410
-		$output = apply_filters( 'gravitview_no_entries_text', $output, $is_search);
410
+		$output = apply_filters('gravitview_no_entries_text', $output, $is_search);
411 411
 
412 412
 		return $wpautop ? wpautop($output) : $output;
413 413
 	}
@@ -421,42 +421,42 @@  discard block
 block discarded – undo
421 421
 	 * @param boolean $add_query_args Add pagination and sorting arguments
422 422
 	 * @return string      Permalink to multiple entries view
423 423
 	 */
424
-	public static function directory_link( $post_id = NULL, $add_query_args = true ) {
424
+	public static function directory_link($post_id = NULL, $add_query_args = true) {
425 425
 		global $post;
426 426
 
427 427
 		$gravityview_view = GravityView_View::getInstance();
428 428
 
429
-		if( empty( $post_id ) ) {
429
+		if (empty($post_id)) {
430 430
 
431 431
 			$post_id = false;
432 432
 
433 433
 			// DataTables passes the Post ID
434
-			if( defined('DOING_AJAX') && DOING_AJAX ) {
434
+			if (defined('DOING_AJAX') && DOING_AJAX) {
435 435
 
436
-				$post_id = isset( $_POST['post_id'] ) ? (int)$_POST['post_id'] : false;
436
+				$post_id = isset($_POST['post_id']) ? (int)$_POST['post_id'] : false;
437 437
 
438 438
 			} else {
439 439
 
440 440
 				// The Post ID has been passed via the shortcode
441
-				if( !empty( $gravityview_view ) && $gravityview_view->getPostId() ) {
441
+				if (!empty($gravityview_view) && $gravityview_view->getPostId()) {
442 442
 
443 443
 					$post_id = $gravityview_view->getPostId();
444 444
 
445 445
 				} else {
446 446
 
447 447
 					// This is a GravityView post type
448
-					if( GravityView_frontend::getInstance()->isGravityviewPostType() ) {
448
+					if (GravityView_frontend::getInstance()->isGravityviewPostType()) {
449 449
 
450
-						$post_id = isset( $gravityview_view ) ? $gravityview_view->getViewId() : $post->ID;
450
+						$post_id = isset($gravityview_view) ? $gravityview_view->getViewId() : $post->ID;
451 451
 
452 452
 					} else {
453 453
 
454 454
 						// This is an embedded GravityView; use the embedded post's ID as the base.
455
-						if( GravityView_frontend::getInstance()->isPostHasShortcode() && is_a( $post, 'WP_Post' ) ) {
455
+						if (GravityView_frontend::getInstance()->isPostHasShortcode() && is_a($post, 'WP_Post')) {
456 456
 
457 457
 							$post_id = $post->ID;
458 458
 
459
-						} elseif( $gravityview_view->getViewId() ) {
459
+						} elseif ($gravityview_view->getViewId()) {
460 460
 
461 461
 							// The GravityView has been embedded in a widget or in a template, and
462 462
 							// is not in the current content. Thus, we defer to the View's own ID.
@@ -471,39 +471,39 @@  discard block
 block discarded – undo
471 471
 		}
472 472
 
473 473
 		// No post ID, get outta here.
474
-		if( empty( $post_id ) ) {
474
+		if (empty($post_id)) {
475 475
 			return NULL;
476 476
 		}
477 477
 
478 478
 		// If we've saved the permalink in memory, use it
479 479
 		// @since 1.3
480
-		$link = wp_cache_get( 'gv_directory_link_'.$post_id );
480
+		$link = wp_cache_get('gv_directory_link_'.$post_id);
481 481
 
482
-		if( empty( $link ) ) {
482
+		if (empty($link)) {
483 483
 
484
-			$link = get_permalink( $post_id );
484
+			$link = get_permalink($post_id);
485 485
 
486 486
 			// If not yet saved, cache the permalink.
487 487
 			// @since 1.3
488
-			wp_cache_set( 'gv_directory_link_'.$post_id, $link );
488
+			wp_cache_set('gv_directory_link_'.$post_id, $link);
489 489
 
490 490
 		}
491 491
 
492 492
 		// Deal with returning to proper pagination for embedded views
493
-		if( $link && $add_query_args ) {
493
+		if ($link && $add_query_args) {
494 494
 
495 495
 			$args = array();
496 496
 
497
-			if( $pagenum = rgget('pagenum') ) {
498
-				$args['pagenum'] = intval( $pagenum );
497
+			if ($pagenum = rgget('pagenum')) {
498
+				$args['pagenum'] = intval($pagenum);
499 499
 			}
500 500
 
501
-			if( $sort = rgget('sort') ) {
501
+			if ($sort = rgget('sort')) {
502 502
 				$args['sort'] = $sort;
503 503
 				$args['dir'] = rgget('dir');
504 504
 			}
505 505
 
506
-			$link = add_query_arg( $args, $link );
506
+			$link = add_query_arg($args, $link);
507 507
 		}
508 508
 
509 509
 		return $link;
@@ -520,10 +520,10 @@  discard block
 block discarded – undo
520 520
 	 * @param  array  $entry        Entry data passed to provide additional information when generating the hash. Optional - don't rely on it being available.
521 521
 	 * @return string               Hashed unique value for entry
522 522
 	 */
523
-	private static function get_custom_entry_slug( $id, $entry = array() ) {
523
+	private static function get_custom_entry_slug($id, $entry = array()) {
524 524
 
525 525
 		// Generate an unique hash to use as the default value
526
-		$slug = substr( wp_hash( $id, 'gravityview'.$id ), 0, 8 );
526
+		$slug = substr(wp_hash($id, 'gravityview'.$id), 0, 8);
527 527
 
528 528
 		/**
529 529
 		 * @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}`
@@ -531,14 +531,14 @@  discard block
 block discarded – undo
531 531
 		 * @param  string $id The entry ID
532 532
 		 * @param  array $entry Entry data array. May be empty.
533 533
 		 */
534
-		$slug = apply_filters( 'gravityview_entry_slug', $slug, $id, $entry );
534
+		$slug = apply_filters('gravityview_entry_slug', $slug, $id, $entry);
535 535
 
536 536
 		// Make sure we have something - use the original ID as backup.
537
-		if( empty( $slug ) ) {
537
+		if (empty($slug)) {
538 538
 			$slug = $id;
539 539
 		}
540 540
 
541
-		return sanitize_title( $slug );
541
+		return sanitize_title($slug);
542 542
 	}
543 543
 
544 544
 	/**
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
 	 * @param  array  $entry        Gravity Forms Entry array, optional. Used only to provide data to customize the `gravityview_entry_slug` filter
553 553
 	 * @return string               Unique slug ID, passed through `sanitize_title()`
554 554
 	 */
555
-	public static function get_entry_slug( $id_or_string, $entry = array() ) {
555
+	public static function get_entry_slug($id_or_string, $entry = array()) {
556 556
 
557 557
 		/**
558 558
 		 * Default: use the entry ID as the unique identifier
@@ -563,32 +563,32 @@  discard block
 block discarded – undo
563 563
 		 * @filter `gravityview_custom_entry_slug` Whether to enable and use custom entry slugs.
564 564
 		 * @param boolean True: Allow for slugs based on entry values. False: always use entry IDs (default)
565 565
 		 */
566
-		$custom = apply_filters('gravityview_custom_entry_slug', false );
566
+		$custom = apply_filters('gravityview_custom_entry_slug', false);
567 567
 
568 568
 		// If we're using custom slug...
569
-		if ( $custom ) {
569
+		if ($custom) {
570 570
 
571 571
 			// Get the entry hash
572
-			$hash = self::get_custom_entry_slug( $id_or_string, $entry );
572
+			$hash = self::get_custom_entry_slug($id_or_string, $entry);
573 573
 
574 574
 			// See if the entry already has a hash set
575
-			$value = gform_get_meta( $id_or_string, 'gravityview_unique_id' );
575
+			$value = gform_get_meta($id_or_string, 'gravityview_unique_id');
576 576
 
577 577
 			// If it does have a hash set, and the hash is expected, use it.
578 578
 			// This check allows users to change the hash structure using the
579 579
 			// gravityview_entry_hash filter and have the old hashes expire.
580
-			if( empty( $value ) || $value !== $hash ) {
580
+			if (empty($value) || $value !== $hash) {
581 581
 
582
-				gform_update_meta( $id_or_string, 'gravityview_unique_id', $hash );
582
+				gform_update_meta($id_or_string, 'gravityview_unique_id', $hash);
583 583
 
584 584
 			}
585 585
 
586 586
 			$slug = $hash;
587 587
 
588
-			unset( $value, $hash );
588
+			unset($value, $hash);
589 589
 		}
590 590
 
591
-		return sanitize_title( $slug );
591
+		return sanitize_title($slug);
592 592
 	}
593 593
 
594 594
     /**
@@ -599,18 +599,18 @@  discard block
 block discarded – undo
599 599
      * @param $entry array Gravity Forms entry object
600 600
      * @param $form array Gravity Forms form object
601 601
      */
602
-    public static function entry_create_custom_slug( $entry, $form ) {
602
+    public static function entry_create_custom_slug($entry, $form) {
603 603
         /**
604 604
          * @filter `gravityview_custom_entry_slug` On entry creation, check if we are using the custom entry slug feature and update the meta
605 605
          * @param boolean $custom Should we process the custom entry slug?
606 606
          */
607
-        $custom = apply_filters( 'gravityview_custom_entry_slug', false );
608
-        if( $custom ) {
607
+        $custom = apply_filters('gravityview_custom_entry_slug', false);
608
+        if ($custom) {
609 609
             // create the gravityview_unique_id and save it
610 610
 
611 611
             // Get the entry hash
612
-            $hash = self::get_custom_entry_slug( $entry['id'], $entry );
613
-            gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash );
612
+            $hash = self::get_custom_entry_slug($entry['id'], $entry);
613
+            gform_update_meta($entry['id'], 'gravityview_unique_id', $hash);
614 614
 
615 615
         }
616 616
     }
@@ -625,55 +625,55 @@  discard block
 block discarded – undo
625 625
 	 * @param boolean $add_directory_args True: Add args to help return to directory; False: only include args required to get to entry {@since 1.7.3}
626 626
 	 * @return string          Link to the entry with the directory parent slug
627 627
 	 */
628
-	public static function entry_link( $entry, $post_id = NULL, $add_directory_args = true ) {
628
+	public static function entry_link($entry, $post_id = NULL, $add_directory_args = true) {
629 629
 
630
-		if( ! empty( $entry ) && ! is_array( $entry ) ) {
631
-			$entry = GVCommon::get_entry( $entry );
632
-		} else if( empty( $entry ) ) {
630
+		if (!empty($entry) && !is_array($entry)) {
631
+			$entry = GVCommon::get_entry($entry);
632
+		} else if (empty($entry)) {
633 633
 			$entry = GravityView_frontend::getInstance()->getEntry();
634 634
 		}
635 635
 
636 636
 		// Second parameter used to be passed as $field; this makes sure it's not an array
637
-		if( !is_numeric( $post_id ) ) {
637
+		if (!is_numeric($post_id)) {
638 638
 			$post_id = NULL;
639 639
 		}
640 640
 
641 641
 		// Get the permalink to the View
642
-		$directory_link = self::directory_link( $post_id, false );
642
+		$directory_link = self::directory_link($post_id, false);
643 643
 
644 644
 		// No post ID? Get outta here.
645
-		if( empty( $directory_link ) ) {
645
+		if (empty($directory_link)) {
646 646
 			return '';
647 647
 		}
648 648
 
649 649
 		$query_arg_name = GravityView_Post_Types::get_entry_var_name();
650 650
 
651
-		$entry_slug = self::get_entry_slug( $entry['id'], $entry );
651
+		$entry_slug = self::get_entry_slug($entry['id'], $entry);
652 652
 
653
-		if( get_option('permalink_structure') && !is_preview() ) {
653
+		if (get_option('permalink_structure') && !is_preview()) {
654 654
 
655 655
 			$args = array();
656 656
 
657
-			$directory_link = trailingslashit( $directory_link ) . $query_arg_name . '/'. $entry_slug .'/';
657
+			$directory_link = trailingslashit($directory_link).$query_arg_name.'/'.$entry_slug.'/';
658 658
 
659 659
 		} else {
660 660
 
661
-			$args = array( $query_arg_name => $entry_slug );
661
+			$args = array($query_arg_name => $entry_slug);
662 662
 		}
663 663
 
664 664
 		/**
665 665
 		 * @since 1.7.3
666 666
 		 */
667
-		if( $add_directory_args ) {
667
+		if ($add_directory_args) {
668 668
 
669
-			if( !empty( $_GET['pagenum'] ) ) {
670
-				$args['pagenum'] = intval( $_GET['pagenum'] );
669
+			if (!empty($_GET['pagenum'])) {
670
+				$args['pagenum'] = intval($_GET['pagenum']);
671 671
 			}
672 672
 
673 673
 			/**
674 674
 			 * @since 1.7
675 675
 			 */
676
-			if( $sort = rgget('sort') ) {
676
+			if ($sort = rgget('sort')) {
677 677
 				$args['sort'] = $sort;
678 678
 				$args['dir'] = rgget('dir');
679 679
 			}
@@ -685,11 +685,11 @@  discard block
 block discarded – undo
685 685
 		 * has the view id so that Advanced Filters can be applied correctly when rendering the single view
686 686
 		 * @see GravityView_frontend::get_context_view_id()
687 687
 		 */
688
-		if( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() ) {
688
+		if (class_exists('GravityView_View_Data') && GravityView_View_Data::getInstance()->has_multiple_views()) {
689 689
 			$args['gvid'] = gravityview_get_view_id();
690 690
 		}
691 691
 
692
-		return add_query_arg( $args, $directory_link );
692
+		return add_query_arg($args, $directory_link);
693 693
 
694 694
 	}
695 695
 
@@ -699,12 +699,12 @@  discard block
 block discarded – undo
699 699
 
700 700
 // inside loop functions
701 701
 
702
-function gv_label( $field, $entry = NULL ) {
703
-	return GravityView_API::field_label( $field, $entry );
702
+function gv_label($field, $entry = NULL) {
703
+	return GravityView_API::field_label($field, $entry);
704 704
 }
705 705
 
706
-function gv_class( $field, $form = NULL, $entry = array() ) {
707
-	return GravityView_API::field_class( $field, $form, $entry  );
706
+function gv_class($field, $form = NULL, $entry = array()) {
707
+	return GravityView_API::field_class($field, $form, $entry);
708 708
 }
709 709
 
710 710
 /**
@@ -716,11 +716,11 @@  discard block
 block discarded – undo
716 716
  *
717 717
  * @return string CSS class, sanitized by gravityview_sanitize_html_class()
718 718
  */
719
-function gv_container_class( $class = '' ) {
719
+function gv_container_class($class = '') {
720 720
 
721
-	$default = sprintf( 'gv-container gv-container-%d', GravityView_View::getInstance()->getViewId() );
721
+	$default = sprintf('gv-container gv-container-%d', GravityView_View::getInstance()->getViewId());
722 722
 
723
-	if( GravityView_View::getInstance()->isHideUntilSearched() ) {
723
+	if (GravityView_View::getInstance()->isHideUntilSearched()) {
724 724
 		$default .= ' hidden';
725 725
 	}
726 726
 
@@ -729,38 +729,38 @@  discard block
 block discarded – undo
729 729
 	 * @since 1.5.4
730 730
 	 * @param[in,out] string $class Default: `gv-container gv-container-{view id}`. If View is hidden until search, adds ` hidden`
731 731
 	 */
732
-	$class = apply_filters( 'gravityview/render/container/class', $class . $default );
732
+	$class = apply_filters('gravityview/render/container/class', $class.$default);
733 733
 
734
-	$class = gravityview_sanitize_html_class( $class );
734
+	$class = gravityview_sanitize_html_class($class);
735 735
 
736 736
 	echo $class;
737 737
 }
738 738
 
739
-function gv_value( $entry, $field ) {
739
+function gv_value($entry, $field) {
740 740
 
741
-	$value = GravityView_API::field_value( $entry, $field );
741
+	$value = GravityView_API::field_value($entry, $field);
742 742
 
743
-	if( $value === '') {
743
+	if ($value === '') {
744 744
 		/**
745 745
 		 * @filter `gravityview_empty_value` What to display when a field is empty
746 746
 		 * @param string $value (empty string)
747 747
 		 */
748
-		$value = apply_filters( 'gravityview_empty_value', '' );
748
+		$value = apply_filters('gravityview_empty_value', '');
749 749
 	}
750 750
 
751 751
 	return $value;
752 752
 }
753 753
 
754
-function gv_directory_link( $post = NULL, $add_pagination = true ) {
755
-	return GravityView_API::directory_link( $post, $add_pagination );
754
+function gv_directory_link($post = NULL, $add_pagination = true) {
755
+	return GravityView_API::directory_link($post, $add_pagination);
756 756
 }
757 757
 
758
-function gv_entry_link( $entry, $post_id = NULL ) {
759
-	return GravityView_API::entry_link( $entry, $post_id );
758
+function gv_entry_link($entry, $post_id = NULL) {
759
+	return GravityView_API::entry_link($entry, $post_id);
760 760
 }
761 761
 
762 762
 function gv_no_results($wpautop = true) {
763
-	return GravityView_API::no_results( $wpautop );
763
+	return GravityView_API::no_results($wpautop);
764 764
 }
765 765
 
766 766
 /**
@@ -772,21 +772,21 @@  discard block
 block discarded – undo
772 772
 
773 773
 	$href = gv_directory_link();
774 774
 
775
-	if( empty( $href ) ) { return NULL; }
775
+	if (empty($href)) { return NULL; }
776 776
 
777 777
 	// calculate link label
778 778
 	$gravityview_view = GravityView_View::getInstance();
779 779
 
780
-	$label = $gravityview_view->getBackLinkLabel() ? $gravityview_view->getBackLinkLabel() : __( '← Go back', 'gravityview' );
780
+	$label = $gravityview_view->getBackLinkLabel() ? $gravityview_view->getBackLinkLabel() : __('← Go back', 'gravityview');
781 781
 
782 782
 	/**
783 783
 	 * @filter `gravityview_go_back_label` Modify the back link text
784 784
 	 * @since 1.0.9
785 785
 	 * @param string $label Existing label text
786 786
 	 */
787
-	$label = apply_filters( 'gravityview_go_back_label', $label );
787
+	$label = apply_filters('gravityview_go_back_label', $label);
788 788
 
789
-	$link = gravityview_get_link( $href, esc_html( $label ), array(
789
+	$link = gravityview_get_link($href, esc_html($label), array(
790 790
 		'data-viewid' => $gravityview_view->getViewId()
791 791
 	));
792 792
 
@@ -805,9 +805,9 @@  discard block
 block discarded – undo
805 805
  * @param  string 	$display_value The value generated by Gravity Forms
806 806
  * @return string                Value
807 807
  */
808
-function gravityview_get_field_value( $entry, $field_id, $display_value ) {
808
+function gravityview_get_field_value($entry, $field_id, $display_value) {
809 809
 
810
-	if( floatval( $field_id ) === floor( floatval( $field_id ) ) ) {
810
+	if (floatval($field_id) === floor(floatval($field_id))) {
811 811
 
812 812
 		// For the complete field value as generated by Gravity Forms
813 813
 		return $display_value;
@@ -815,7 +815,7 @@  discard block
 block discarded – undo
815 815
 	} else {
816 816
 
817 817
 		// For one part of the address (City, ZIP, etc.)
818
-		return isset( $entry[ $field_id ] ) ? $entry[ $field_id ] : '';
818
+		return isset($entry[$field_id]) ? $entry[$field_id] : '';
819 819
 
820 820
 	}
821 821
 
@@ -831,48 +831,48 @@  discard block
 block discarded – undo
831 831
  * @param  string      $taxonomy Type of term (`post_tag` or `category`)
832 832
  * @return string                CSV of linked terms
833 833
  */
834
-function gravityview_convert_value_to_term_list( $value, $taxonomy = 'post_tag' ) {
834
+function gravityview_convert_value_to_term_list($value, $taxonomy = 'post_tag') {
835 835
 
836 836
 	$output = array();
837 837
 
838
-	$terms = explode( ', ', $value );
838
+	$terms = explode(', ', $value);
839 839
 
840
-	foreach ($terms as $term_name ) {
840
+	foreach ($terms as $term_name) {
841 841
 
842 842
 		// If we're processing a category,
843
-		if( $taxonomy === 'category' ) {
843
+		if ($taxonomy === 'category') {
844 844
 
845 845
 			// Use rgexplode to prevent errors if : doesn't exist
846
-			list( $term_name, $term_id ) = rgexplode( ':', $value, 2 );
846
+			list($term_name, $term_id) = rgexplode(':', $value, 2);
847 847
 
848 848
 			// The explode was succesful; we have the category ID
849
-			if( !empty( $term_id )) {
850
-				$term = get_term_by( 'id', $term_id, $taxonomy );
849
+			if (!empty($term_id)) {
850
+				$term = get_term_by('id', $term_id, $taxonomy);
851 851
 			} else {
852 852
 			// We have to fall back to the name
853
-				$term = get_term_by( 'name', $term_name, $taxonomy );
853
+				$term = get_term_by('name', $term_name, $taxonomy);
854 854
 			}
855 855
 
856 856
 		} else {
857 857
 			// Use the name of the tag to get the full term information
858
-			$term = get_term_by( 'name', $term_name, $taxonomy );
858
+			$term = get_term_by('name', $term_name, $taxonomy);
859 859
 		}
860 860
 
861 861
 		// There's still a tag/category here.
862
-		if( $term ) {
862
+		if ($term) {
863 863
 
864
-			$term_link = get_term_link( $term, $taxonomy );
864
+			$term_link = get_term_link($term, $taxonomy);
865 865
 
866 866
 			// If there was an error, continue to the next term.
867
-			if ( is_wp_error( $term_link ) ) {
867
+			if (is_wp_error($term_link)) {
868 868
 			    continue;
869 869
 			}
870 870
 
871
-			$output[] = gravityview_get_link( $term_link, esc_html( $term->name ) );
871
+			$output[] = gravityview_get_link($term_link, esc_html($term->name));
872 872
 		}
873 873
 	}
874 874
 
875
-	return implode(', ', $output );
875
+	return implode(', ', $output);
876 876
 }
877 877
 
878 878
 /**
@@ -882,12 +882,12 @@  discard block
 block discarded – undo
882 882
  * @param  string      $taxonomy Taxonomy of term to fetch.
883 883
  * @return string                String with terms
884 884
  */
885
-function gravityview_get_the_term_list( $post_id, $link = true, $taxonomy = 'post_tag' ) {
885
+function gravityview_get_the_term_list($post_id, $link = true, $taxonomy = 'post_tag') {
886 886
 
887
-	$output = get_the_term_list( $post_id, $taxonomy, NULL, ', ' );
887
+	$output = get_the_term_list($post_id, $taxonomy, NULL, ', ');
888 888
 
889
-	if( empty( $link ) ) {
890
-		return strip_tags( $output);
889
+	if (empty($link)) {
890
+		return strip_tags($output);
891 891
 	}
892 892
 
893 893
 	return $output;
@@ -906,17 +906,17 @@  discard block
 block discarded – undo
906 906
 	$fe = GravityView_frontend::getInstance();
907 907
 
908 908
 	// Solve problem when loading content via admin-ajax.php
909
-	if( ! $fe->getGvOutputData() ) {
909
+	if (!$fe->getGvOutputData()) {
910 910
 
911
-		do_action( 'gravityview_log_debug', '[gravityview_get_current_views] gv_output_data not defined; parsing content.' );
911
+		do_action('gravityview_log_debug', '[gravityview_get_current_views] gv_output_data not defined; parsing content.');
912 912
 
913 913
 		$fe->parse_content();
914 914
 	}
915 915
 
916 916
 	// Make 100% sure that we're dealing with a properly called situation
917
-	if( !is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) {
917
+	if (!is_a($fe->getGvOutputData(), 'GravityView_View_Data')) {
918 918
 
919
-		do_action( 'gravityview_log_debug', '[gravityview_get_current_views] gv_output_data not an object or get_view not callable.', $fe->getGvOutputData() );
919
+		do_action('gravityview_log_debug', '[gravityview_get_current_views] gv_output_data not an object or get_view not callable.', $fe->getGvOutputData());
920 920
 
921 921
 		return array();
922 922
 	}
@@ -930,18 +930,18 @@  discard block
 block discarded – undo
930 930
  * @see  GravityView_View_Data::get_view()
931 931
  * @return array View data with `id`, `view_id`, `form_id`, `template_id`, `atts`, `fields`, `widgets`, `form` keys.
932 932
  */
933
-function gravityview_get_current_view_data( $view_id = 0 ) {
933
+function gravityview_get_current_view_data($view_id = 0) {
934 934
 
935 935
 	$fe = GravityView_frontend::getInstance();
936 936
 
937
-	if( ! $fe->getGvOutputData() ) { return array(); }
937
+	if (!$fe->getGvOutputData()) { return array(); }
938 938
 
939 939
 	// If not set, grab the current view ID
940
-	if( empty( $view_id ) ) {
940
+	if (empty($view_id)) {
941 941
 		$view_id = $fe->get_context_view_id();
942 942
 	}
943 943
 
944
-	return $fe->getGvOutputData()->get_view( $view_id );
944
+	return $fe->getGvOutputData()->get_view($view_id);
945 945
 }
946 946
 
947 947
 // Templates' hooks
@@ -950,7 +950,7 @@  discard block
 block discarded – undo
950 950
 	 * @action `gravityview_before` Display content before a View. Used to render widget areas. Rendered outside the View container `<div>`
951 951
 	 * @param int $view_id The ID of the View being displayed
952 952
 	 */
953
-	do_action( 'gravityview_before', gravityview_get_view_id() );
953
+	do_action('gravityview_before', gravityview_get_view_id());
954 954
 }
955 955
 
956 956
 function gravityview_header() {
@@ -958,7 +958,7 @@  discard block
 block discarded – undo
958 958
 	 * @action `gravityview_header` Prepend content to the View container `<div>`
959 959
 	 * @param int $view_id The ID of the View being displayed
960 960
 	 */
961
-	do_action( 'gravityview_header', gravityview_get_view_id() );
961
+	do_action('gravityview_header', gravityview_get_view_id());
962 962
 }
963 963
 
964 964
 function gravityview_footer() {
@@ -966,7 +966,7 @@  discard block
 block discarded – undo
966 966
 	 * @action `gravityview_after` Display content after a View. Used to render footer widget areas. Rendered outside the View container `<div>`
967 967
 	 * @param int $view_id The ID of the View being displayed
968 968
 	 */
969
-	do_action( 'gravityview_footer', gravityview_get_view_id() );
969
+	do_action('gravityview_footer', gravityview_get_view_id());
970 970
 }
971 971
 
972 972
 function gravityview_after() {
@@ -974,7 +974,7 @@  discard block
 block discarded – undo
974 974
 	 * @action `gravityview_after` Append content to the View container `<div>`
975 975
 	 * @param int $view_id The ID of the View being displayed
976 976
 	 */
977
-	do_action( 'gravityview_after', gravityview_get_view_id() );
977
+	do_action('gravityview_after', gravityview_get_view_id());
978 978
 }
979 979
 
980 980
 /**
@@ -1000,13 +1000,13 @@  discard block
 block discarded – undo
1000 1000
 	 * The Edit Entry functionality overrides this value.
1001 1001
 	 * @param boolean $is_edit_entry
1002 1002
 	 */
1003
-	$is_edit_entry = apply_filters( 'gravityview_is_edit_entry', false );
1003
+	$is_edit_entry = apply_filters('gravityview_is_edit_entry', false);
1004 1004
 
1005
-	if( $is_edit_entry ) {
1005
+	if ($is_edit_entry) {
1006 1006
 		$context = 'edit';
1007
-	} else if( class_exists( 'GravityView_frontend' ) && $single = GravityView_frontend::is_single_entry() ) {
1007
+	} else if (class_exists('GravityView_frontend') && $single = GravityView_frontend::is_single_entry()) {
1008 1008
 		$context = 'single';
1009
-	} else if( class_exists( 'GravityView_View' ) ) {
1009
+	} else if (class_exists('GravityView_View')) {
1010 1010
 		$context = GravityView_View::getInstance()->getContext();
1011 1011
 	}
1012 1012
 
@@ -1031,18 +1031,18 @@  discard block
 block discarded – undo
1031 1031
  * @param  string $gv_class Field class to add to the output HTML
1032 1032
  * @return array           Array of file output, with `file_path` and `html` keys (see comments above)
1033 1033
  */
1034
-function gravityview_get_files_array( $value, $gv_class = '' ) {
1034
+function gravityview_get_files_array($value, $gv_class = '') {
1035 1035
 	/** @define "GRAVITYVIEW_DIR" "../" */
1036 1036
 
1037
-	if( !class_exists( 'GravityView_Field' ) ) {
1038
-		include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field.php' );
1037
+	if (!class_exists('GravityView_Field')) {
1038
+		include_once(GRAVITYVIEW_DIR.'includes/fields/class-gravityview-field.php');
1039 1039
 	}
1040 1040
 
1041
-	if( !class_exists( 'GravityView_Field_FileUpload' ) ) {
1042
-		include_once( GRAVITYVIEW_DIR .'includes/fields/fileupload.php' );
1041
+	if (!class_exists('GravityView_Field_FileUpload')) {
1042
+		include_once(GRAVITYVIEW_DIR.'includes/fields/fileupload.php');
1043 1043
 	}
1044 1044
 
1045
-	return GravityView_Field_FileUpload::get_files_array( $value, $gv_class );
1045
+	return GravityView_Field_FileUpload::get_files_array($value, $gv_class);
1046 1046
 }
1047 1047
 
1048 1048
 /**
@@ -1056,16 +1056,16 @@  discard block
 block discarded – undo
1056 1056
  * @param  string $address Address
1057 1057
  * @return string          URL of link to map of address
1058 1058
  */
1059
-function gravityview_get_map_link( $address ) {
1059
+function gravityview_get_map_link($address) {
1060 1060
 
1061
-	$address_qs = str_replace( array( '<br />', "\n" ), ' ', $address ); // Replace \n with spaces
1062
-	$address_qs = urlencode( $address_qs );
1061
+	$address_qs = str_replace(array('<br />', "\n"), ' ', $address); // Replace \n with spaces
1062
+	$address_qs = urlencode($address_qs);
1063 1063
 
1064 1064
 	$url = "https://maps.google.com/maps?q={$address_qs}";
1065 1065
 
1066
-	$link_text = esc_html__( 'Map It', 'gravityview' );
1066
+	$link_text = esc_html__('Map It', 'gravityview');
1067 1067
 
1068
-	$link = gravityview_get_link( $url, $link_text, 'class=map-it-link' );
1068
+	$link = gravityview_get_link($url, $link_text, 'class=map-it-link');
1069 1069
 
1070 1070
 	/**
1071 1071
 	 * @filter `gravityview_map_link` Modify the map link generated. You can use a different mapping service, for example.
@@ -1073,7 +1073,7 @@  discard block
 block discarded – undo
1073 1073
 	 * @param[in] string $address Address to generate link for
1074 1074
 	 * @param[in] string $url URL generated by the function
1075 1075
 	 */
1076
-	$link = apply_filters( 'gravityview_map_link', $link, $address, $url );
1076
+	$link = apply_filters('gravityview_map_link', $link, $address, $url);
1077 1077
 
1078 1078
 	return $link;
1079 1079
 }
@@ -1094,7 +1094,7 @@  discard block
 block discarded – undo
1094 1094
  * @param  array $passed_args Associative array with field data. `field` and `form` are required.
1095 1095
  * @return string Field output. If empty value and hide empty is true, return empty.
1096 1096
  */
1097
-function gravityview_field_output( $passed_args ) {
1097
+function gravityview_field_output($passed_args) {
1098 1098
 	$defaults = array(
1099 1099
 		'entry' => null,
1100 1100
 		'field' => null,
@@ -1106,7 +1106,7 @@  discard block
 block discarded – undo
1106 1106
 		'zone_id' => null,
1107 1107
 	);
1108 1108
 
1109
-	$args = wp_parse_args( $passed_args, $defaults );
1109
+	$args = wp_parse_args($passed_args, $defaults);
1110 1110
 
1111 1111
 	/**
1112 1112
 	 * @filter `gravityview/field_output/args` Modify the args before generation begins
@@ -1114,15 +1114,15 @@  discard block
 block discarded – undo
1114 1114
 	 * @param array $args Associative array; `field` and `form` is required.
1115 1115
 	 * @param array $passed_args Original associative array with field data. `field` and `form` are required.
1116 1116
 	 */
1117
-	$args = apply_filters( 'gravityview/field_output/args', $args, $passed_args );
1117
+	$args = apply_filters('gravityview/field_output/args', $args, $passed_args);
1118 1118
 
1119 1119
 	// Required fields.
1120
-	if ( empty( $args['field'] ) || empty( $args['form'] ) ) {
1121
-		do_action( 'gravityview_log_error', '[gravityview_field_output] Field or form are empty.', $args );
1120
+	if (empty($args['field']) || empty($args['form'])) {
1121
+		do_action('gravityview_log_error', '[gravityview_field_output] Field or form are empty.', $args);
1122 1122
 		return '';
1123 1123
 	}
1124 1124
 
1125
-	$entry = empty( $args['entry'] ) ? array() : $args['entry'];
1125
+	$entry = empty($args['entry']) ? array() : $args['entry'];
1126 1126
 
1127 1127
 	/**
1128 1128
 	 * Create the content variables for replacing.
@@ -1138,36 +1138,36 @@  discard block
 block discarded – undo
1138 1138
 		'field_id' => '',
1139 1139
 	);
1140 1140
 
1141
-	$context['value'] = gv_value( $entry, $args['field'] );
1141
+	$context['value'] = gv_value($entry, $args['field']);
1142 1142
 
1143 1143
 	// If the value is empty and we're hiding empty, return empty.
1144
-	if ( $context['value'] === '' && ! empty( $args['hide_empty'] ) ) {
1144
+	if ($context['value'] === '' && !empty($args['hide_empty'])) {
1145 1145
 		return '';
1146 1146
 	}
1147 1147
 
1148
-	if ( $context['value'] !== '' && ! empty( $args['wpautop'] ) ) {
1149
-		$context['value'] = wpautop( $context['value'] );
1148
+	if ($context['value'] !== '' && !empty($args['wpautop'])) {
1149
+		$context['value'] = wpautop($context['value']);
1150 1150
 	}
1151 1151
 
1152 1152
 	// Get width setting, if exists
1153
-	$context['width'] = GravityView_API::field_width( $args['field'] );
1153
+	$context['width'] = GravityView_API::field_width($args['field']);
1154 1154
 
1155 1155
 	// If replacing with CSS inline formatting, let's do it.
1156
-	$context['width:style'] = GravityView_API::field_width( $args['field'], 'width:' . $context['width'] . '%;' );
1156
+	$context['width:style'] = GravityView_API::field_width($args['field'], 'width:'.$context['width'].'%;');
1157 1157
 
1158 1158
 	// Grab the Class using `gv_class`
1159
-	$context['class'] = gv_class( $args['field'], $args['form'], $entry );
1160
-	$context['field_id'] = GravityView_API::field_html_attr_id( $args['field'], $args['form'], $entry );
1159
+	$context['class'] = gv_class($args['field'], $args['form'], $entry);
1160
+	$context['field_id'] = GravityView_API::field_html_attr_id($args['field'], $args['form'], $entry);
1161 1161
 
1162 1162
 	// Get field label if needed
1163
-	if ( ! empty( $args['label_markup'] ) ) {
1164
-		$context['label'] = str_replace( array( '{{label}}', '{{ label }}' ), '<span class="gv-field-label">{{ label_value }}</span>', $args['label_markup'] );
1163
+	if (!empty($args['label_markup'])) {
1164
+		$context['label'] = str_replace(array('{{label}}', '{{ label }}'), '<span class="gv-field-label">{{ label_value }}</span>', $args['label_markup']);
1165 1165
 	}
1166 1166
 
1167 1167
 	// Default Label value
1168
-	$context['label_value'] = gv_label( $args['field'], $entry );
1168
+	$context['label_value'] = gv_label($args['field'], $entry);
1169 1169
 
1170
-	if ( empty( $context['label'] ) && ! empty( $context['label_value'] ) ){
1170
+	if (empty($context['label']) && !empty($context['label_value'])) {
1171 1171
 		$context['label'] = '<span class="gv-field-label">{{ label_value }}</span>';
1172 1172
 	}
1173 1173
 
@@ -1177,37 +1177,37 @@  discard block
 block discarded – undo
1177 1177
 	 * @param string $markup The HTML for the markup
1178 1178
 	 * @param array $args All args for the field output
1179 1179
 	 */
1180
-	$html = apply_filters( 'gravityview/field_output/pre_html', $args['markup'], $args );
1180
+	$html = apply_filters('gravityview/field_output/pre_html', $args['markup'], $args);
1181 1181
 
1182 1182
 	/**
1183 1183
 	 * @filter `gravityview/field_output/open_tag` Modify the opening tags for the template content placeholders
1184 1184
 	 * @since 1.11
1185 1185
 	 * @param string $open_tag Open tag for template content placeholders. Default: `{{`
1186 1186
 	 */
1187
-	$open_tag = apply_filters( 'gravityview/field_output/open_tag', '{{', $args );
1187
+	$open_tag = apply_filters('gravityview/field_output/open_tag', '{{', $args);
1188 1188
 
1189 1189
 	/**
1190 1190
 	 * @filter `gravityview/field_output/close_tag` Modify the closing tags for the template content placeholders
1191 1191
 	 * @since 1.11
1192 1192
 	 * @param string $close_tag Close tag for template content placeholders. Default: `}}`
1193 1193
 	 */
1194
-	$close_tag = apply_filters( 'gravityview/field_output/close_tag', '}}', $args );
1194
+	$close_tag = apply_filters('gravityview/field_output/close_tag', '}}', $args);
1195 1195
 
1196 1196
 	/**
1197 1197
 	 * Loop through each of the tags to replace and replace both `{{tag}}` and `{{ tag }}` with the values
1198 1198
 	 * @since 1.11
1199 1199
 	 */
1200
-	foreach ( $context as $tag => $value ) {
1200
+	foreach ($context as $tag => $value) {
1201 1201
 
1202 1202
 		// If the tag doesn't exist just skip it
1203
-		if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ){
1203
+		if (false === strpos($html, $open_tag.$tag.$close_tag) && false === strpos($html, $open_tag.' '.$tag.' '.$close_tag)) {
1204 1204
 			continue;
1205 1205
 		}
1206 1206
 
1207 1207
 		// Array to search
1208 1208
 		$search = array(
1209
-			$open_tag . $tag . $close_tag,
1210
-			$open_tag . ' ' . $tag . ' ' . $close_tag,
1209
+			$open_tag.$tag.$close_tag,
1210
+			$open_tag.' '.$tag.' '.$close_tag,
1211 1211
 		);
1212 1212
 
1213 1213
 		/**
@@ -1216,26 +1216,26 @@  discard block
 block discarded – undo
1216 1216
 		 * @param string $value The content to be shown instead of the {{tag}} placeholder
1217 1217
 		 * @param array $args Arguments passed to the function
1218 1218
 		 */
1219
-		$value = apply_filters( 'gravityview/field_output/context/' . $tag, $value, $args );
1219
+		$value = apply_filters('gravityview/field_output/context/'.$tag, $value, $args);
1220 1220
 
1221 1221
 		// Finally do the replace
1222
-		$html = str_replace( $search, $value, $html );
1222
+		$html = str_replace($search, $value, $html);
1223 1223
 	}
1224 1224
 
1225 1225
 	/**
1226 1226
 	 * @todo  Depricate `gravityview_field_output`
1227 1227
 	 */
1228
-	$html = apply_filters( 'gravityview_field_output', $html, $args );
1228
+	$html = apply_filters('gravityview_field_output', $html, $args);
1229 1229
 
1230 1230
 	/**
1231 1231
 	 * @filter `gravityview/field_output/html` Modify field HTML output
1232 1232
 	 * @param string $html Existing HTML output
1233 1233
 	 * @param array $args Arguments passed to the function
1234 1234
 	 */
1235
-	$html = apply_filters( 'gravityview/field_output/html', $html, $args );
1235
+	$html = apply_filters('gravityview/field_output/html', $html, $args);
1236 1236
 
1237 1237
 	// Just free up a tiny amount of memory
1238
-	unset( $value, $args, $passed_args, $entry, $context, $search, $open_tag, $tag, $close_tag );
1238
+	unset($value, $args, $passed_args, $entry, $context, $search, $open_tag, $tag, $close_tag);
1239 1239
 
1240 1240
 	return $html;
1241 1241
 }
@@ -1253,18 +1253,18 @@  discard block
 block discarded – undo
1253 1253
  *
1254 1254
  * @return string html attribute or empty string
1255 1255
  */
1256
-function gv_selected( $value, $current, $echo = true, $type = 'selected' ) {
1256
+function gv_selected($value, $current, $echo = true, $type = 'selected') {
1257 1257
 
1258 1258
 	$output = '';
1259
-	if( is_array( $current ) ) {
1260
-		if( in_array( $value, $current ) ) {
1261
-			$output = __checked_selected_helper( true, true, false, $type );
1259
+	if (is_array($current)) {
1260
+		if (in_array($value, $current)) {
1261
+			$output = __checked_selected_helper(true, true, false, $type);
1262 1262
 		}
1263 1263
 	} else {
1264
-		$output = __checked_selected_helper( $value, $current, false, $type );
1264
+		$output = __checked_selected_helper($value, $current, false, $type);
1265 1265
 	}
1266 1266
 
1267
-	if( $echo ) {
1267
+	if ($echo) {
1268 1268
 		echo $output;
1269 1269
 	}
1270 1270
 
Please login to merge, or discard this patch.