Completed
Push — develop ( f15700...b1b2c4 )
by Zack
12:05
created
includes/class-template.php 1 patch
Spacing   +131 added lines, -131 removed lines patch added patch discarded remove patch
@@ -12,12 +12,12 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 /** If this file is called directly, abort. */
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if (!defined('ABSPATH')) {
16 16
 	die;
17 17
 }
18 18
 
19
-if( ! class_exists( 'Gamajo_Template_Loader' ) ) {
20
-	require( GRAVITYVIEW_DIR . 'includes/lib/class-gamajo-template-loader.php' );
19
+if (!class_exists('Gamajo_Template_Loader')) {
20
+	require(GRAVITYVIEW_DIR.'includes/lib/class-gamajo-template-loader.php');
21 21
 }
22 22
 
23 23
 class GravityView_View extends Gamajo_Template_Loader {
@@ -145,9 +145,9 @@  discard block
 block discarded – undo
145 145
 	 * Construct the view object
146 146
 	 * @param  array       $atts Associative array to set the data of
147 147
 	 */
148
-	function __construct( $atts = array() ) {
148
+	function __construct($atts = array()) {
149 149
 
150
-		$atts = wp_parse_args( $atts, array(
150
+		$atts = wp_parse_args($atts, array(
151 151
 			'form_id' => NULL,
152 152
 			'view_id' => NULL,
153 153
 			'fields'  => NULL,
@@ -155,10 +155,10 @@  discard block
 block discarded – undo
155 155
 			'post_id' => NULL,
156 156
 			'form'    => NULL,
157 157
 			'atts'	  => NULL,
158
-		) );
158
+		));
159 159
 
160 160
 		foreach ($atts as $key => $value) {
161
-			if( is_null( $value ) ) {
161
+			if (is_null($value)) {
162 162
 				continue;
163 163
 			}
164 164
 			$this->{$key} = $value;
@@ -166,18 +166,18 @@  discard block
 block discarded – undo
166 166
 
167 167
 
168 168
 		// Add granular overrides
169
-		add_filter( $this->filter_prefix . '_get_template_part', array( $this, 'add_id_specific_templates' ), 10, 3 );
169
+		add_filter($this->filter_prefix.'_get_template_part', array($this, 'add_id_specific_templates'), 10, 3);
170 170
 
171 171
 
172 172
 		// widget logic
173
-		add_action( 'gravityview_before', array( $this, 'render_widget_hooks' ) );
174
-		add_action( 'gravityview_after', array( $this, 'render_widget_hooks' ) );
173
+		add_action('gravityview_before', array($this, 'render_widget_hooks'));
174
+		add_action('gravityview_after', array($this, 'render_widget_hooks'));
175 175
 
176 176
 		/**
177 177
 		 * Clear the current entry after the loop is done
178 178
 		 * @since 1.7.3
179 179
 		 */
180
-		add_action( 'gravityview_footer', array( $this, 'clearCurrentEntry' ), 500 );
180
+		add_action('gravityview_footer', array($this, 'clearCurrentEntry'), 500);
181 181
 
182 182
 		self::$instance = &$this;
183 183
 	}
@@ -187,10 +187,10 @@  discard block
 block discarded – undo
187 187
 	 *
188 188
 	 * @return GravityView_View
189 189
 	 */
190
-	static function getInstance( $passed_post = NULL ) {
190
+	static function getInstance($passed_post = NULL) {
191 191
 
192
-		if( empty( self::$instance ) ) {
193
-			self::$instance = new self( $passed_post );
192
+		if (empty(self::$instance)) {
193
+			self::$instance = new self($passed_post);
194 194
 		}
195 195
 
196 196
 		return self::$instance;
@@ -200,11 +200,11 @@  discard block
 block discarded – undo
200 200
 	 * @param string|null $key The key to a specific attribute of the current field
201 201
 	 * @return array|mixed|null If $key is set and attribute exists at $key, return that. If not set, return NULL. Otherwise, return current field array
202 202
 	 */
203
-	public function getCurrentField( $key = NULL ) {
203
+	public function getCurrentField($key = NULL) {
204 204
 
205
-		if( !empty( $key ) ) {
206
-			if( isset( $this->_current_field[ $key ] ) ) {
207
-				return $this->_current_field[ $key ];
205
+		if (!empty($key)) {
206
+			if (isset($this->_current_field[$key])) {
207
+				return $this->_current_field[$key];
208 208
 			}
209 209
 			return NULL;
210 210
 		}
@@ -212,19 +212,19 @@  discard block
 block discarded – undo
212 212
 		return $this->_current_field;
213 213
 	}
214 214
 
215
-	public function setCurrentFieldSetting( $key, $value ) {
215
+	public function setCurrentFieldSetting($key, $value) {
216 216
 
217
-		if( !empty( $this->_current_field ) ) {
218
-			$this->_current_field['field_settings'][ $key ] = $value;
217
+		if (!empty($this->_current_field)) {
218
+			$this->_current_field['field_settings'][$key] = $value;
219 219
 		}
220 220
 
221 221
 	}
222 222
 
223
-	public function getCurrentFieldSetting( $key ) {
223
+	public function getCurrentFieldSetting($key) {
224 224
 		$settings = $this->getCurrentField('field_settings');
225 225
 
226
-		if( $settings && !empty( $settings[ $key ] ) ) {
227
-			return $settings[ $key ];
226
+		if ($settings && !empty($settings[$key])) {
227
+			return $settings[$key];
228 228
 		}
229 229
 
230 230
 		return NULL;
@@ -233,11 +233,11 @@  discard block
 block discarded – undo
233 233
 	/**
234 234
 	 * @param array $passed_field
235 235
 	 */
236
-	public function setCurrentField( $passed_field ) {
236
+	public function setCurrentField($passed_field) {
237 237
 
238 238
 		$existing_field = $this->getCurrentField();
239 239
 
240
-		$set_field = wp_parse_args( $passed_field, $existing_field );
240
+		$set_field = wp_parse_args($passed_field, $existing_field);
241 241
 
242 242
 		$this->_current_field = $set_field;
243 243
 
@@ -252,11 +252,11 @@  discard block
 block discarded – undo
252 252
 	 * @param string|null $key The key to a specific field in the fields array
253 253
 	 * @return array|mixed|null If $key is set and field exists at $key, return that. If not set, return NULL. Otherwise, return array of fields.
254 254
 	 */
255
-	public function getAtts( $key = NULL ) {
255
+	public function getAtts($key = NULL) {
256 256
 
257
-		if( !empty( $key ) ) {
258
-			if( isset( $this->atts[ $key ] ) ) {
259
-				return $this->atts[ $key ];
257
+		if (!empty($key)) {
258
+			if (isset($this->atts[$key])) {
259
+				return $this->atts[$key];
260 260
 			}
261 261
 			return NULL;
262 262
 		}
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 	/**
268 268
 	 * @param array $atts
269 269
 	 */
270
-	public function setAtts( $atts ) {
270
+	public function setAtts($atts) {
271 271
 		$this->atts = $atts;
272 272
 	}
273 273
 
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 	/**
282 282
 	 * @param array $form
283 283
 	 */
284
-	public function setForm( $form ) {
284
+	public function setForm($form) {
285 285
 		$this->form = $form;
286 286
 	}
287 287
 
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 	/**
296 296
 	 * @param int|null $post_id
297 297
 	 */
298
-	public function setPostId( $post_id ) {
298
+	public function setPostId($post_id) {
299 299
 		$this->post_id = $post_id;
300 300
 	}
301 301
 
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 	/**
310 310
 	 * @param string $context
311 311
 	 */
312
-	public function setContext( $context ) {
312
+	public function setContext($context) {
313 313
 		$this->context = $context;
314 314
 	}
315 315
 
@@ -317,12 +317,12 @@  discard block
 block discarded – undo
317 317
 	 * @param string|null $key The key to a specific field in the fields array
318 318
 	 * @return array|mixed|null If $key is set and field exists at $key, return that. If not set, return NULL. Otherwise, return array of fields.
319 319
 	 */
320
-	public function getFields( $key = null ) {
320
+	public function getFields($key = null) {
321 321
 
322
-		$fields = empty( $this->fields ) ? NULL : $this->fields;
322
+		$fields = empty($this->fields) ? NULL : $this->fields;
323 323
 
324
-		if( $fields && !empty( $key ) ) {
325
-			$fields = isset( $fields[ $key ] ) ? $fields[ $key ] : NULL;
324
+		if ($fields && !empty($key)) {
325
+			$fields = isset($fields[$key]) ? $fields[$key] : NULL;
326 326
 		}
327 327
 
328 328
 		return $fields;
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 	/**
332 332
 	 * @param array $fields
333 333
 	 */
334
-	public function setFields( $fields ) {
334
+	public function setFields($fields) {
335 335
 		$this->fields = $fields;
336 336
 	}
337 337
 
@@ -339,11 +339,11 @@  discard block
 block discarded – undo
339 339
 	 * @param string $key The key to a specific field in the fields array
340 340
 	 * @return array|mixed|null If $key is set and field exists at $key, return that. If not set, return NULL. Otherwise, return array of fields.
341 341
 	 */
342
-	public function getField( $key ) {
342
+	public function getField($key) {
343 343
 
344
-		if( !empty( $key ) ) {
345
-			if( isset( $this->fields[ $key ] ) ) {
346
-				return $this->fields[ $key ];
344
+		if (!empty($key)) {
345
+			if (isset($this->fields[$key])) {
346
+				return $this->fields[$key];
347 347
 			}
348 348
 		}
349 349
 
@@ -354,22 +354,22 @@  discard block
 block discarded – undo
354 354
 	 * @param string $key The key to a specific field in the fields array
355 355
 	 * @param mixed $value The value to set for the field
356 356
 	 */
357
-	public function setField( $key, $value ) {
358
-		$this->fields[ $key ] = $value;
357
+	public function setField($key, $value) {
358
+		$this->fields[$key] = $value;
359 359
 	}
360 360
 
361 361
 	/**
362 362
 	 * @return int
363 363
 	 */
364 364
 	public function getViewId() {
365
-		return absint( $this->view_id );
365
+		return absint($this->view_id);
366 366
 	}
367 367
 
368 368
 	/**
369 369
 	 * @param int $view_id
370 370
 	 */
371
-	public function setViewId( $view_id ) {
372
-		$this->view_id = intval( $view_id );
371
+	public function setViewId($view_id) {
372
+		$this->view_id = intval($view_id);
373 373
 	}
374 374
 
375 375
 	/**
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
 	/**
383 383
 	 * @param int $form_id
384 384
 	 */
385
-	public function setFormId( $form_id ) {
385
+	public function setFormId($form_id) {
386 386
 		$this->form_id = $form_id;
387 387
 	}
388 388
 
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 	/**
397 397
 	 * @param array $entries
398 398
 	 */
399
-	public function setEntries( $entries ) {
399
+	public function setEntries($entries) {
400 400
 		$this->entries = $entries;
401 401
 	}
402 402
 
@@ -410,8 +410,8 @@  discard block
 block discarded – undo
410 410
 	/**
411 411
 	 * @param int $total_entries
412 412
 	 */
413
-	public function setTotalEntries( $total_entries ) {
414
-		$this->total_entries = intval( $total_entries );
413
+	public function setTotalEntries($total_entries) {
414
+		$this->total_entries = intval($total_entries);
415 415
 	}
416 416
 
417 417
 	/**
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 	/**
425 425
 	 * @param array $paging
426 426
 	 */
427
-	public function setPaging( $paging ) {
427
+	public function setPaging($paging) {
428 428
 		$this->paging = $paging;
429 429
 	}
430 430
 
@@ -446,25 +446,25 @@  discard block
 block discarded – undo
446 446
 		$page_size = $paging['page_size'];
447 447
 		$total = $this->getTotalEntries();
448 448
 
449
-		if ( empty( $total ) ) {
450
-			do_action( 'gravityview_log_debug', __METHOD__ . ': No entries. Returning empty array.' );
449
+		if (empty($total)) {
450
+			do_action('gravityview_log_debug', __METHOD__.': No entries. Returning empty array.');
451 451
 
452 452
 			return array();
453 453
 		}
454 454
 
455
-		$first = empty( $offset ) ? 1 : $offset + 1;
455
+		$first = empty($offset) ? 1 : $offset + 1;
456 456
 
457 457
 		// If the page size + starting entry is larger than total, the total is the max.
458
-		$last = ( $offset + $page_size > $total ) ? $total : $offset + $page_size;
458
+		$last = ($offset + $page_size > $total) ? $total : $offset + $page_size;
459 459
 
460 460
 		/**
461 461
 		 * @filter `gravityview_pagination_counts` Modify the displayed pagination numbers
462 462
 		 * @since 1.13
463 463
 		 * @param array $counts Array with $first, $last, $total numbers in that order
464 464
 		 */
465
-		list( $first, $last, $total ) = apply_filters( 'gravityview_pagination_counts', array( $first, $last, $total ) );
465
+		list($first, $last, $total) = apply_filters('gravityview_pagination_counts', array($first, $last, $total));
466 466
 
467
-		return array( 'first' => (int) $first, 'last' => (int) $last, 'total' => (int) $total );
467
+		return array('first' => (int)$first, 'last' => (int)$last, 'total' => (int)$total);
468 468
 	}
469 469
 
470 470
 	/**
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
 	/**
478 478
 	 * @param array $sorting
479 479
 	 */
480
-	public function setSorting( $sorting ) {
480
+	public function setSorting($sorting) {
481 481
 		$this->sorting = $sorting;
482 482
 	}
483 483
 
@@ -486,9 +486,9 @@  discard block
 block discarded – undo
486 486
 	 */
487 487
 	public function getBackLinkLabel() {
488 488
 
489
-		$back_link_label = GravityView_API::replace_variables( $this->back_link_label, $this->getForm(), $this->getCurrentEntry() );
489
+		$back_link_label = GravityView_API::replace_variables($this->back_link_label, $this->getForm(), $this->getCurrentEntry());
490 490
 
491
-		$back_link_label = do_shortcode( $back_link_label );
491
+		$back_link_label = do_shortcode($back_link_label);
492 492
 
493 493
 		return $back_link_label;
494 494
 	}
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 	/**
497 497
 	 * @param string $back_link_label
498 498
 	 */
499
-	public function setBackLinkLabel( $back_link_label ) {
499
+	public function setBackLinkLabel($back_link_label) {
500 500
 		$this->back_link_label = $back_link_label;
501 501
 	}
502 502
 
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
 	/**
511 511
 	 * @param boolean $hide_until_searched
512 512
 	 */
513
-	public function setHideUntilSearched( $hide_until_searched ) {
513
+	public function setHideUntilSearched($hide_until_searched) {
514 514
 		$this->hide_until_searched = $hide_until_searched;
515 515
 	}
516 516
 
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
 	/**
525 525
 	 * @param string $template_part_slug
526 526
 	 */
527
-	public function setTemplatePartSlug( $template_part_slug ) {
527
+	public function setTemplatePartSlug($template_part_slug) {
528 528
 		$this->template_part_slug = $template_part_slug;
529 529
 	}
530 530
 
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
 	/**
539 539
 	 * @param string $template_part_name
540 540
 	 */
541
-	public function setTemplatePartName( $template_part_name ) {
541
+	public function setTemplatePartName($template_part_name) {
542 542
 		$this->template_part_name = $template_part_name;
543 543
 	}
544 544
 
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
 	 */
549 549
 	public function getCurrentEntry() {
550 550
 
551
-		if( in_array( $this->getContext(), array( 'edit', 'single') ) ) {
551
+		if (in_array($this->getContext(), array('edit', 'single'))) {
552 552
 			$entries = $this->getEntries();
553 553
 			$entry = $entries[0];
554 554
 		} else {
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
 		}
557 557
 
558 558
 		/** @since 1.16 Fixes DataTables empty entry issue */
559
-		if ( empty( $entry ) && ! empty( $this->_current_field['entry'] ) ) {
559
+		if (empty($entry) && !empty($this->_current_field['entry'])) {
560 560
 			$entry = $this->_current_field['entry'];
561 561
 		}
562 562
 
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
 	 * @param array $current_entry
568 568
 	 * @return void
569 569
 	 */
570
-	public function setCurrentEntry( $current_entry ) {
570
+	public function setCurrentEntry($current_entry) {
571 571
 		$this->_current_entry = $current_entry;
572 572
 	}
573 573
 
@@ -589,9 +589,9 @@  discard block
 block discarded – undo
589 589
 	 *
590 590
 	 * @return string|null
591 591
 	 */
592
-	public function renderZone( $zone = '', $atts = array() ) {
592
+	public function renderZone($zone = '', $atts = array()) {
593 593
 
594
-		if( empty( $zone ) ) {
594
+		if (empty($zone)) {
595 595
 			do_action('gravityview_log_error', 'GravityView_View[renderZone] No zone defined.');
596 596
 			return NULL;
597 597
 		}
@@ -604,32 +604,32 @@  discard block
 block discarded – undo
604 604
 			'hide_empty' => $this->getAtts('hide_empty'),
605 605
 		);
606 606
 
607
-		$final_atts = wp_parse_args( $atts, $defaults );
607
+		$final_atts = wp_parse_args($atts, $defaults);
608 608
 
609 609
 		$output = '';
610 610
 
611 611
 		$final_atts['zone_id'] = "{$final_atts['context']}_{$final_atts['slug']}-{$zone}";
612 612
 
613
-		$fields = $this->getField( $final_atts['zone_id'] );
613
+		$fields = $this->getField($final_atts['zone_id']);
614 614
 
615 615
 		// Backward compatibility
616
-		if( 'table' === $this->getTemplatePartSlug() ) {
616
+		if ('table' === $this->getTemplatePartSlug()) {
617 617
 			/**
618 618
 			 * Modify the fields displayed in the table
619 619
 			 * @var array
620 620
 			 */
621
-			$fields = apply_filters("gravityview_table_cells", $fields, $this );
621
+			$fields = apply_filters("gravityview_table_cells", $fields, $this);
622 622
 		}
623 623
 
624
-		if( empty( $fields ) ) {
624
+		if (empty($fields)) {
625 625
 			return NULL;
626 626
 		}
627 627
 
628 628
 		$field_output = '';
629
-		foreach ( $fields as $field ) {
629
+		foreach ($fields as $field) {
630 630
 			$final_atts['field'] = $field;
631 631
 
632
-			$field_output .= gravityview_field_output( $final_atts );
632
+			$field_output .= gravityview_field_output($final_atts);
633 633
 		}
634 634
 
635 635
 		/**
@@ -638,17 +638,17 @@  discard block
 block discarded – undo
638 638
 		 * @since 1.7.6
639 639
 		 * @param boolean $hide_empty_zone Default: false
640 640
 		 */
641
-		if( empty( $field_output ) && apply_filters( 'gravityview/render/hide-empty-zone', false ) ) {
641
+		if (empty($field_output) && apply_filters('gravityview/render/hide-empty-zone', false)) {
642 642
 			return NULL;
643 643
 		}
644 644
 
645
-		if( !empty( $final_atts['wrapper_class'] ) ) {
646
-			$output .= '<div class="'.gravityview_sanitize_html_class( $final_atts['wrapper_class'] ).'">';
645
+		if (!empty($final_atts['wrapper_class'])) {
646
+			$output .= '<div class="'.gravityview_sanitize_html_class($final_atts['wrapper_class']).'">';
647 647
 		}
648 648
 
649 649
 		$output .= $field_output;
650 650
 
651
-		if( !empty( $final_atts['wrapper_class'] ) ) {
651
+		if (!empty($final_atts['wrapper_class'])) {
652 652
 			$output .= '</div>';
653 653
 		}
654 654
 
@@ -666,24 +666,24 @@  discard block
 block discarded – undo
666 666
 	 * @see Gamajo_Template_Loader::locate_template()
667 667
 	 * @return null|string NULL: Template not found; String: path to template
668 668
 	 */
669
-	function locate_template( $template_names, $load = false, $require_once = true ) {
669
+	function locate_template($template_names, $load = false, $require_once = true) {
670 670
 
671
-		if( is_string( $template_names ) && isset( $this->located_templates[ $template_names ] ) ) {
671
+		if (is_string($template_names) && isset($this->located_templates[$template_names])) {
672 672
 
673
-			$located = $this->located_templates[ $template_names ];
673
+			$located = $this->located_templates[$template_names];
674 674
 
675 675
 		} else {
676 676
 
677 677
 			// Set $load to always false so we handle it here.
678
-			$located = parent::locate_template( $template_names, false, $require_once );
678
+			$located = parent::locate_template($template_names, false, $require_once);
679 679
 
680
-			if( is_string( $template_names ) ) {
681
-				$this->located_templates[ $template_names ] = $located;
680
+			if (is_string($template_names)) {
681
+				$this->located_templates[$template_names] = $located;
682 682
 			}
683 683
 		}
684 684
 
685
-		if ( $load && $located ) {
686
-			load_template( $located, $require_once );
685
+		if ($load && $located) {
686
+			load_template($located, $require_once);
687 687
 		}
688 688
 
689 689
 		return $located;
@@ -694,8 +694,8 @@  discard block
 block discarded – undo
694 694
 	 * @param  string      $name Key for the data retrieval.
695 695
 	 * @return mixed|null    The stored data.
696 696
 	 */
697
-	public function __get( $name ) {
698
-		if( isset( $this->{$name} ) ) {
697
+	public function __get($name) {
698
+		if (isset($this->{$name} )) {
699 699
 			return $this->{$name};
700 700
 		} else {
701 701
 			return NULL;
@@ -719,47 +719,47 @@  discard block
 block discarded – undo
719 719
 	 *
720 720
 	 * @return array $templates Modified template array, merged with existing $templates values
721 721
 	 */
722
-	function add_id_specific_templates( $templates, $slug, $name ) {
722
+	function add_id_specific_templates($templates, $slug, $name) {
723 723
 
724 724
 		$additional = array();
725 725
 
726 726
 		// form-19-table-body.php
727
-		$additional[] = sprintf( 'form-%d-%s-%s.php', $this->getFormId(), $slug, $name );
727
+		$additional[] = sprintf('form-%d-%s-%s.php', $this->getFormId(), $slug, $name);
728 728
 
729 729
 		// view-3-table-body.php
730
-		$additional[] = sprintf( 'view-%d-%s-%s.php', $this->getViewId(), $slug, $name );
730
+		$additional[] = sprintf('view-%d-%s-%s.php', $this->getViewId(), $slug, $name);
731 731
 
732
-		if( $this->getPostId() ) {
732
+		if ($this->getPostId()) {
733 733
 
734 734
 			// page-19-table-body.php
735
-			$additional[] = sprintf( 'page-%d-%s-%s.php', $this->getPostId(), $slug, $name );
735
+			$additional[] = sprintf('page-%d-%s-%s.php', $this->getPostId(), $slug, $name);
736 736
 		}
737 737
 
738 738
 		// Combine with existing table-body.php and table.php
739
-		$templates = array_merge( $additional, $templates );
739
+		$templates = array_merge($additional, $templates);
740 740
 
741
-		do_action( 'gravityview_log_debug', '[add_id_specific_templates] List of Template Files', $templates );
741
+		do_action('gravityview_log_debug', '[add_id_specific_templates] List of Template Files', $templates);
742 742
 
743 743
 		return $templates;
744 744
 	}
745 745
 
746 746
 	// Load the template
747
-	public function render( $slug, $name, $require_once = true ) {
747
+	public function render($slug, $name, $require_once = true) {
748 748
 
749
-		$this->setTemplatePartSlug( $slug );
749
+		$this->setTemplatePartSlug($slug);
750 750
 
751
-		$this->setTemplatePartName( $name );
751
+		$this->setTemplatePartName($name);
752 752
 
753
-		$template_file = $this->get_template_part( $slug, $name, false );
753
+		$template_file = $this->get_template_part($slug, $name, false);
754 754
 
755
-		do_action( 'gravityview_log_debug', '[render] Rendering Template File', $template_file );
755
+		do_action('gravityview_log_debug', '[render] Rendering Template File', $template_file);
756 756
 
757
-		if( !empty( $template_file) ) {
757
+		if (!empty($template_file)) {
758 758
 
759
-			if ( $require_once ) {
760
-				require_once( $template_file );
759
+			if ($require_once) {
760
+				require_once($template_file);
761 761
 			} else {
762
-				require( $template_file );
762
+				require($template_file);
763 763
 			}
764 764
 
765 765
 		}
@@ -769,19 +769,19 @@  discard block
 block discarded – undo
769 769
 	 *
770 770
 	 * @param $view_id
771 771
 	 */
772
-	public function render_widget_hooks( $view_id ) {
772
+	public function render_widget_hooks($view_id) {
773 773
 
774
-		if( empty( $view_id ) || 'single' == gravityview_get_context() ) {
775
-			do_action( 'gravityview_log_debug', __METHOD__ . ' - Not rendering widgets; single entry' );
774
+		if (empty($view_id) || 'single' == gravityview_get_context()) {
775
+			do_action('gravityview_log_debug', __METHOD__.' - Not rendering widgets; single entry');
776 776
 			return;
777 777
 		}
778 778
 
779
-		$view_data = gravityview_get_current_view_data( $view_id );
779
+		$view_data = gravityview_get_current_view_data($view_id);
780 780
 
781 781
 		// get View widget configuration
782 782
 		$widgets = (array)$view_data['widgets'];
783 783
 
784
-		switch( current_filter() ) {
784
+		switch (current_filter()) {
785 785
 			default:
786 786
 			case 'gravityview_before':
787 787
 				$zone = 'header';
@@ -795,10 +795,10 @@  discard block
 block discarded – undo
795 795
 		 * Filter widgets not in the current zone
796 796
 		 * @since 1.16
797 797
 		 */
798
-		foreach( $widgets as $key => $widget ) {
798
+		foreach ($widgets as $key => $widget) {
799 799
 			// The widget isn't in the current zone
800
-			if( false === strpos( $key, $zone ) ) {
801
-				unset( $widgets[ $key ] );
800
+			if (false === strpos($key, $zone)) {
801
+				unset($widgets[$key]);
802 802
 			}
803 803
 		}
804 804
 
@@ -806,37 +806,37 @@  discard block
 block discarded – undo
806 806
 		 * Prevent output if no widgets to show.
807 807
 		 * @since 1.16
808 808
 		 */
809
-		if ( empty( $widgets ) ) {
810
-			do_action( 'gravityview_log_debug', sprintf( 'No widgets for View #%s', $view_id ) );
809
+		if (empty($widgets)) {
810
+			do_action('gravityview_log_debug', sprintf('No widgets for View #%s', $view_id));
811 811
 			return;
812 812
 		}
813 813
 
814 814
 		// Prevent being called twice
815
-		if( did_action( $zone.'_'.$view_id.'_widgets' ) ) {
816
-			do_action( 'gravityview_log_debug', sprintf( '%s - Not rendering %s; already rendered', __METHOD__ , $zone.'_'.$view_id.'_widgets' ) );
815
+		if (did_action($zone.'_'.$view_id.'_widgets')) {
816
+			do_action('gravityview_log_debug', sprintf('%s - Not rendering %s; already rendered', __METHOD__, $zone.'_'.$view_id.'_widgets'));
817 817
 			return;
818 818
 		}
819 819
 
820 820
 		$rows = GravityView_Plugin::get_default_widget_areas();
821 821
 
822 822
 		// TODO: Move to sep. method, use an action instead
823
-		wp_enqueue_style( 'gravityview_default_style' );
823
+		wp_enqueue_style('gravityview_default_style');
824 824
 
825 825
 		// TODO Convert to partials
826 826
 		?>
827 827
 		<div class="gv-grid">
828 828
 			<?php
829
-			foreach( $rows as $row ) {
830
-				foreach( $row as $col => $areas ) {
829
+			foreach ($rows as $row) {
830
+				foreach ($row as $col => $areas) {
831 831
 					$column = ($col == '2-2') ? '1-2 gv-right' : $col.' gv-left';
832 832
 				?>
833
-					<div class="gv-grid-col-<?php echo esc_attr( $column ); ?>">
833
+					<div class="gv-grid-col-<?php echo esc_attr($column); ?>">
834 834
 						<?php
835
-						if( !empty( $areas ) ) {
836
-							foreach( $areas as $area ) {
837
-								if( !empty( $widgets[ $zone .'_'. $area['areaid'] ] ) ) {
838
-									foreach( $widgets[ $zone .'_'. $area['areaid'] ] as $widget ) {
839
-										do_action( "gravityview_render_widget_{$widget['id']}", $widget );
835
+						if (!empty($areas)) {
836
+							foreach ($areas as $area) {
837
+								if (!empty($widgets[$zone.'_'.$area['areaid']])) {
838
+									foreach ($widgets[$zone.'_'.$area['areaid']] as $widget) {
839
+										do_action("gravityview_render_widget_{$widget['id']}", $widget);
840 840
 									}
841 841
 								}
842 842
 							}
@@ -852,8 +852,8 @@  discard block
 block discarded – undo
852 852
 		 * Prevent widgets from being called twice.
853 853
 		 * Checking for loop_start prevents themes and plugins that pre-process shortcodes from triggering the action before displaying. Like, ahem, the Divi theme and WordPress SEO plugin
854 854
 		 */
855
-		if( did_action( 'loop_start' ) ) {
856
-			do_action( $zone.'_'.$view_id.'_widgets' );
855
+		if (did_action('loop_start')) {
856
+			do_action($zone.'_'.$view_id.'_widgets');
857 857
 		}
858 858
 	}
859 859
 
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-transaction-id.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
 	var $is_numeric = true;
16 16
 
17
-	var $search_operators = array( 'is', 'isnot' );
17
+	var $search_operators = array('is', 'isnot');
18 18
 
19 19
 	var $group = 'pricing';
20 20
 
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	 * GravityView_Field_Payment_Amount constructor.
25 25
 	 */
26 26
 	public function __construct() {
27
-		$this->label = esc_attr__( 'Transaction ID', 'gravityview' );
27
+		$this->label = esc_attr__('Transaction ID', 'gravityview');
28 28
 		parent::__construct();
29 29
 	}
30 30
 }
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-currency.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
 	var $is_numeric = true;
16 16
 
17
-	var $search_operators = array( 'is', 'isnot' );
17
+	var $search_operators = array('is', 'isnot');
18 18
 
19 19
 	var $group = 'pricing';
20 20
 
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	 * GravityView_Field_Payment_Amount constructor.
25 25
 	 */
26 26
 	public function __construct() {
27
-		$this->label = esc_attr__( 'Currency', 'gravityview' );
27
+		$this->label = esc_attr__('Currency', 'gravityview');
28 28
 		parent::__construct();
29 29
 	}
30 30
 }
Please login to merge, or discard this patch.
includes/helper-functions.php 1 patch
Spacing   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -15,8 +15,8 @@  discard block
 block discarded – undo
15 15
  *
16 16
  * @return bool true: $mixed is *not* an empty string; false: $mixed *is* an empty string
17 17
  */
18
-function gravityview_is_not_empty_string( $mixed = '' ) {
19
-	return ( $mixed !== '' );
18
+function gravityview_is_not_empty_string($mixed = '') {
19
+	return ($mixed !== '');
20 20
 }
21 21
 
22 22
 /**
@@ -32,17 +32,17 @@  discard block
 block discarded – undo
32 32
  *
33 33
  * @return array URL args, if exists. Empty array if not.
34 34
  */
35
-function gravityview_get_permalink_query_args( $id = 0 ) {
35
+function gravityview_get_permalink_query_args($id = 0) {
36 36
 
37
-	$parsed_permalink = parse_url( get_permalink( $id ) );
37
+	$parsed_permalink = parse_url(get_permalink($id));
38 38
 
39
-	$permalink_args =  isset( $parsed_permalink['query'] ) ? $parsed_permalink['query'] : false;
39
+	$permalink_args = isset($parsed_permalink['query']) ? $parsed_permalink['query'] : false;
40 40
 
41
-	if( empty( $permalink_args ) ) {
41
+	if (empty($permalink_args)) {
42 42
 		return array();
43 43
 	}
44 44
 
45
-	parse_str( $permalink_args, $args );
45
+	parse_str($permalink_args, $args);
46 46
 
47 47
 	return $args;
48 48
 }
@@ -60,18 +60,18 @@  discard block
 block discarded – undo
60 60
  *
61 61
  * @return string html attribute or empty string
62 62
  */
63
-function gv_selected( $value, $current, $echo = true, $type = 'selected' ) {
63
+function gv_selected($value, $current, $echo = true, $type = 'selected') {
64 64
 
65 65
 	$output = '';
66
-	if( is_array( $current ) ) {
67
-		if( in_array( $value, $current ) ) {
68
-			$output = __checked_selected_helper( true, true, false, $type );
66
+	if (is_array($current)) {
67
+		if (in_array($value, $current)) {
68
+			$output = __checked_selected_helper(true, true, false, $type);
69 69
 		}
70 70
 	} else {
71
-		$output = __checked_selected_helper( $value, $current, false, $type );
71
+		$output = __checked_selected_helper($value, $current, false, $type);
72 72
 	}
73 73
 
74
-	if( $echo ) {
74
+	if ($echo) {
75 75
 		echo $output;
76 76
 	}
77 77
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 }
80 80
 
81 81
 
82
-if( ! function_exists( 'gravityview_sanitize_html_class' ) ) {
82
+if (!function_exists('gravityview_sanitize_html_class')) {
83 83
 
84 84
 	/**
85 85
 	 * sanitize_html_class doesn't handle spaces (multiple classes). We remedy that.
@@ -90,20 +90,20 @@  discard block
 block discarded – undo
90 90
 	 *
91 91
 	 * @return string            Sanitized CSS string
92 92
 	 */
93
-	function gravityview_sanitize_html_class( $classes ) {
93
+	function gravityview_sanitize_html_class($classes) {
94 94
 
95
-		if ( is_string( $classes ) ) {
96
-			$classes = explode( ' ', $classes );
95
+		if (is_string($classes)) {
96
+			$classes = explode(' ', $classes);
97 97
 		}
98 98
 
99 99
 		// If someone passes something not string or array, we get outta here.
100
-		if ( ! is_array( $classes ) ) {
100
+		if (!is_array($classes)) {
101 101
 			return $classes;
102 102
 		}
103 103
 
104
-		$classes = array_map( 'sanitize_html_class', $classes );
104
+		$classes = array_map('sanitize_html_class', $classes);
105 105
 
106
-		return implode( ' ', $classes );
106
+		return implode(' ', $classes);
107 107
 	}
108 108
 }
109 109
 
@@ -121,9 +121,9 @@  discard block
 block discarded – undo
121 121
  *
122 122
  * @return string Stripped string!
123 123
  */
124
-function gravityview_strip_whitespace( $string ) {
125
-	$string = normalize_whitespace( $string );
126
-	return preg_replace('/[\r\n\t ]+/', ' ', $string );
124
+function gravityview_strip_whitespace($string) {
125
+	$string = normalize_whitespace($string);
126
+	return preg_replace('/[\r\n\t ]+/', ' ', $string);
127 127
 }
128 128
 
129 129
 /**
@@ -136,13 +136,13 @@  discard block
 block discarded – undo
136 136
  * @param mixed $object Pass pseudo-global to the included file
137 137
  * @return string Included file contents
138 138
  */
139
-function gravityview_ob_include( $file_path, $object = NULL ) {
140
-	if( ! file_exists( $file_path ) ) {
141
-		do_action( 'gravityview_log_error', __FUNCTION__ . ': File path does not exist. ', $file_path );
139
+function gravityview_ob_include($file_path, $object = NULL) {
140
+	if (!file_exists($file_path)) {
141
+		do_action('gravityview_log_error', __FUNCTION__.': File path does not exist. ', $file_path);
142 142
 		return '';
143 143
 	}
144 144
 	ob_start();
145
-	include( $file_path );
145
+	include($file_path);
146 146
 	return ob_get_clean();
147 147
 }
148 148
 
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
  */
154 154
 function gravityview_get_floaty() {
155 155
 
156
-	if( function_exists('is_rtl') && is_rtl() ) {
156
+	if (function_exists('is_rtl') && is_rtl()) {
157 157
 		$style = 'margin:10px 10px 10px 0;';
158 158
 		$class = 'alignright';
159 159
 	} else {
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 		$class = 'alignleft';
162 162
 	}
163 163
 
164
-	return '<img src="'.plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ).'" class="'.$class.'" height="87" width="66" alt="The GravityView Astronaut Says:" style="'.$style.'" />';
164
+	return '<img src="'.plugins_url('assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE).'" class="'.$class.'" height="87" width="66" alt="The GravityView Astronaut Says:" style="'.$style.'" />';
165 165
 }
166 166
 
167 167
 /**
@@ -181,21 +181,21 @@  discard block
 block discarded – undo
181 181
  *
182 182
  * @return string Converted number in string format.
183 183
  */
184
-function gravityview_number_format( $number, $decimals = '' ) {
184
+function gravityview_number_format($number, $decimals = '') {
185 185
 	global $wp_locale;
186 186
 
187
-	if( '' === $decimals ) {
187
+	if ('' === $decimals) {
188 188
 
189
-		$decimal_point = isset( $wp_locale ) ? $wp_locale->number_format['decimal_point'] : '.';
189
+		$decimal_point = isset($wp_locale) ? $wp_locale->number_format['decimal_point'] : '.';
190 190
 
191 191
 		/**
192 192
 		 * Calculate the position of the decimal point in the number
193 193
 		 * @see http://stackoverflow.com/a/2430144/480856
194 194
 		 */
195
-		$decimals = strlen( substr( strrchr( $number, $decimal_point ), 1 ) );
195
+		$decimals = strlen(substr(strrchr($number, $decimal_point), 1));
196 196
 	}
197 197
 
198
-	$number = number_format_i18n( $number, (int)$decimals );
198
+	$number = number_format_i18n($number, (int)$decimals);
199 199
 
200 200
 	return $number;
201 201
 }
@@ -209,13 +209,13 @@  discard block
 block discarded – undo
209 209
  * @param  string $value Existing URL
210 210
  * @return string        If parse_url doesn't find a 'host', returns original value. Otherwise, returns formatted link.
211 211
  */
212
-function gravityview_format_link( $value = null ) {
212
+function gravityview_format_link($value = null) {
213 213
 
214 214
 
215
-	$parts = parse_url( $value );
215
+	$parts = parse_url($value);
216 216
 
217 217
 	// No domain? Strange...show the original text.
218
-	if( empty( $parts['host'] ) ) {
218
+	if (empty($parts['host'])) {
219 219
 		return $value;
220 220
 	}
221 221
 
@@ -228,9 +228,9 @@  discard block
 block discarded – undo
228 228
 	 * @param boolean $enable Whether to strip the scheme. Return false to show scheme. (default: true)\n
229 229
 	 * If true: `http://example.com => example.com`
230 230
 	 */
231
-	if( false === apply_filters('gravityview_anchor_text_striphttp', true) ) {
231
+	if (false === apply_filters('gravityview_anchor_text_striphttp', true)) {
232 232
 
233
-		if( isset( $parts['scheme'] ) ) {
233
+		if (isset($parts['scheme'])) {
234 234
 			$return .= $parts['scheme'];
235 235
 		}
236 236
 
@@ -245,10 +245,10 @@  discard block
 block discarded – undo
245 245
 	 * @param boolean $enable Whether to strip www. Return false to show www. (default: true)\n
246 246
 	 * If true: `www.example.com => example.com`
247 247
 	 */
248
-	$strip_www = apply_filters('gravityview_anchor_text_stripwww', true );
248
+	$strip_www = apply_filters('gravityview_anchor_text_stripwww', true);
249 249
 
250
-	if( $strip_www ) {
251
-		$domain = str_replace('www.', '', $domain );
250
+	if ($strip_www) {
251
+		$domain = str_replace('www.', '', $domain);
252 252
 	}
253 253
 
254 254
 	/**
@@ -260,9 +260,9 @@  discard block
 block discarded – undo
260 260
 	 */
261 261
 	$strip_subdomains = apply_filters('gravityview_anchor_text_nosubdomain', true);
262 262
 
263
-	if( $strip_subdomains ) {
263
+	if ($strip_subdomains) {
264 264
 
265
-		$domain = _gravityview_strip_subdomain( $parts['host'] );
265
+		$domain = _gravityview_strip_subdomain($parts['host']);
266 266
 
267 267
 	}
268 268
 
@@ -278,9 +278,9 @@  discard block
 block discarded – undo
278 278
 	 */
279 279
 	$root_only = apply_filters('gravityview_anchor_text_rootonly', true);
280 280
 
281
-	if( empty( $root_only ) ) {
281
+	if (empty($root_only)) {
282 282
 
283
-		if( isset( $parts['path'] ) ) {
283
+		if (isset($parts['path'])) {
284 284
 			$return .= $parts['path'];
285 285
 		}
286 286
 	}
@@ -291,11 +291,11 @@  discard block
 block discarded – undo
291 291
 	 * @param boolean $enable Whether to enable "root only". Return false to show full path. (default: true)\n
292 292
 	 * If true: `http://example.com/?query=example => example.com`
293 293
 	 */
294
-	$strip_query_string = apply_filters('gravityview_anchor_text_noquerystring', true );
294
+	$strip_query_string = apply_filters('gravityview_anchor_text_noquerystring', true);
295 295
 
296
-	if( empty( $strip_query_string ) ) {
296
+	if (empty($strip_query_string)) {
297 297
 
298
-		if( isset( $parts['query'] ) ) {
298
+		if (isset($parts['query'])) {
299 299
 			$return .= '?'.$parts['query'];
300 300
 		}
301 301
 
@@ -311,9 +311,9 @@  discard block
 block discarded – undo
311 311
  * @param  string $domain Domain to check if it's a TLD or subdomain
312 312
  * @return string         Extracted domain if it has a subdomain
313 313
  */
314
-function _gravityview_strip_subdomain( $string_maybe_has_subdomain ) {
314
+function _gravityview_strip_subdomain($string_maybe_has_subdomain) {
315 315
 
316
-	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 ) ) {
316
+	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)) {
317 317
 		return $matches['domain'];
318 318
 	} else {
319 319
 		return $string_maybe_has_subdomain;
@@ -333,37 +333,37 @@  discard block
 block discarded – undo
333 333
  * @param boolean $allow_string_booleans Whether to check if 'yes', 'true' => `true` and 'no', 'false' => `false`
334 334
  * @return boolean        True: empty; false: not empty
335 335
  */
336
-function gv_empty( $value, $zero_is_empty = true, $allow_string_booleans = true ) {
336
+function gv_empty($value, $zero_is_empty = true, $allow_string_booleans = true) {
337 337
 
338
-	if(
339
-		! isset( $value ) // If it's not set, it's empty!
338
+	if (
339
+		!isset($value) // If it's not set, it's empty!
340 340
 		|| false === $value
341 341
 		|| null === $value
342 342
 	    || '' === $value // Empty string
343 343
 		|| array() === $value // Empty array
344
-		|| ( is_object( $value ) && ! get_object_vars( $value ) ) // Empty object
344
+		|| (is_object($value) && !get_object_vars($value)) // Empty object
345 345
 	) {
346 346
 		return true;
347 347
 	}
348 348
 
349
-	if( is_string( $value ) && $allow_string_booleans ) {
349
+	if (is_string($value) && $allow_string_booleans) {
350 350
 
351
-		$value = trim( $value );
352
-		$value = strtolower( $value );
351
+		$value = trim($value);
352
+		$value = strtolower($value);
353 353
 
354
-		if ( in_array( $value, array( 'yes', 'true' ), true ) ) {
354
+		if (in_array($value, array('yes', 'true'), true)) {
355 355
 			$value = true;
356
-		} else if( in_array( $value, array( 'no', 'false' ), true ) ) {
356
+		} else if (in_array($value, array('no', 'false'), true)) {
357 357
 			$value = false;
358 358
 		}
359 359
 	}
360 360
 
361 361
 	// If zero isn't empty, then if $value is a number and it's empty, it's zero. Thus, return false.
362
-	if( ! $zero_is_empty && is_numeric( $value ) && empty( $value ) ) {
362
+	if (!$zero_is_empty && is_numeric($value) && empty($value)) {
363 363
 		return false;
364 364
 	}
365 365
 
366
-	return empty( $value );
366
+	return empty($value);
367 367
 }
368 368
 
369 369
 /**
@@ -376,17 +376,17 @@  discard block
 block discarded – undo
376 376
  *
377 377
  * @return bool True: it's a valid datetime, formatted as expected. False: it's not a date formatted as expected.
378 378
  */
379
-function gravityview_is_valid_datetime( $datetime, $expected_format = 'Y-m-d' ) {
379
+function gravityview_is_valid_datetime($datetime, $expected_format = 'Y-m-d') {
380 380
 
381 381
 	/**
382 382
 	 * @var bool|DateTime False if not a valid date, (like a relative date). DateTime if a date was created.
383 383
 	 */
384
-	$formatted_date = DateTime::createFromFormat( $expected_format, $datetime );
384
+	$formatted_date = DateTime::createFromFormat($expected_format, $datetime);
385 385
 
386 386
 	/**
387 387
 	 * @see http://stackoverflow.com/a/19271434/480856
388 388
 	 */
389
-	return ( $formatted_date && $formatted_date->format( $expected_format ) === $datetime );
389
+	return ($formatted_date && $formatted_date->format($expected_format) === $datetime);
390 390
 }
391 391
 
392 392
 /**
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
  *
405 405
  * @return array Multidimensional array with `text` (Category Name) and `value` (Category ID) keys.
406 406
  */
407
-function gravityview_get_terms_choices( $args = array() ) {
407
+function gravityview_get_terms_choices($args = array()) {
408 408
 
409 409
 	$defaults = array(
410 410
 		'type'         => 'post',
@@ -418,21 +418,21 @@  discard block
 block discarded – undo
418 418
 		'fields'       => 'id=>name',
419 419
 	);
420 420
 
421
-	$args = wp_parse_args( $args, $defaults );
421
+	$args = wp_parse_args($args, $defaults);
422 422
 
423 423
 	/**
424 424
 	 * @filter `gravityview_get_terms_choices_args` Modify the arguments passed to `get_terms()`
425 425
 	 * @see get_terms()
426 426
 	 * @since 1.15.3
427 427
 	 */
428
-	$args = apply_filters( 'gravityview_get_terms_choices_args', $args );
428
+	$args = apply_filters('gravityview_get_terms_choices_args', $args);
429 429
 
430
-	$terms = get_terms( $args['taxonomy'], $args );
430
+	$terms = get_terms($args['taxonomy'], $args);
431 431
 
432 432
 	$choices = array();
433 433
 
434
-	if ( is_array( $terms ) ) {
435
-		foreach ( $terms as $term_id => $term_name ) {
434
+	if (is_array($terms)) {
435
+		foreach ($terms as $term_id => $term_name) {
436 436
 			$choices[] = array(
437 437
 				'text'  => $term_name,
438 438
 				'value' => $term_id
Please login to merge, or discard this patch.
includes/class-frontend-views.php 1 patch
Spacing   +263 added lines, -263 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	 * @since 1.7.4.1
21 21
 	 * @var array
22 22
 	 */
23
-	private static $search_parameters = array( 'gv_search', 'gv_start', 'gv_end', 'gv_id', 'gv_by', 'filter_*' );
23
+	private static $search_parameters = array('gv_search', 'gv_start', 'gv_end', 'gv_id', 'gv_by', 'filter_*');
24 24
 
25 25
 	/**
26 26
 	 * Is the currently viewed post a `gravityview` post type?
@@ -85,18 +85,18 @@  discard block
 block discarded – undo
85 85
 	private function __construct() {}
86 86
 
87 87
 	private function initialize() {
88
-		add_action( 'wp', array( $this, 'parse_content'), 11 );
89
-		add_action( 'template_redirect', array( $this, 'set_entry_data'), 1 );
88
+		add_action('wp', array($this, 'parse_content'), 11);
89
+		add_action('template_redirect', array($this, 'set_entry_data'), 1);
90 90
 
91 91
 		// Enqueue scripts and styles after GravityView_Template::register_styles()
92
-		add_action( 'wp_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 20 );
92
+		add_action('wp_enqueue_scripts', array($this, 'add_scripts_and_styles'), 20);
93 93
 
94 94
 		// Enqueue and print styles in the footer. Added 1 priorty so stuff gets printed at 10 priority.
95
-		add_action( 'wp_print_footer_scripts', array( $this, 'add_scripts_and_styles' ), 1 );
95
+		add_action('wp_print_footer_scripts', array($this, 'add_scripts_and_styles'), 1);
96 96
 
97
-		add_filter( 'the_title', array( $this, 'single_entry_title' ), 1, 2 );
98
-		add_filter( 'the_content', array( $this, 'insert_view_in_content' ) );
99
-		add_filter( 'comments_open', array( $this, 'comments_open' ), 10, 2 );
97
+		add_filter('the_title', array($this, 'single_entry_title'), 1, 2);
98
+		add_filter('the_content', array($this, 'insert_view_in_content'));
99
+		add_filter('comments_open', array($this, 'comments_open'), 10, 2);
100 100
 	}
101 101
 
102 102
 	/**
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	 */
106 106
 	public static function getInstance() {
107 107
 
108
-		if ( empty( self::$instance ) ) {
108
+		if (empty(self::$instance)) {
109 109
 			self::$instance = new self;
110 110
 			self::$instance->initialize();
111 111
 		}
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 	/**
124 124
 	 * @param GravityView_View_Data $gv_output_data
125 125
 	 */
126
-	public function setGvOutputData( $gv_output_data ) {
126
+	public function setGvOutputData($gv_output_data) {
127 127
 		$this->gv_output_data = $gv_output_data;
128 128
 	}
129 129
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	/**
138 138
 	 * @param boolean $is_search
139 139
 	 */
140
-	public function setIsSearch( $is_search ) {
140
+	public function setIsSearch($is_search) {
141 141
 		$this->is_search = $is_search;
142 142
 	}
143 143
 
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 	 * Sets the single entry ID and also the entry
153 153
 	 * @param bool|int $single_entry
154 154
 	 */
155
-	public function setSingleEntry( $single_entry ) {
155
+	public function setSingleEntry($single_entry) {
156 156
 
157 157
 		$this->single_entry = $single_entry;
158 158
 
@@ -169,10 +169,10 @@  discard block
 block discarded – undo
169 169
 	 * Set the current entry
170 170
 	 * @param array|int $entry Entry array or entry ID
171 171
 	 */
172
-	public function setEntry( $entry ) {
172
+	public function setEntry($entry) {
173 173
 
174
-		if ( ! is_array( $entry ) ) {
175
-			$entry = GVCommon::get_entry( $entry );
174
+		if (!is_array($entry)) {
175
+			$entry = GVCommon::get_entry($entry);
176 176
 		}
177 177
 
178 178
 		$this->entry = $entry;
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 	/**
189 189
 	 * @param int $post_id
190 190
 	 */
191
-	public function setPostId( $post_id ) {
191
+	public function setPostId($post_id) {
192 192
 		$this->post_id = $post_id;
193 193
 	}
194 194
 
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 	/**
203 203
 	 * @param boolean $post_has_shortcode
204 204
 	 */
205
-	public function setPostHasShortcode( $post_has_shortcode ) {
205
+	public function setPostHasShortcode($post_has_shortcode) {
206 206
 		$this->post_has_shortcode = $post_has_shortcode;
207 207
 	}
208 208
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 	/**
217 217
 	 * @param boolean $is_gravityview_post_type
218 218
 	 */
219
-	public function setIsGravityviewPostType( $is_gravityview_post_type ) {
219
+	public function setIsGravityviewPostType($is_gravityview_post_type) {
220 220
 		$this->is_gravityview_post_type = $is_gravityview_post_type;
221 221
 	}
222 222
 
@@ -227,13 +227,13 @@  discard block
 block discarded – undo
227 227
 	 *
228 228
 	 * @param null $view_id
229 229
 	 */
230
-	public function set_context_view_id( $view_id = null ) {
230
+	public function set_context_view_id($view_id = null) {
231 231
 
232
-		if ( ! empty( $view_id ) ) {
232
+		if (!empty($view_id)) {
233 233
 
234 234
 			$this->context_view_id = $view_id;
235 235
 
236
-		} elseif ( isset( $_GET['gvid'] ) && $this->getGvOutputData()->has_multiple_views() ) {
236
+		} elseif (isset($_GET['gvid']) && $this->getGvOutputData()->has_multiple_views()) {
237 237
 			/**
238 238
 			 * used on a has_multiple_views context
239 239
 			 * @see GravityView_API::entry_link
@@ -241,10 +241,10 @@  discard block
 block discarded – undo
241 241
 			 */
242 242
 			$this->context_view_id = $_GET['gvid'];
243 243
 
244
-		} elseif ( ! $this->getGvOutputData()->has_multiple_views() )  {
245
-			$array_keys = array_keys( $this->getGvOutputData()->get_views() );
246
-			$this->context_view_id = array_pop( $array_keys );
247
-			unset( $array_keys );
244
+		} elseif (!$this->getGvOutputData()->has_multiple_views()) {
245
+			$array_keys = array_keys($this->getGvOutputData()->get_views());
246
+			$this->context_view_id = array_pop($array_keys);
247
+			unset($array_keys);
248 248
 		}
249 249
 
250 250
 	}
@@ -265,31 +265,31 @@  discard block
 block discarded – undo
265 265
 	 * @param  array  $wp Passed in the `wp` hook. Not used.
266 266
 	 * @return void
267 267
 	 */
268
-	function parse_content( $wp = array() ) {
268
+	function parse_content($wp = array()) {
269 269
 		global $post;
270 270
 
271 271
 		// If in admin and NOT AJAX request, get outta here.
272
-		if ( GravityView_Plugin::is_admin() )  {
272
+		if (GravityView_Plugin::is_admin()) {
273 273
 			return;
274 274
 		}
275 275
 
276 276
 		// Calculate requested Views
277
-		$this->setGvOutputData( GravityView_View_Data::getInstance( $post ) );
277
+		$this->setGvOutputData(GravityView_View_Data::getInstance($post));
278 278
 
279 279
 		// !important: we need to run this before getting single entry (to kick the advanced filter)
280 280
 		$this->set_context_view_id();
281 281
 
282
-		$this->setIsGravityviewPostType( get_post_type( $post ) === 'gravityview' );
282
+		$this->setIsGravityviewPostType(get_post_type($post) === 'gravityview');
283 283
 
284
-		$post_id = $this->getPostId() ? $this->getPostId() : (isset( $post ) ? $post->ID : null );
285
-		$this->setPostId( $post_id );
286
-		$post_has_shortcode = ! empty( $post->post_content ) ? gravityview_has_shortcode_r( $post->post_content, 'gravityview' ) : false;
287
-		$this->setPostHasShortcode( $this->isGravityviewPostType() ? null : ! empty( $post_has_shortcode ) );
284
+		$post_id = $this->getPostId() ? $this->getPostId() : (isset($post) ? $post->ID : null);
285
+		$this->setPostId($post_id);
286
+		$post_has_shortcode = !empty($post->post_content) ? gravityview_has_shortcode_r($post->post_content, 'gravityview') : false;
287
+		$this->setPostHasShortcode($this->isGravityviewPostType() ? null : !empty($post_has_shortcode));
288 288
 
289 289
 		// check if the View is showing search results (only for multiple entries View)
290
-		$this->setIsSearch( $this->is_searching() );
290
+		$this->setIsSearch($this->is_searching());
291 291
 
292
-		unset( $entry, $post_id, $post_has_shortcode );
292
+		unset($entry, $post_id, $post_has_shortcode);
293 293
 	}
294 294
 
295 295
 	/**
@@ -297,8 +297,8 @@  discard block
 block discarded – undo
297 297
 	 */
298 298
 	function set_entry_data() {
299 299
 		$entry_id = self::is_single_entry();
300
-		$this->setSingleEntry( $entry_id );
301
-		$this->setEntry( $entry_id );
300
+		$this->setSingleEntry($entry_id);
301
+		$this->setEntry($entry_id);
302 302
 	}
303 303
 
304 304
 	/**
@@ -311,31 +311,31 @@  discard block
 block discarded – undo
311 311
 	function is_searching() {
312 312
 
313 313
 		// It's a single entry, not search
314
-		if ( $this->getSingleEntry() ) {
314
+		if ($this->getSingleEntry()) {
315 315
 			return false;
316 316
 		}
317 317
 
318 318
 		// No $_GET parameters
319
-		if ( empty( $_GET ) || ! is_array( $_GET ) ) {
319
+		if (empty($_GET) || !is_array($_GET)) {
320 320
 			return false;
321 321
 		}
322 322
 
323 323
 		// Remove empty values
324
-		$get = array_filter( $_GET );
324
+		$get = array_filter($_GET);
325 325
 
326 326
 		// If the $_GET parameters are empty, it's no search.
327
-		if ( empty( $get ) ) {
327
+		if (empty($get)) {
328 328
 			return false;
329 329
 		}
330 330
 
331
-		$search_keys = array_keys( $get );
331
+		$search_keys = array_keys($get);
332 332
 
333
-		$search_match = implode( '|', self::$search_parameters );
333
+		$search_match = implode('|', self::$search_parameters);
334 334
 
335
-		foreach ( $search_keys as $search_key ) {
335
+		foreach ($search_keys as $search_key) {
336 336
 
337 337
 			// Analyze the search key $_GET parameter and see if it matches known GV args
338
-			if ( preg_match( '/(' . $search_match . ')/i', $search_key ) ) {
338
+			if (preg_match('/('.$search_match.')/i', $search_key)) {
339 339
 				return true;
340 340
 			}
341 341
 		}
@@ -350,11 +350,11 @@  discard block
 block discarded – undo
350 350
 	 * @param  int $passed_post_id Post ID
351 351
 	 * @return string          (modified) title
352 352
 	 */
353
-	public function single_entry_title( $title, $passed_post_id = null ) {
353
+	public function single_entry_title($title, $passed_post_id = null) {
354 354
 		global $post;
355 355
 
356 356
 		// If this is the directory view, return.
357
-		if ( ! $this->getSingleEntry() ) {
357
+		if (!$this->getSingleEntry()) {
358 358
 			return $title;
359 359
 		}
360 360
 
@@ -365,44 +365,44 @@  discard block
 block discarded – undo
365 365
 		 * @param boolean $in_the_loop Whether to apply the filter to the menu title and the meta tag <title> - outside the loop
366 366
 		 * @param array $entry Current entry
367 367
 		 */
368
-		$apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop' , in_the_loop(), $entry );
368
+		$apply_outside_loop = apply_filters('gravityview/single/title/out_loop', in_the_loop(), $entry);
369 369
 
370
-		if ( ! $apply_outside_loop ) {
370
+		if (!$apply_outside_loop) {
371 371
 			return $title;
372 372
 		}
373 373
 
374 374
 		// User reported WooCommerce doesn't pass two args.
375
-		if ( empty( $passed_post_id ) )  {
375
+		if (empty($passed_post_id)) {
376 376
 			return $title;
377 377
 		}
378 378
 
379 379
 		// Don't modify the title for anything other than the current view/post.
380 380
 		// This is true for embedded shortcodes and Views.
381
-		if ( is_object( $post ) && (int) $post->ID !== (int) $passed_post_id ) {
381
+		if (is_object($post) && (int)$post->ID !== (int)$passed_post_id) {
382 382
 			return $title;
383 383
 		}
384 384
 
385 385
 		$context_view_id = $this->get_context_view_id();
386 386
 
387
-		if ( $this->getGvOutputData()->has_multiple_views() && ! empty( $context_view_id ) ) {
388
-			$view_meta = $this->getGvOutputData()->get_view( $context_view_id );
387
+		if ($this->getGvOutputData()->has_multiple_views() && !empty($context_view_id)) {
388
+			$view_meta = $this->getGvOutputData()->get_view($context_view_id);
389 389
 		} else {
390
-			foreach ( $this->getGvOutputData()->get_views() as $view_id => $view_data ) {
391
-				if ( intval( $view_data['form_id'] ) === intval( $entry['form_id'] ) ) {
390
+			foreach ($this->getGvOutputData()->get_views() as $view_id => $view_data) {
391
+				if (intval($view_data['form_id']) === intval($entry['form_id'])) {
392 392
 					$view_meta = $view_data;
393 393
 					break;
394 394
 				}
395 395
 			}
396 396
 		}
397 397
 
398
-		if ( ! empty( $view_meta['atts']['single_title'] ) ) {
398
+		if (!empty($view_meta['atts']['single_title'])) {
399 399
 
400 400
 			$title = $view_meta['atts']['single_title'];
401 401
 
402 402
 			// We are allowing HTML in the fields, so no escaping the output
403
-			$title = GravityView_API::replace_variables( $title, $view_meta['form'], $entry );
403
+			$title = GravityView_API::replace_variables($title, $view_meta['form'], $entry);
404 404
 
405
-			$title = do_shortcode( $title );
405
+			$title = do_shortcode($title);
406 406
 		}
407 407
 
408 408
 		return $title;
@@ -417,38 +417,38 @@  discard block
 block discarded – undo
417 417
 	 * @param mixed $content
418 418
 	 * @return string Add the View output into View CPT content
419 419
 	 */
420
-	public function insert_view_in_content( $content ) {
420
+	public function insert_view_in_content($content) {
421 421
 
422 422
 		// Plugins may run through the content in the header. WP SEO does this for its OpenGraph functionality.
423
-		if ( ! did_action( 'loop_start' ) ) {
423
+		if (!did_action('loop_start')) {
424 424
 
425
-			do_action( 'gravityview_log_debug', '[insert_view_in_content] Not processing yet: loop_start hasn\'t run yet. Current action:', current_filter() );
425
+			do_action('gravityview_log_debug', '[insert_view_in_content] Not processing yet: loop_start hasn\'t run yet. Current action:', current_filter());
426 426
 
427 427
 			return $content;
428 428
 		}
429 429
 
430 430
 		//	We don't want this filter to run infinite loop on any post content fields
431
-		remove_filter( 'the_content', array( $this, 'insert_view_in_content' ) );
431
+		remove_filter('the_content', array($this, 'insert_view_in_content'));
432 432
 
433 433
 		// Otherwise, this is called on the Views page when in Excerpt mode.
434
-		if ( is_admin() ) {
434
+		if (is_admin()) {
435 435
 			return $content;
436 436
 		}
437 437
 
438
-		if ( $this->isGravityviewPostType() ) {
438
+		if ($this->isGravityviewPostType()) {
439 439
 
440 440
 			/** @since 1.7.4 */
441
-			if ( is_preview() && ! gravityview_get_form_id( $this->post_id ) ) {
442
-				$content .= __( 'When using a Start Fresh template, you must save the View before a Preview is available.', 'gravityview' );
441
+			if (is_preview() && !gravityview_get_form_id($this->post_id)) {
442
+				$content .= __('When using a Start Fresh template, you must save the View before a Preview is available.', 'gravityview');
443 443
 			} else {
444
-				foreach ( $this->getGvOutputData()->get_views() as $view_id => $data ) {
445
-					$content .= $this->render_view( array( 'id' => $view_id ) );
444
+				foreach ($this->getGvOutputData()->get_views() as $view_id => $data) {
445
+					$content .= $this->render_view(array('id' => $view_id));
446 446
 				}
447 447
 			}
448 448
 		}
449 449
 
450 450
 		//	Add the filter back in
451
-		add_filter( 'the_content', array( $this, 'insert_view_in_content' ) );
451
+		add_filter('the_content', array($this, 'insert_view_in_content'));
452 452
 
453 453
 		return $content;
454 454
 	}
@@ -459,9 +459,9 @@  discard block
 block discarded – undo
459 459
 	 * @param  int $post_id Post ID
460 460
 	 * @return boolean
461 461
 	 */
462
-	public function comments_open( $open, $post_id ) {
462
+	public function comments_open($open, $post_id) {
463 463
 
464
-		if ( $this->isGravityviewPostType() ) {
464
+		if ($this->isGravityviewPostType()) {
465 465
 			$open = false;
466 466
 		}
467 467
 
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
 		 * @param  boolean $open Open or closed status
472 472
 		 * @param  int $post_id Post ID to set comment status for
473 473
 		 */
474
-		$open = apply_filters( 'gravityview/comments_open', $open, $post_id );
474
+		$open = apply_filters('gravityview/comments_open', $open, $post_id);
475 475
 
476 476
 		return $open;
477 477
 	}
@@ -498,55 +498,55 @@  discard block
 block discarded – undo
498 498
 	 *
499 499
 	 * @return string|null HTML output of a View, NULL if View isn't found
500 500
 	 */
501
-	public function render_view( $passed_args ) {
501
+	public function render_view($passed_args) {
502 502
 
503 503
 		// validate attributes
504
-		if ( empty( $passed_args['id'] ) ) {
505
-			do_action( 'gravityview_log_error', '[render_view] Returning; no ID defined.', $passed_args );
504
+		if (empty($passed_args['id'])) {
505
+			do_action('gravityview_log_error', '[render_view] Returning; no ID defined.', $passed_args);
506 506
 			return null;
507 507
 		}
508 508
 
509 509
 		// Solve problem when loading content via admin-ajax.php
510 510
 		// @hack
511
-		if ( ! $this->getGvOutputData() ) {
511
+		if (!$this->getGvOutputData()) {
512 512
 
513
-			do_action( 'gravityview_log_error', '[render_view] gv_output_data not defined; parsing content.', $passed_args );
513
+			do_action('gravityview_log_error', '[render_view] gv_output_data not defined; parsing content.', $passed_args);
514 514
 
515 515
 			$this->parse_content();
516 516
 		}
517 517
 
518 518
 		// Make 100% sure that we're dealing with a properly called situation
519
-		if ( ! is_object( $this->getGvOutputData() ) || ! is_callable( array( $this->getGvOutputData(), 'get_view' ) ) ) {
519
+		if (!is_object($this->getGvOutputData()) || !is_callable(array($this->getGvOutputData(), 'get_view'))) {
520 520
 
521
-			do_action( 'gravityview_log_error', '[render_view] gv_output_data not an object or get_view not callable.', $this->getGvOutputData() );
521
+			do_action('gravityview_log_error', '[render_view] gv_output_data not an object or get_view not callable.', $this->getGvOutputData());
522 522
 
523 523
 			return null;
524 524
 		}
525 525
 
526 526
 		$view_id = $passed_args['id'];
527 527
 
528
-		$view_data = $this->getGvOutputData()->get_view( $view_id, $passed_args );
528
+		$view_data = $this->getGvOutputData()->get_view($view_id, $passed_args);
529 529
 
530
-		do_action( 'gravityview_log_debug', '[render_view] View Data: ', $view_data );
530
+		do_action('gravityview_log_debug', '[render_view] View Data: ', $view_data);
531 531
 
532
-		do_action( 'gravityview_log_debug', '[render_view] Init View. Arguments: ', $passed_args );
532
+		do_action('gravityview_log_debug', '[render_view] Init View. Arguments: ', $passed_args);
533 533
 
534 534
 		// The passed args were always winning, even if they were NULL.
535 535
 		// This prevents that. Filters NULL, FALSE, and empty strings.
536
-		$passed_args = array_filter( $passed_args, 'strlen' );
536
+		$passed_args = array_filter($passed_args, 'strlen');
537 537
 
538 538
 		//Override shortcode args over View template settings
539
-		$atts = wp_parse_args( $passed_args, $view_data['atts'] );
539
+		$atts = wp_parse_args($passed_args, $view_data['atts']);
540 540
 
541
-		do_action( 'gravityview_log_debug', '[render_view] Arguments after merging with View settings: ', $atts );
541
+		do_action('gravityview_log_debug', '[render_view] Arguments after merging with View settings: ', $atts);
542 542
 
543 543
 		// It's password protected and you need to log in.
544
-		if ( post_password_required( $view_id ) ) {
544
+		if (post_password_required($view_id)) {
545 545
 
546
-			do_action( 'gravityview_log_error', sprintf( '[render_view] Returning: View %d is password protected.', $view_id ) );
546
+			do_action('gravityview_log_error', sprintf('[render_view] Returning: View %d is password protected.', $view_id));
547 547
 
548 548
 			// If we're in an embed or on an archive page, show the password form
549
-			if ( get_the_ID() !== $view_id ) {
549
+			if (get_the_ID() !== $view_id) {
550 550
 				return get_the_password_form();
551 551
 			}
552 552
 
@@ -558,11 +558,11 @@  discard block
 block discarded – undo
558 558
 		 * Don't render View if user isn't allowed to see it
559 559
 		 * @since 1.15
560 560
 		 */
561
-		if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) {
561
+		if (is_user_logged_in() && false === GVCommon::has_cap('read_gravityview', $view_id)) {
562 562
 			return null;
563 563
 		}
564 564
 
565
-		if( $this->isGravityviewPostType() ) {
565
+		if ($this->isGravityviewPostType()) {
566 566
 
567 567
 			/**
568 568
 			 * @filter `gravityview_direct_access` Should Views be directly accessible, or only visible using the shortcode?
@@ -572,12 +572,12 @@  discard block
 block discarded – undo
572 572
 			 * @param[in,out] boolean `true`: allow Views to be accessible directly. `false`: Only allow Views to be embedded via shortcode. Default: `true`
573 573
 			 * @param int $view_id The ID of the View currently being requested. `0` for general setting
574 574
 			 */
575
-			$direct_access = apply_filters( 'gravityview_direct_access', true, $view_id );
575
+			$direct_access = apply_filters('gravityview_direct_access', true, $view_id);
576 576
 
577
-			$embed_only = ! empty( $atts['embed_only'] );
577
+			$embed_only = !empty($atts['embed_only']);
578 578
 
579
-			if( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) {
580
-				return __( 'You are not allowed to view this content.', 'gravityview' );
579
+			if (!$direct_access || ($embed_only && !GVCommon::has_cap('read_private_gravityviews'))) {
580
+				return __('You are not allowed to view this content.', 'gravityview');
581 581
 			}
582 582
 		}
583 583
 
@@ -589,137 +589,137 @@  discard block
 block discarded – undo
589 589
 		 */
590 590
 		global $gravityview_view;
591 591
 
592
-		$gravityview_view = new GravityView_View( $view_data );
592
+		$gravityview_view = new GravityView_View($view_data);
593 593
 
594
-		$post_id = ! empty( $atts['post_id'] ) ? intval( $atts['post_id'] ) : $this->getPostId();
594
+		$post_id = !empty($atts['post_id']) ? intval($atts['post_id']) : $this->getPostId();
595 595
 
596
-		$gravityview_view->setPostId( $post_id );
596
+		$gravityview_view->setPostId($post_id);
597 597
 
598
-		if ( ! $this->getSingleEntry() ) {
598
+		if (!$this->getSingleEntry()) {
599 599
 
600 600
 			// user requested Directory View
601
-			do_action( 'gravityview_log_debug', '[render_view] Executing Directory View' );
601
+			do_action('gravityview_log_debug', '[render_view] Executing Directory View');
602 602
 
603 603
 			//fetch template and slug
604
-			$view_slug = apply_filters( 'gravityview_template_slug_'. $view_data['template_id'], 'table', 'directory' );
604
+			$view_slug = apply_filters('gravityview_template_slug_'.$view_data['template_id'], 'table', 'directory');
605 605
 
606
-			do_action( 'gravityview_log_debug', '[render_view] View template slug: ', $view_slug );
606
+			do_action('gravityview_log_debug', '[render_view] View template slug: ', $view_slug);
607 607
 
608 608
 			/**
609 609
 			 * Disable fetching initial entries for views that don't need it (DataTables)
610 610
 			 */
611
-			$get_entries = apply_filters( 'gravityview_get_view_entries_'.$view_slug, true );
611
+			$get_entries = apply_filters('gravityview_get_view_entries_'.$view_slug, true);
612 612
 
613 613
 			/**
614 614
 			 * Hide View data until search is performed
615 615
 			 * @since 1.5.4
616 616
 			 */
617
-			if ( ! empty( $atts['hide_until_searched'] ) && ! $this->isSearch() ) {
618
-				$gravityview_view->setHideUntilSearched( true );
617
+			if (!empty($atts['hide_until_searched']) && !$this->isSearch()) {
618
+				$gravityview_view->setHideUntilSearched(true);
619 619
 				$get_entries = false;
620 620
 			}
621 621
 
622 622
 
623
-			if ( $get_entries ) {
623
+			if ($get_entries) {
624 624
 
625
-				if ( ! empty( $atts['sort_columns'] ) ) {
625
+				if (!empty($atts['sort_columns'])) {
626 626
 					// add filter to enable column sorting
627
-					add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ) , 100, 3 );
627
+					add_filter('gravityview/template/field_label', array($this, 'add_columns_sort_links'), 100, 3);
628 628
 				}
629 629
 
630
-				$view_entries = self::get_view_entries( $atts, $view_data['form_id'] );
630
+				$view_entries = self::get_view_entries($atts, $view_data['form_id']);
631 631
 
632
-				do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries['count'], sizeof( $view_entries['entries'] ) ) );
632
+				do_action('gravityview_log_debug', sprintf('[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries['count'], sizeof($view_entries['entries'])));
633 633
 
634 634
 			} else {
635 635
 
636
-				$view_entries = array( 'count' => null, 'entries' => null, 'paging' => null );
636
+				$view_entries = array('count' => null, 'entries' => null, 'paging' => null);
637 637
 
638
-				do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_'.$view_slug.'` is false' );
638
+				do_action('gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_'.$view_slug.'` is false');
639 639
 			}
640 640
 
641
-			$gravityview_view->setPaging( $view_entries['paging'] );
642
-			$gravityview_view->setContext( 'directory' );
643
-			$sections = array( 'header', 'body', 'footer' );
641
+			$gravityview_view->setPaging($view_entries['paging']);
642
+			$gravityview_view->setContext('directory');
643
+			$sections = array('header', 'body', 'footer');
644 644
 
645 645
 		} else {
646 646
 
647 647
 			// user requested Single Entry View
648
-			do_action( 'gravityview_log_debug', '[render_view] Executing Single View' );
648
+			do_action('gravityview_log_debug', '[render_view] Executing Single View');
649 649
 
650
-			do_action( 'gravityview_render_entry_'.$view_data['id'] );
650
+			do_action('gravityview_render_entry_'.$view_data['id']);
651 651
 
652 652
 			$entry = $this->getEntry();
653 653
 
654 654
 			// You are not permitted to view this entry.
655
-			if ( empty( $entry ) || ! self::is_entry_approved( $entry, $atts ) ) {
655
+			if (empty($entry) || !self::is_entry_approved($entry, $atts)) {
656 656
 
657
-				do_action( 'gravityview_log_debug', '[render_view] Entry does not exist. This may be because of View filters limiting access.' );
657
+				do_action('gravityview_log_debug', '[render_view] Entry does not exist. This may be because of View filters limiting access.');
658 658
 
659 659
 				/**
660 660
 				 * @since 1.6
661 661
 				 */
662
-				echo esc_attr( apply_filters( 'gravityview/render/entry/not_visible', __( 'You have attempted to view an entry that is not visible or may not exist.', 'gravityview' ) ) );
662
+				echo esc_attr(apply_filters('gravityview/render/entry/not_visible', __('You have attempted to view an entry that is not visible or may not exist.', 'gravityview')));
663 663
 
664 664
 				return null;
665 665
 			}
666 666
 
667 667
 			// We're in single view, but the view being processed is not the same view the single entry belongs to.
668 668
 			// important: do not remove this as it prevents fake attempts of displaying entries from other views/forms
669
-			if ( $this->getGvOutputData()->has_multiple_views() && $view_id != $this->get_context_view_id() ) {
670
-				do_action( 'gravityview_log_debug', '[render_view] In single entry view, but the entry does not belong to this View. Perhaps there are multiple views on the page. View ID: '. $view_id );
669
+			if ($this->getGvOutputData()->has_multiple_views() && $view_id != $this->get_context_view_id()) {
670
+				do_action('gravityview_log_debug', '[render_view] In single entry view, but the entry does not belong to this View. Perhaps there are multiple views on the page. View ID: '.$view_id);
671 671
 				return null;
672 672
 			}
673 673
 
674 674
 			//fetch template and slug
675
-			$view_slug = apply_filters( 'gravityview_template_slug_' . $view_data['template_id'], 'table', 'single' );
676
-			do_action( 'gravityview_log_debug', '[render_view] View single template slug: ', $view_slug );
675
+			$view_slug = apply_filters('gravityview_template_slug_'.$view_data['template_id'], 'table', 'single');
676
+			do_action('gravityview_log_debug', '[render_view] View single template slug: ', $view_slug);
677 677
 
678 678
 			//fetch entry detail
679 679
 			$view_entries['count'] = 1;
680 680
 			$view_entries['entries'][] = $entry;
681
-			do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries['entries'] );
681
+			do_action('gravityview_log_debug', '[render_view] Get single entry: ', $view_entries['entries']);
682 682
 
683
-			$back_link_label = isset( $atts['back_link_label'] ) ? $atts['back_link_label'] : null;
683
+			$back_link_label = isset($atts['back_link_label']) ? $atts['back_link_label'] : null;
684 684
 
685 685
 			// set back link label
686
-			$gravityview_view->setBackLinkLabel( $back_link_label );
687
-			$gravityview_view->setContext( 'single' );
688
-			$sections = array( 'single' );
686
+			$gravityview_view->setBackLinkLabel($back_link_label);
687
+			$gravityview_view->setContext('single');
688
+			$sections = array('single');
689 689
 
690 690
 		}
691 691
 
692 692
 		// add template style
693
-		self::add_style( $view_data['template_id'] );
693
+		self::add_style($view_data['template_id']);
694 694
 
695 695
 		// Prepare to render view and set vars
696
-		$gravityview_view->setEntries( $view_entries['entries'] );
697
-		$gravityview_view->setTotalEntries( $view_entries['count'] );
696
+		$gravityview_view->setEntries($view_entries['entries']);
697
+		$gravityview_view->setTotalEntries($view_entries['count']);
698 698
 
699 699
 		// If Edit
700
-		if ( 'edit' === gravityview_get_context() ) {
700
+		if ('edit' === gravityview_get_context()) {
701 701
 
702
-			do_action( 'gravityview_log_debug', '[render_view] Edit Entry ' );
702
+			do_action('gravityview_log_debug', '[render_view] Edit Entry ');
703 703
 
704
-			do_action( 'gravityview_edit_entry', $this->getGvOutputData() );
704
+			do_action('gravityview_edit_entry', $this->getGvOutputData());
705 705
 
706 706
 			return ob_get_clean();
707 707
 
708 708
 		} else {
709 709
 			// finaly we'll render some html
710
-			$sections = apply_filters( 'gravityview_render_view_sections', $sections, $view_data['template_id'] );
710
+			$sections = apply_filters('gravityview_render_view_sections', $sections, $view_data['template_id']);
711 711
 
712
-			do_action( 'gravityview_log_debug', '[render_view] Sections to render: ', $sections );
713
-			foreach ( $sections as $section ) {
714
-				do_action( 'gravityview_log_debug', '[render_view] Rendering '. $section . ' section.' );
715
-				$gravityview_view->render( $view_slug, $section, false );
712
+			do_action('gravityview_log_debug', '[render_view] Sections to render: ', $sections);
713
+			foreach ($sections as $section) {
714
+				do_action('gravityview_log_debug', '[render_view] Rendering '.$section.' section.');
715
+				$gravityview_view->render($view_slug, $section, false);
716 716
 			}
717 717
 		}
718 718
 
719 719
 		//@todo: check why we need the IF statement vs. print the view id always.
720
-		if ( $this->isGravityviewPostType() || $this->isPostHasShortcode() ) {
720
+		if ($this->isGravityviewPostType() || $this->isPostHasShortcode()) {
721 721
 			// Print the View ID to enable proper cookie pagination
722
-			echo '<input type="hidden" class="gravityview-view-id" value="' . esc_attr( $view_id ) . '">';
722
+			echo '<input type="hidden" class="gravityview-view-id" value="'.esc_attr($view_id).'">';
723 723
 		}
724 724
 		$output = ob_get_clean();
725 725
 
@@ -741,23 +741,23 @@  discard block
 block discarded – undo
741 741
 	 * @param  array      $search_criteria Search being performed, if any
742 742
 	 * @return array                       Modified `$search_criteria` array
743 743
 	 */
744
-	public static function process_search_dates( $args, $search_criteria = array() ) {
744
+	public static function process_search_dates($args, $search_criteria = array()) {
745 745
 
746 746
 		$return_search_criteria = $search_criteria;
747 747
 
748
-		foreach ( array( 'start_date', 'end_date' ) as $key ) {
748
+		foreach (array('start_date', 'end_date') as $key) {
749 749
 
750 750
 
751 751
 			// Is the start date or end date set in the view or shortcode?
752 752
 			// If so, we want to make sure that the search doesn't go outside the bounds defined.
753
-			if ( ! empty( $args[ $key ] ) ) {
753
+			if (!empty($args[$key])) {
754 754
 
755 755
 				// Get a timestamp and see if it's a valid date format
756
-				$date = strtotime( $args[ $key ] );
756
+				$date = strtotime($args[$key]);
757 757
 
758 758
 				// The date was invalid
759
-				if ( empty( $date ) ) {
760
-					do_action( 'gravityview_log_error', __METHOD__ . ' Invalid ' . $key . ' date format: ' . $args[ $key ] );
759
+				if (empty($date)) {
760
+					do_action('gravityview_log_error', __METHOD__.' Invalid '.$key.' date format: '.$args[$key]);
761 761
 					continue;
762 762
 				}
763 763
 
@@ -765,12 +765,12 @@  discard block
 block discarded – undo
765 765
 				$datetime_format = 'Y-m-d H:i:s';
766 766
 				$search_is_outside_view_bounds = false;
767 767
 
768
-				if( ! empty( $search_criteria[ $key ] ) ) {
768
+				if (!empty($search_criteria[$key])) {
769 769
 
770
-					$search_date = strtotime( $search_criteria[ $key ] );
770
+					$search_date = strtotime($search_criteria[$key]);
771 771
 
772 772
 					// The search is for entries before the start date defined by the settings
773
-					switch ( $key ) {
773
+					switch ($key) {
774 774
 						case 'end_date':
775 775
 							/**
776 776
 							 * If the end date is formatted as 'Y-m-d', it should be formatted without hours and seconds
@@ -780,28 +780,28 @@  discard block
 block discarded – undo
780 780
 							 *
781 781
 							 * @see GFFormsModel::get_date_range_where
782 782
 							 */
783
-							$datetime_format               = gravityview_is_valid_datetime( $args[ $key ] ) ? 'Y-m-d' : 'Y-m-d H:i:s';
784
-							$search_is_outside_view_bounds = ( $search_date > $date );
783
+							$datetime_format               = gravityview_is_valid_datetime($args[$key]) ? 'Y-m-d' : 'Y-m-d H:i:s';
784
+							$search_is_outside_view_bounds = ($search_date > $date);
785 785
 							break;
786 786
 						case 'start_date':
787
-							$search_is_outside_view_bounds = ( $search_date < $date );
787
+							$search_is_outside_view_bounds = ($search_date < $date);
788 788
 							break;
789 789
 					}
790 790
 				}
791 791
 
792 792
 				// If there is no search being performed, or if there is a search being performed that's outside the bounds
793
-				if ( empty( $search_criteria[ $key ] ) || $search_is_outside_view_bounds ) {
793
+				if (empty($search_criteria[$key]) || $search_is_outside_view_bounds) {
794 794
 
795 795
 					// Then we override the search and re-set the start date
796
-					$return_search_criteria[ $key ] = date_i18n( $datetime_format , $date, true );
796
+					$return_search_criteria[$key] = date_i18n($datetime_format, $date, true);
797 797
 				}
798 798
 			}
799 799
 		}
800 800
 
801
-		if( isset( $return_search_criteria['start_date'] ) && isset( $return_search_criteria['end_date'] ) ) {
801
+		if (isset($return_search_criteria['start_date']) && isset($return_search_criteria['end_date'])) {
802 802
 			// The start date is AFTER the end date. This will result in no results, but let's not force the issue.
803
-			if ( strtotime( $return_search_criteria['start_date'] ) > strtotime( $return_search_criteria['end_date'] ) ) {
804
-				do_action( 'gravityview_log_error', __METHOD__ . ' Invalid search: the start date is after the end date.', $return_search_criteria );
803
+			if (strtotime($return_search_criteria['start_date']) > strtotime($return_search_criteria['end_date'])) {
804
+				do_action('gravityview_log_error', __METHOD__.' Invalid search: the start date is after the end date.', $return_search_criteria);
805 805
 			}
806 806
 		}
807 807
 
@@ -816,13 +816,13 @@  discard block
 block discarded – undo
816 816
 	 * @param  array      $search_criteria Search being performed, if any
817 817
 	 * @return array                       Modified `$search_criteria` array
818 818
 	 */
819
-	public static function process_search_only_approved( $args, $search_criteria ) {
819
+	public static function process_search_only_approved($args, $search_criteria) {
820 820
 
821
-		if ( ! empty( $args['show_only_approved'] ) ) {
822
-			$search_criteria['field_filters'][] = array( 'key' => 'is_approved', 'value' => 'Approved' );
821
+		if (!empty($args['show_only_approved'])) {
822
+			$search_criteria['field_filters'][] = array('key' => 'is_approved', 'value' => 'Approved');
823 823
 			$search_criteria['field_filters']['mode'] = 'all'; // force all the criterias to be met
824 824
 
825
-			do_action( 'gravityview_log_debug', '[process_search_only_approved] Search Criteria if show only approved: ', $search_criteria );
825
+			do_action('gravityview_log_debug', '[process_search_only_approved] Search Criteria if show only approved: ', $search_criteria);
826 826
 		}
827 827
 
828 828
 		return $search_criteria;
@@ -842,16 +842,16 @@  discard block
 block discarded – undo
842 842
 	 *
843 843
 	 * @return bool
844 844
 	 */
845
-	public static function is_entry_approved( $entry, $args = array() ) {
845
+	public static function is_entry_approved($entry, $args = array()) {
846 846
 
847
-		if ( empty( $entry['id'] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args['show_only_approved'] ) ) {
847
+		if (empty($entry['id']) || (array_key_exists('show_only_approved', $args) && !$args['show_only_approved'])) {
848 848
 			// is implicitly approved if entry is null or View settings doesn't require to check for approval
849 849
 			return true;
850 850
 		}
851 851
 
852
-		$is_approved = gform_get_meta( $entry['id'], 'is_approved' );
852
+		$is_approved = gform_get_meta($entry['id'], 'is_approved');
853 853
 
854
-		if ( $is_approved ) {
854
+		if ($is_approved) {
855 855
 			return true;
856 856
 		}
857 857
 
@@ -872,47 +872,47 @@  discard block
 block discarded – undo
872 872
 	 * @param  int $form_id Gravity Forms form ID
873 873
 	 * @return array          Array of search parameters, formatted in Gravity Forms mode, using `status` key set to "active" by default, `field_filters` array with `key`, `value` and `operator` keys.
874 874
 	 */
875
-	public static function get_search_criteria( $args, $form_id ) {
875
+	public static function get_search_criteria($args, $form_id) {
876 876
 
877 877
 		// Search Criteria
878
-		$search_criteria = apply_filters( 'gravityview_fe_search_criteria', array( 'field_filters' => array() ), $form_id );
878
+		$search_criteria = apply_filters('gravityview_fe_search_criteria', array('field_filters' => array()), $form_id);
879 879
 
880 880
 		$original_search_criteria = $search_criteria;
881 881
 
882
-		do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after hook gravityview_fe_search_criteria: ', $search_criteria );
882
+		do_action('gravityview_log_debug', '[get_search_criteria] Search Criteria after hook gravityview_fe_search_criteria: ', $search_criteria);
883 883
 
884 884
 		// implicity search
885
-		if ( ! empty( $args['search_value'] ) ) {
885
+		if (!empty($args['search_value'])) {
886 886
 
887 887
 			// Search operator options. Options: `is` or `contains`
888
-			$operator = ! empty( $args['search_operator'] ) && in_array( $args['search_operator'], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args['search_operator'] : 'contains';
888
+			$operator = !empty($args['search_operator']) && in_array($args['search_operator'], array('is', 'isnot', '>', '<', 'contains')) ? $args['search_operator'] : 'contains';
889 889
 
890 890
 			$search_criteria['field_filters'][] = array(
891
-				'key' => rgget( 'search_field', $args ), // The field ID to search
892
-				'value' => esc_attr( $args['search_value'] ), // The value to search
891
+				'key' => rgget('search_field', $args), // The field ID to search
892
+				'value' => esc_attr($args['search_value']), // The value to search
893 893
 				'operator' => $operator,
894 894
 			);
895 895
 		}
896 896
 
897
-		if( $search_criteria !== $original_search_criteria ) {
898
-			do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after implicity search: ', $search_criteria );
897
+		if ($search_criteria !== $original_search_criteria) {
898
+			do_action('gravityview_log_debug', '[get_search_criteria] Search Criteria after implicity search: ', $search_criteria);
899 899
 		}
900 900
 
901 901
 		// Handle setting date range
902
-		$search_criteria = self::process_search_dates( $args, $search_criteria );
902
+		$search_criteria = self::process_search_dates($args, $search_criteria);
903 903
 
904
-		if( $search_criteria !== $original_search_criteria ) {
905
-			do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after date params: ', $search_criteria );
904
+		if ($search_criteria !== $original_search_criteria) {
905
+			do_action('gravityview_log_debug', '[get_search_criteria] Search Criteria after date params: ', $search_criteria);
906 906
 		}
907 907
 
908 908
 		// remove not approved entries
909
-		$search_criteria = self::process_search_only_approved( $args, $search_criteria );
909
+		$search_criteria = self::process_search_only_approved($args, $search_criteria);
910 910
 
911 911
 		/**
912 912
 		 * @filter `gravityview_status` Modify entry status requirements to be included in search results.
913 913
 		 * @param string $status Default: `active`. Accepts all Gravity Forms entry statuses, including `spam` and `trash`
914 914
 		 */
915
-		$search_criteria['status'] = apply_filters( 'gravityview_status', 'active', $args );
915
+		$search_criteria['status'] = apply_filters('gravityview_status', 'active', $args);
916 916
 
917 917
 		return $search_criteria;
918 918
 	}
@@ -946,29 +946,29 @@  discard block
 block discarded – undo
946 946
 	 * @param int $form_id Gravity Forms Form ID
947 947
 	 * @return array Associative array with `count`, `entries`, and `paging` keys. `count` has the total entries count, `entries` is an array with Gravity Forms full entry data, `paging` is an array with `offset` and `page_size` keys
948 948
 	 */
949
-	public static function get_view_entries( $args, $form_id ) {
949
+	public static function get_view_entries($args, $form_id) {
950 950
 
951
-		do_action( 'gravityview_log_debug', '[get_view_entries] init' );
951
+		do_action('gravityview_log_debug', '[get_view_entries] init');
952 952
 		// start filters and sorting
953 953
 
954 954
 		/**
955 955
 		 * Process search parameters
956 956
 		 * @var array
957 957
 		 */
958
-		$search_criteria = self::get_search_criteria( $args, $form_id );
958
+		$search_criteria = self::get_search_criteria($args, $form_id);
959 959
 
960 960
 		// Paging & offset
961
-		$page_size = ! empty( $args['page_size'] ) ? intval( $args['page_size'] ) : apply_filters( 'gravityview_default_page_size', 25 );
961
+		$page_size = !empty($args['page_size']) ? intval($args['page_size']) : apply_filters('gravityview_default_page_size', 25);
962 962
 
963 963
 		if ( -1 === $page_size ) {
964 964
 			$page_size = PHP_INT_MAX;
965 965
 		}
966 966
 
967
-		if ( isset( $args['offset'] ) ) {
968
-			$offset = intval( $args['offset'] );
967
+		if (isset($args['offset'])) {
968
+			$offset = intval($args['offset']);
969 969
 		} else {
970
-			$curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] );
971
-			$offset = ( $curr_page - 1 ) * $page_size;
970
+			$curr_page = empty($_GET['pagenum']) ? 1 : intval($_GET['pagenum']);
971
+			$offset = ($curr_page - 1) * $page_size;
972 972
 		}
973 973
 
974 974
 		$paging = array(
@@ -976,16 +976,16 @@  discard block
 block discarded – undo
976 976
 			'page_size' => $page_size,
977 977
 		);
978 978
 
979
-		do_action( 'gravityview_log_debug', '[get_view_entries] Paging: ', $paging );
979
+		do_action('gravityview_log_debug', '[get_view_entries] Paging: ', $paging);
980 980
 
981 981
 		// Sorting
982
-		$sorting = self::updateViewSorting( $args, $form_id );
982
+		$sorting = self::updateViewSorting($args, $form_id);
983 983
 
984 984
 		$parameters = array(
985 985
 			'search_criteria' => $search_criteria,
986 986
 			'sorting' => $sorting,
987 987
 			'paging' => $paging,
988
-			'cache' => isset( $args['cache'] ) ? $args['cache'] : true,
988
+			'cache' => isset($args['cache']) ? $args['cache'] : true,
989 989
 		);
990 990
 
991 991
 		/**
@@ -1003,22 +1003,22 @@  discard block
 block discarded – undo
1003 1003
 		 * }
1004 1004
 		 * @param int $form_id ID of Gravity Forms form
1005 1005
 		 */
1006
-		$parameters = apply_filters( 'gravityview_get_entries', $parameters, $args, $form_id );
1006
+		$parameters = apply_filters('gravityview_get_entries', $parameters, $args, $form_id);
1007 1007
 
1008 1008
 		/**
1009 1009
 		 * @filter `gravityview_get_entries_{View ID}` Filter get entries criteria
1010 1010
 		 * @param array $parameters Array with `search_criteria`, `sorting` and `paging` keys.
1011 1011
 		 * @param array $args View configuration args.
1012 1012
 		 */
1013
-		$parameters = apply_filters( 'gravityview_get_entries_'.$args['id'], $parameters, $args, $form_id );
1013
+		$parameters = apply_filters('gravityview_get_entries_'.$args['id'], $parameters, $args, $form_id);
1014 1014
 
1015
-		do_action( 'gravityview_log_debug', '[get_view_entries] $parameters passed to gravityview_get_entries(): ', $parameters );
1015
+		do_action('gravityview_log_debug', '[get_view_entries] $parameters passed to gravityview_get_entries(): ', $parameters);
1016 1016
 
1017 1017
 		//fetch entries
1018 1018
 		$count = 0;
1019
-		$entries = gravityview_get_entries( $form_id, $parameters, $count );
1019
+		$entries = gravityview_get_entries($form_id, $parameters, $count);
1020 1020
 
1021
-		do_action( 'gravityview_log_debug', sprintf( '[get_view_entries] Get Entries. Found: %s entries', $count ), $entries );
1021
+		do_action('gravityview_log_debug', sprintf('[get_view_entries] Get Entries. Found: %s entries', $count), $entries);
1022 1022
 
1023 1023
 		/**
1024 1024
 		 * @filter `gravityview_view_entries` Filter the entries output to the View
@@ -1026,7 +1026,7 @@  discard block
 block discarded – undo
1026 1026
 		 * @param array $args View settings associative array
1027 1027
 		 * @var array
1028 1028
 		 */
1029
-		$entries = apply_filters( 'gravityview_view_entries', $entries, $args );
1029
+		$entries = apply_filters('gravityview_view_entries', $entries, $args);
1030 1030
 
1031 1031
 		/**
1032 1032
 		 * @filter `gravityview/view/entries` Filter the entries output to the View
@@ -1034,7 +1034,7 @@  discard block
 block discarded – undo
1034 1034
 		 * @param array $args View settings associative array
1035 1035
 		 * @since 1.5.2
1036 1036
 		 */
1037
-		return apply_filters( 'gravityview/view/entries', compact( 'count', 'entries', 'paging' ), $args );
1037
+		return apply_filters('gravityview/view/entries', compact('count', 'entries', 'paging'), $args);
1038 1038
 
1039 1039
 	}
1040 1040
 
@@ -1048,24 +1048,24 @@  discard block
 block discarded – undo
1048 1048
 	 * @param int $form_id The ID of the form used to sort
1049 1049
 	 * @return array $sorting Array with `key`, `direction` and `is_numeric` keys
1050 1050
 	 */
1051
-	public static function updateViewSorting( $args, $form_id ) {
1051
+	public static function updateViewSorting($args, $form_id) {
1052 1052
 		$sorting = array();
1053
-		$sort_field_id = isset( $_GET['sort'] ) ? $_GET['sort'] : rgar( $args, 'sort_field' );
1054
-		$sort_direction = isset( $_GET['dir'] ) ? $_GET['dir'] : rgar( $args, 'sort_direction' );
1053
+		$sort_field_id = isset($_GET['sort']) ? $_GET['sort'] : rgar($args, 'sort_field');
1054
+		$sort_direction = isset($_GET['dir']) ? $_GET['dir'] : rgar($args, 'sort_direction');
1055 1055
 
1056
-		$sort_field_id = self::_override_sorting_id_by_field_type( $sort_field_id, $form_id );
1056
+		$sort_field_id = self::_override_sorting_id_by_field_type($sort_field_id, $form_id);
1057 1057
 
1058
-		if ( ! empty( $sort_field_id ) ) {
1058
+		if (!empty($sort_field_id)) {
1059 1059
 			$sorting = array(
1060 1060
 				'key' => $sort_field_id,
1061
-				'direction' => strtolower( $sort_direction ),
1062
-				'is_numeric' => GVCommon::is_field_numeric( $form_id, $sort_field_id )
1061
+				'direction' => strtolower($sort_direction),
1062
+				'is_numeric' => GVCommon::is_field_numeric($form_id, $sort_field_id)
1063 1063
 			);
1064 1064
 		}
1065 1065
 
1066
-		GravityView_View::getInstance()->setSorting( $sorting );
1066
+		GravityView_View::getInstance()->setSorting($sorting);
1067 1067
 
1068
-		do_action( 'gravityview_log_debug', '[updateViewSorting] Sort Criteria : ', $sorting );
1068
+		do_action('gravityview_log_debug', '[updateViewSorting] Sort Criteria : ', $sorting);
1069 1069
 
1070 1070
 		return $sorting;
1071 1071
 
@@ -1085,17 +1085,17 @@  discard block
 block discarded – undo
1085 1085
 	 *
1086 1086
 	 * @return string Possibly modified sorting ID
1087 1087
 	 */
1088
-	private static function _override_sorting_id_by_field_type( $sort_field_id, $form_id ) {
1088
+	private static function _override_sorting_id_by_field_type($sort_field_id, $form_id) {
1089 1089
 
1090
-		$form = gravityview_get_form( $form_id );
1090
+		$form = gravityview_get_form($form_id);
1091 1091
 
1092
-		$sort_field = GFFormsModel::get_field( $form, $sort_field_id );
1092
+		$sort_field = GFFormsModel::get_field($form, $sort_field_id);
1093 1093
 
1094
-		switch ( $sort_field['type'] ) {
1094
+		switch ($sort_field['type']) {
1095 1095
 
1096 1096
 			case 'address':
1097 1097
 				// Sorting by full address
1098
-				if ( floatval( $sort_field_id ) === floor( $sort_field_id ) ) {
1098
+				if (floatval($sort_field_id) === floor($sort_field_id)) {
1099 1099
 
1100 1100
 					/**
1101 1101
 					 * Override how to sort when sorting address
@@ -1106,9 +1106,9 @@  discard block
 block discarded – undo
1106 1106
 					 * @param string $sort_field_id Field used for sorting
1107 1107
 					 * @param int $form_id GF Form ID
1108 1108
 					 */
1109
-					$address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id );
1109
+					$address_part = apply_filters('gravityview/sorting/address', 'city', $sort_field_id, $form_id);
1110 1110
 
1111
-					switch( strtolower( $address_part ) ){
1111
+					switch (strtolower($address_part)) {
1112 1112
 						case 'street':
1113 1113
 							$sort_field_id .= '.1';
1114 1114
 							break;
@@ -1134,7 +1134,7 @@  discard block
 block discarded – undo
1134 1134
 				break;
1135 1135
 			case 'name':
1136 1136
 				// Sorting by full name, not first, last, etc.
1137
-				if ( floatval( $sort_field_id ) === floor( $sort_field_id ) ) {
1137
+				if (floatval($sort_field_id) === floor($sort_field_id)) {
1138 1138
 					/**
1139 1139
 					 * @filter `gravityview/sorting/full-name` Override how to sort when sorting full name.
1140 1140
 					 * @since 1.7.4
@@ -1142,9 +1142,9 @@  discard block
 block discarded – undo
1142 1142
 					 * @param[in] string $sort_field_id Field used for sorting
1143 1143
 					 * @param[in] int $form_id GF Form ID
1144 1144
 					 */
1145
-					$name_part = apply_filters( 'gravityview/sorting/full-name', 'first', $sort_field_id, $form_id );
1145
+					$name_part = apply_filters('gravityview/sorting/full-name', 'first', $sort_field_id, $form_id);
1146 1146
 
1147
-					if ( 'last' === strtolower( $name_part ) ) {
1147
+					if ('last' === strtolower($name_part)) {
1148 1148
 						$sort_field_id .= '.6';
1149 1149
 					} else {
1150 1150
 						$sort_field_id .= '.3';
@@ -1163,7 +1163,7 @@  discard block
 block discarded – undo
1163 1163
 				 * @param[in,out] string $name_part Field used for sorting
1164 1164
 				 * @param[in] int $form_id GF Form ID
1165 1165
 				 */
1166
-				$sort_field_id = apply_filters( 'gravityview/sorting/time', $sort_field_id, $form_id );
1166
+				$sort_field_id = apply_filters('gravityview/sorting/time', $sort_field_id, $form_id);
1167 1167
 				break;
1168 1168
 		}
1169 1169
 
@@ -1178,7 +1178,7 @@  discard block
 block discarded – undo
1178 1178
 
1179 1179
 		$var_name = GravityView_Post_Types::get_entry_var_name();
1180 1180
 
1181
-		$single_entry = get_query_var( $var_name );
1181
+		$single_entry = get_query_var($var_name);
1182 1182
 
1183 1183
 		/**
1184 1184
 		 * Modify the entry that is being displayed.
@@ -1186,9 +1186,9 @@  discard block
 block discarded – undo
1186 1186
 		 * @internal Should only be used by things like the oEmbed functionality.
1187 1187
 		 * @since 1.6
1188 1188
 		 */
1189
-		$single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry );
1189
+		$single_entry = apply_filters('gravityview/is_single_entry', $single_entry);
1190 1190
 
1191
-		if ( empty( $single_entry ) ){
1191
+		if (empty($single_entry)) {
1192 1192
 			return false;
1193 1193
 		} else {
1194 1194
 			return $single_entry;
@@ -1205,38 +1205,38 @@  discard block
 block discarded – undo
1205 1205
 	public function add_scripts_and_styles() {
1206 1206
 		global $post, $posts;
1207 1207
 		// enqueue template specific styles
1208
-		if ( $this->getGvOutputData() ) {
1208
+		if ($this->getGvOutputData()) {
1209 1209
 
1210 1210
 			$views = $this->getGvOutputData()->get_views();
1211 1211
 
1212
-			foreach ( $views as $view_id => $data ) {
1212
+			foreach ($views as $view_id => $data) {
1213 1213
 
1214 1214
 				/**
1215 1215
 				 * Don't enqueue the scripts or styles if it's not going to be displayed.
1216 1216
 				 * @since 1.15
1217 1217
 				 */
1218
-				if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) {
1218
+				if (is_user_logged_in() && false === GVCommon::has_cap('read_gravityview', $view_id)) {
1219 1219
 					continue;
1220 1220
 				}
1221 1221
 
1222 1222
 				// By default, no thickbox
1223
-				$js_dependencies = array( 'jquery', 'gravityview-jquery-cookie' );
1223
+				$js_dependencies = array('jquery', 'gravityview-jquery-cookie');
1224 1224
 				$css_dependencies = array();
1225 1225
 
1226 1226
 				// If the thickbox is enqueued, add dependencies
1227
-				if ( ! empty( $data['atts']['lightbox'] ) ) {
1227
+				if (!empty($data['atts']['lightbox'])) {
1228 1228
 
1229 1229
 					/**
1230 1230
 					 * @filter `gravity_view_lightbox_script` Override the lightbox script to enqueue. Default: `thickbox`
1231 1231
 					 * @param string $script_slug If you want to use a different lightbox script, return the name of it here.
1232 1232
 					 */
1233
-					$js_dependencies[] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' );
1233
+					$js_dependencies[] = apply_filters('gravity_view_lightbox_script', 'thickbox');
1234 1234
 
1235 1235
 					/**
1236 1236
 					 * @filter `gravity_view_lightbox_style` Modify the lightbox CSS slug. Default: `thickbox`
1237 1237
 					 * @param string $script_slug If you want to use a different lightbox script, return the name of its CSS file here.
1238 1238
 					 */
1239
-					$css_dependencies[] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' );
1239
+					$css_dependencies[] = apply_filters('gravity_view_lightbox_style', 'thickbox');
1240 1240
 				}
1241 1241
 
1242 1242
 				/**
@@ -1244,34 +1244,34 @@  discard block
 block discarded – undo
1244 1244
 				 * @see https://github.com/katzwebservices/GravityView/issues/536
1245 1245
 				 * @since 1.15
1246 1246
 				 */
1247
-				if( gravityview_view_has_single_checkbox_or_radio( $data['form'], $data['fields'] ) ) {
1247
+				if (gravityview_view_has_single_checkbox_or_radio($data['form'], $data['fields'])) {
1248 1248
 					$css_dependencies[] = 'dashicons';
1249 1249
 				}
1250 1250
 
1251
-				wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'includes/lib/jquery-cookie/jquery_cookie.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true );
1251
+				wp_register_script('gravityview-jquery-cookie', plugins_url('includes/lib/jquery-cookie/jquery_cookie.js', GRAVITYVIEW_FILE), array('jquery'), GravityView_Plugin::version, true);
1252 1252
 
1253
-				$script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
1253
+				$script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
1254 1254
 
1255
-				wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ) , GravityView_Plugin::version, true );
1255
+				wp_register_script('gravityview-fe-view', plugins_url('assets/js/fe-views'.$script_debug.'.js', GRAVITYVIEW_FILE), apply_filters('gravityview_js_dependencies', $js_dependencies), GravityView_Plugin::version, true);
1256 1256
 
1257
-				wp_enqueue_script( 'gravityview-fe-view' );
1257
+				wp_enqueue_script('gravityview-fe-view');
1258 1258
 
1259
-				if ( ! empty( $data['atts']['sort_columns'] ) ) {
1260
-					wp_enqueue_style( 'gravityview_font', plugins_url( 'assets/css/font.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' );
1259
+				if (!empty($data['atts']['sort_columns'])) {
1260
+					wp_enqueue_style('gravityview_font', plugins_url('assets/css/font.css', GRAVITYVIEW_FILE), $css_dependencies, GravityView_Plugin::version, 'all');
1261 1261
 				}
1262 1262
 
1263
-				wp_enqueue_style( 'gravityview_default_style', plugins_url( 'templates/css/gv-default-styles.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' );
1263
+				wp_enqueue_style('gravityview_default_style', plugins_url('templates/css/gv-default-styles.css', GRAVITYVIEW_FILE), $css_dependencies, GravityView_Plugin::version, 'all');
1264 1264
 
1265
-				self::add_style( $data['template_id'] );
1265
+				self::add_style($data['template_id']);
1266 1266
 
1267 1267
 			}
1268 1268
 
1269
-			if ( 'wp_print_footer_scripts' === current_filter() ) {
1269
+			if ('wp_print_footer_scripts' === current_filter()) {
1270 1270
 
1271 1271
 				$js_localization = array(
1272 1272
 					'cookiepath' => COOKIEPATH,
1273
-					'clear' => _x( 'Clear', 'Clear all data from the form', 'gravityview' ),
1274
-					'reset' => _x( 'Reset', 'Reset the search form to the state that existed on page load', 'gravityview' ),
1273
+					'clear' => _x('Clear', 'Clear all data from the form', 'gravityview'),
1274
+					'reset' => _x('Reset', 'Reset the search form to the state that existed on page load', 'gravityview'),
1275 1275
 				);
1276 1276
 
1277 1277
 				/**
@@ -1279,9 +1279,9 @@  discard block
 block discarded – undo
1279 1279
 				 * @param array $js_localization The data padded to the Javascript file
1280 1280
 				 * @param array $views Array of View data arrays with View settings
1281 1281
 				 */
1282
-				$js_localization = apply_filters( 'gravityview_js_localization', $js_localization, $views );
1282
+				$js_localization = apply_filters('gravityview_js_localization', $js_localization, $views);
1283 1283
 
1284
-				wp_localize_script( 'gravityview-fe-view', 'gvGlobals', $js_localization );
1284
+				wp_localize_script('gravityview-fe-view', 'gvGlobals', $js_localization);
1285 1285
 			}
1286 1286
 		}
1287 1287
 	}
@@ -1290,15 +1290,15 @@  discard block
 block discarded – undo
1290 1290
 	 * Add template extra style if exists
1291 1291
 	 * @param string $template_id
1292 1292
 	 */
1293
-	public static function add_style( $template_id ) {
1293
+	public static function add_style($template_id) {
1294 1294
 
1295
-		if ( ! empty( $template_id ) && wp_style_is( 'gravityview_style_' . $template_id, 'registered' ) ) {
1296
-			do_action( 'gravityview_log_debug', sprintf( '[add_style] Adding extra template style for %s', $template_id ) );
1297
-			wp_enqueue_style( 'gravityview_style_' . $template_id );
1298
-		} elseif ( empty( $template_id ) ) {
1299
-			do_action( 'gravityview_log_error', '[add_style] Cannot add template style; template_id is empty' );
1295
+		if (!empty($template_id) && wp_style_is('gravityview_style_'.$template_id, 'registered')) {
1296
+			do_action('gravityview_log_debug', sprintf('[add_style] Adding extra template style for %s', $template_id));
1297
+			wp_enqueue_style('gravityview_style_'.$template_id);
1298
+		} elseif (empty($template_id)) {
1299
+			do_action('gravityview_log_error', '[add_style] Cannot add template style; template_id is empty');
1300 1300
 		} else {
1301
-			do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_'.$template_id ) );
1301
+			do_action('gravityview_log_error', sprintf('[add_style] Cannot add template style; %s is not registered', 'gravityview_style_'.$template_id));
1302 1302
 		}
1303 1303
 
1304 1304
 	}
@@ -1317,17 +1317,17 @@  discard block
 block discarded – undo
1317 1317
 	 *
1318 1318
 	 * @return string Field Label
1319 1319
 	 */
1320
-	public function add_columns_sort_links( $label = '', $field, $form ) {
1320
+	public function add_columns_sort_links($label = '', $field, $form) {
1321 1321
 
1322 1322
 		/**
1323 1323
 		 * Not a table-based template; don't add sort icons
1324 1324
 		 * @since 1.12
1325 1325
 		 */
1326
-		if( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) {
1326
+		if (!preg_match('/table/ism', GravityView_View::getInstance()->getTemplatePartSlug())) {
1327 1327
 			return $label;
1328 1328
 		}
1329 1329
 
1330
-		if ( ! $this->is_field_sortable( $field['id'], $form ) ) {
1330
+		if (!$this->is_field_sortable($field['id'], $form)) {
1331 1331
 			return $label;
1332 1332
 		}
1333 1333
 
@@ -1335,16 +1335,16 @@  discard block
 block discarded – undo
1335 1335
 
1336 1336
 		$class = 'gv-sort icon';
1337 1337
 
1338
-		$sort_field_id = self::_override_sorting_id_by_field_type( $field['id'], $form['id'] );
1338
+		$sort_field_id = self::_override_sorting_id_by_field_type($field['id'], $form['id']);
1339 1339
 
1340 1340
 		$sort_args = array(
1341 1341
 			'sort' => $field['id'],
1342 1342
 			'dir' => 'asc',
1343 1343
 		);
1344 1344
 
1345
-		if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) {
1345
+		if (!empty($sorting['key']) && (string)$sort_field_id === (string)$sorting['key']) {
1346 1346
 			//toggle sorting direction.
1347
-			if ( 'asc' === $sorting['direction'] ) {
1347
+			if ('asc' === $sorting['direction']) {
1348 1348
 				$sort_args['dir'] = 'desc';
1349 1349
 				$class .= ' gv-icon-sort-desc';
1350 1350
 			} else {
@@ -1355,9 +1355,9 @@  discard block
 block discarded – undo
1355 1355
 			$class .= ' gv-icon-caret-up-down';
1356 1356
 		}
1357 1357
 
1358
-		$url = add_query_arg( $sort_args, remove_query_arg( array('pagenum') ) );
1358
+		$url = add_query_arg($sort_args, remove_query_arg(array('pagenum')));
1359 1359
 
1360
-		return '<a href="'. esc_url_raw( $url ) .'" class="'. $class .'" ></a>&nbsp;'. $label;
1360
+		return '<a href="'.esc_url_raw($url).'" class="'.$class.'" ></a>&nbsp;'.$label;
1361 1361
 
1362 1362
 	}
1363 1363
 
@@ -1371,12 +1371,12 @@  discard block
 block discarded – undo
1371 1371
 	 *
1372 1372
 	 * @return bool True: Yes, field is sortable; False: not sortable
1373 1373
 	 */
1374
-	public function is_field_sortable( $field_id = '', $form = array() ) {
1374
+	public function is_field_sortable($field_id = '', $form = array()) {
1375 1375
 
1376 1376
 		$field_type = $field_id;
1377 1377
 
1378
-		if( is_numeric( $field_id ) ) {
1379
-			$field = GFFormsModel::get_field( $form, $field_id );
1378
+		if (is_numeric($field_id)) {
1379
+			$field = GFFormsModel::get_field($form, $field_id);
1380 1380
 			$field_type = $field->type;
1381 1381
 		}
1382 1382
 
@@ -1392,13 +1392,13 @@  discard block
 block discarded – undo
1392 1392
 		 * @param string $field_type Field type to check whether the field is sortable
1393 1393
 		 * @param array $form Gravity Forms form
1394 1394
 		 */
1395
-		$not_sortable = apply_filters( 'gravityview/sortable/field_blacklist', $not_sortable, $field_type, $form );
1395
+		$not_sortable = apply_filters('gravityview/sortable/field_blacklist', $not_sortable, $field_type, $form);
1396 1396
 
1397
-		if ( in_array( $field_type, $not_sortable ) ) {
1397
+		if (in_array($field_type, $not_sortable)) {
1398 1398
 			return false;
1399 1399
 		}
1400 1400
 
1401
-		return apply_filters( "gravityview/sortable/formfield_{$form['id']}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) );
1401
+		return apply_filters("gravityview/sortable/formfield_{$form['id']}_{$field_id}", apply_filters("gravityview/sortable/field_{$field_id}", true, $form));
1402 1402
 
1403 1403
 	}
1404 1404
 
Please login to merge, or discard this patch.
includes/class-api.php 1 patch
Spacing   +219 added lines, -219 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() : __( '&larr; Go back', 'gravityview' );
780
+	$label = $gravityview_view->getBackLinkLabel() ? $gravityview_view->getBackLinkLabel() : __('&larr; 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'] ) && ! empty( $args['field']['show_label'] ) ) {
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']) && !empty($args['field']['show_label'])) {
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
 }
Please login to merge, or discard this patch.