Completed
Pull Request — master (#605)
by Zack
05:45
created
includes/class-gravityview-merge-tags.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	private function add_hooks() {
21 21
 
22 22
 		/** @see GFCommon::replace_variables_prepopulate **/
23
-		add_filter( 'gform_replace_merge_tags', array( 'GravityView_Merge_Tags', 'replace_gv_merge_tags' ), 10, 7 );
23
+		add_filter('gform_replace_merge_tags', array('GravityView_Merge_Tags', 'replace_gv_merge_tags'), 10, 7);
24 24
 
25 25
 	}
26 26
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 * @param  bool       $esc_html     Pass return value through `esc_html()`
42 42
 	 * @return string                  Text with variables maybe replaced
43 43
 	 */
44
-	public static function replace_variables($text, $form = array(), $entry = array(), $url_encode = false, $esc_html = true ) {
44
+	public static function replace_variables($text, $form = array(), $entry = array(), $url_encode = false, $esc_html = true) {
45 45
 
46 46
 		/**
47 47
 		 * @filter `gravityview_do_replace_variables` Turn off merge tag variable replacements.\n
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
 		 * @param[in]  array      $form        GF Form array
54 54
 		 * @param[in]  array      $entry        GF Entry array
55 55
 		 */
56
-		$do_replace_variables = apply_filters( 'gravityview/merge_tags/do_replace_variables', true, $text, $form, $entry );
56
+		$do_replace_variables = apply_filters('gravityview/merge_tags/do_replace_variables', true, $text, $form, $entry);
57 57
 
58
-		if ( strpos( $text, '{' ) === false || ! $do_replace_variables ) {
58
+		if (strpos($text, '{') === false || !$do_replace_variables) {
59 59
 			return $text;
60 60
 		}
61 61
 
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
 		 *
65 65
 		 * @internal Reported to GF Support on 12/3
66 66
 		 */
67
-		$form['title']  = isset( $form['title'] ) ? $form['title'] : '';
68
-		$form['id']     = isset( $form['id'] ) ? $form['id'] : '';
69
-		$form['fields'] = isset( $form['fields'] ) ? $form['fields'] : array();
67
+		$form['title']  = isset($form['title']) ? $form['title'] : '';
68
+		$form['id']     = isset($form['id']) ? $form['id'] : '';
69
+		$form['fields'] = isset($form['fields']) ? $form['fields'] : array();
70 70
 
71
-		return GFCommon::replace_variables( $text, $form, $entry, $url_encode, $esc_html );
71
+		return GFCommon::replace_variables($text, $form, $entry, $url_encode, $esc_html);
72 72
 	}
73 73
 
74 74
 	/**
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	 *
87 87
 	 * @return mixed
88 88
 	 */
89
-	public static function replace_gv_merge_tags(  $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
89
+	public static function replace_gv_merge_tags($text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false) {
90 90
 
91 91
 		/**
92 92
 		 * This prevents the gform_replace_merge_tags filter from being called twice, as defined in:
@@ -94,11 +94,11 @@  discard block
 block discarded – undo
94 94
 		 * @see GFCommon::replace_variables_prepopulate()
95 95
 		 * @todo Remove eventually: Gravity Forms fixed this issue in 1.9.14
96 96
 		 */
97
-		if( false === $form ) {
97
+		if (false === $form) {
98 98
 			return $text;
99 99
 		}
100 100
 
101
-		$text = self::replace_get_variables( $text, $form, $entry, $url_encode );
101
+		$text = self::replace_get_variables($text, $form, $entry, $url_encode);
102 102
 
103 103
 		return $text;
104 104
 	}
@@ -115,21 +115,21 @@  discard block
 block discarded – undo
115 115
 	 *
116 116
 	 * @return int|string If timestamp requested, timestamp int. Otherwise, string output.
117 117
 	 */
118
-	public static function format_date( $date_created = '', $property = '' ) {
118
+	public static function format_date($date_created = '', $property = '') {
119 119
 
120 120
 		// Expand all modifiers, skipping escaped colons. str_replace worked better than preg_split( "/(?<!\\):/" )
121
-		$exploded = explode( ':', str_replace( '\:', '|COLON|', $property ) );
121
+		$exploded = explode(':', str_replace('\:', '|COLON|', $property));
122 122
 
123 123
 		$atts = array(
124
-			'format' => self::get_format_from_modifiers( $exploded, false ),
125
-		    'human' => in_array( 'human', $exploded ), // {date_created:human}
126
-			'diff' => in_array( 'diff', $exploded ), // {date_created:diff}
127
-			'raw' => in_array( 'raw', $exploded ), // {date_created:raw}
128
-			'timestamp' => in_array( 'timestamp', $exploded ), // {date_created:timestamp}
129
-			'time' => in_array( 'time', $exploded ),  // {date_created:time}
124
+			'format' => self::get_format_from_modifiers($exploded, false),
125
+		    'human' => in_array('human', $exploded), // {date_created:human}
126
+			'diff' => in_array('diff', $exploded), // {date_created:diff}
127
+			'raw' => in_array('raw', $exploded), // {date_created:raw}
128
+			'timestamp' => in_array('timestamp', $exploded), // {date_created:timestamp}
129
+			'time' => in_array('time', $exploded), // {date_created:time}
130 130
 		);
131 131
 
132
-		$formatted_date = GVCommon::format_date( $date_created, $atts );
132
+		$formatted_date = GVCommon::format_date($date_created, $atts);
133 133
 
134 134
 		return $formatted_date;
135 135
 	}
@@ -147,16 +147,16 @@  discard block
 block discarded – undo
147 147
 	 *
148 148
 	 * @return string If format is found, the passed format. Otherwise, the backup.
149 149
 	 */
150
-	private static function get_format_from_modifiers( $exploded, $backup = '' ) {
150
+	private static function get_format_from_modifiers($exploded, $backup = '') {
151 151
 
152 152
 		$return = $backup;
153 153
 
154
-		$format_key_index = array_search( 'format', $exploded );
154
+		$format_key_index = array_search('format', $exploded);
155 155
 
156 156
 		// If there's a "format:[php date format string]" date format, grab it
157
-		if ( false !== $format_key_index && isset( $exploded[ $format_key_index + 1 ] ) ) {
157
+		if (false !== $format_key_index && isset($exploded[$format_key_index + 1])) {
158 158
 			// Return escaped colons placeholder
159
-			$return = str_replace( '|COLON|', ':', $exploded[ $format_key_index + 1 ] );
159
+			$return = str_replace('|COLON|', ':', $exploded[$format_key_index + 1]);
160 160
 		}
161 161
 
162 162
 		return $return;
@@ -183,22 +183,22 @@  discard block
 block discarded – undo
183 183
 	 * @param array $entry Entry array
184 184
 	 * @param bool $url_encode Whether to URL-encode output
185 185
 	 */
186
-	public static function replace_get_variables( $text, $form = array(), $entry = array(), $url_encode = false ) {
186
+	public static function replace_get_variables($text, $form = array(), $entry = array(), $url_encode = false) {
187 187
 
188 188
 		// Is there is {get:[xyz]} merge tag?
189
-		preg_match_all( "/{get:(.*?)}/ism", $text, $matches, PREG_SET_ORDER );
189
+		preg_match_all("/{get:(.*?)}/ism", $text, $matches, PREG_SET_ORDER);
190 190
 
191 191
 		// If there are no matches OR the Entry `created_by` isn't set or is 0 (no user)
192
-		if( empty( $matches ) ) {
192
+		if (empty($matches)) {
193 193
 			return $text;
194 194
 		}
195 195
 
196
-		foreach ( $matches as $match ) {
196
+		foreach ($matches as $match) {
197 197
 
198 198
 			$full_tag = $match[0];
199 199
 			$property = $match[1];
200 200
 
201
-			$value = stripslashes_deep( rgget( $property ) );
201
+			$value = stripslashes_deep(rgget($property));
202 202
 
203 203
 			/**
204 204
 			 * @filter `gravityview/merge_tags/get/glue/` Modify the glue used to convert an array of `{get}` values from an array to string
@@ -206,11 +206,11 @@  discard block
 block discarded – undo
206 206
 			 * @param[in,out] string $glue String used to `implode()` $_GET values Default: ', '
207 207
 			 * @param[in] string $property The current name of the $_GET parameter being combined
208 208
 			 */
209
-			$glue = apply_filters( 'gravityview/merge_tags/get/glue/', ', ', $property );
209
+			$glue = apply_filters('gravityview/merge_tags/get/glue/', ', ', $property);
210 210
 
211
-			$value = is_array( $value ) ? implode( $glue, $value ) : $value;
211
+			$value = is_array($value) ? implode($glue, $value) : $value;
212 212
 
213
-			$value = $url_encode ? urlencode( $value ) : $value;
213
+			$value = $url_encode ? urlencode($value) : $value;
214 214
 
215 215
 			/**
216 216
 			 * @filter `gravityview/merge_tags/get/esc_html/{url parameter name}` Disable esc_html() from running on `{get}` merge tag
@@ -220,9 +220,9 @@  discard block
 block discarded – undo
220 220
 			 * @since 1.15
221 221
 			 * @param bool $esc_html Whether to esc_html() the value. Default: `true`
222 222
 			 */
223
-			$esc_html = apply_filters('gravityview/merge_tags/get/esc_html/' . $property, true );
223
+			$esc_html = apply_filters('gravityview/merge_tags/get/esc_html/'.$property, true);
224 224
 
225
-			$value = $esc_html ? esc_html( $value ) : $value;
225
+			$value = $esc_html ? esc_html($value) : $value;
226 226
 
227 227
 			/**
228 228
 			 * @filter `gravityview/merge_tags/get/esc_html/{url parameter name}` Modify the value of the `{get}` replacement before being used
@@ -231,12 +231,12 @@  discard block
 block discarded – undo
231 231
 			 * @param[in] array $form Gravity Forms form array
232 232
 			 * @param[in] array $entry Entry array
233 233
 			 */
234
-			$value = apply_filters('gravityview/merge_tags/get/value/' . $property, $value, $text, $form, $entry );
234
+			$value = apply_filters('gravityview/merge_tags/get/value/'.$property, $value, $text, $form, $entry);
235 235
 
236
-			$text = str_replace( $full_tag, $value, $text );
236
+			$text = str_replace($full_tag, $value, $text);
237 237
 		}
238 238
 
239
-		unset( $value, $glue, $matches );
239
+		unset($value, $glue, $matches);
240 240
 
241 241
 		return $text;
242 242
 	}
Please login to merge, or discard this patch.
includes/class-admin-welcome.php 1 patch
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly
15
-if ( ! defined( 'ABSPATH' ) ) exit;
15
+if (!defined('ABSPATH')) exit;
16 16
 
17 17
 /**
18 18
  * GravityView_Welcome Class
@@ -34,10 +34,10 @@  discard block
 block discarded – undo
34 34
 	 * @since 1.0
35 35
 	 */
36 36
 	public function __construct() {
37
-		add_action( 'admin_menu', array( $this, 'admin_menus'), 200 );
38
-		add_action( 'admin_head', array( $this, 'admin_head' ) );
39
-		add_action( 'admin_init', array( $this, 'welcome'    ) );
40
-		add_filter( 'gravityview_is_admin_page', array( $this, 'is_dashboard_page'), 10, 2 );
37
+		add_action('admin_menu', array($this, 'admin_menus'), 200);
38
+		add_action('admin_head', array($this, 'admin_head'));
39
+		add_action('admin_init', array($this, 'welcome'));
40
+		add_filter('gravityview_is_admin_page', array($this, 'is_dashboard_page'), 10, 2);
41 41
 	}
42 42
 
43 43
 	/**
@@ -57,27 +57,27 @@  discard block
 block discarded – undo
57 57
 			__('Getting Started', 'gravityview'),
58 58
 			$this->minimum_capability,
59 59
 			'gv-getting-started',
60
-			array( $this, 'getting_started_screen' )
60
+			array($this, 'getting_started_screen')
61 61
 		);
62 62
 
63 63
 		// Changelog Page
64 64
 		add_submenu_page(
65 65
 			'edit.php?post_type=gravityview',
66
-			__( 'Changelog', 'gravityview' ),
67
-			__( 'Changelog', 'gravityview' ),
66
+			__('Changelog', 'gravityview'),
67
+			__('Changelog', 'gravityview'),
68 68
 			$this->minimum_capability,
69 69
 			'gv-changelog',
70
-			array( $this, 'changelog_screen' )
70
+			array($this, 'changelog_screen')
71 71
 		);
72 72
 
73 73
 		// Credits Page
74 74
 		add_submenu_page(
75 75
 			'edit.php?post_type=gravityview',
76
-			__( 'Credits', 'gravityview' ),
77
-			__( 'Credits', 'gravityview' ),
76
+			__('Credits', 'gravityview'),
77
+			__('Credits', 'gravityview'),
78 78
 			$this->minimum_capability,
79 79
 			'gv-credits',
80
-			array( $this, 'credits_screen' )
80
+			array($this, 'credits_screen')
81 81
 		);
82 82
 
83 83
 	}
@@ -90,9 +90,9 @@  discard block
 block discarded – undo
90 90
 	public function is_dashboard_page($is_page = false, $hook = NULL) {
91 91
 		global $plugin_page;
92 92
 
93
-		if($is_page) { return $is_page; }
93
+		if ($is_page) { return $is_page; }
94 94
 
95
-		return in_array( $plugin_page, array( 'gv-about', 'gv-credits', 'gv-getting-started' ) );
95
+		return in_array($plugin_page, array('gv-about', 'gv-credits', 'gv-getting-started'));
96 96
 	}
97 97
 
98 98
 	/**
@@ -105,10 +105,10 @@  discard block
 block discarded – undo
105 105
 	public function admin_head() {
106 106
 		global $plugin_page;
107 107
 
108
-		remove_submenu_page( 'edit.php?post_type=gravityview', 'gv-credits' );
109
-		remove_submenu_page( 'edit.php?post_type=gravityview', 'gv-changelog' );
108
+		remove_submenu_page('edit.php?post_type=gravityview', 'gv-credits');
109
+		remove_submenu_page('edit.php?post_type=gravityview', 'gv-changelog');
110 110
 
111
-		if( !$this->is_dashboard_page() ) { return; }
111
+		if (!$this->is_dashboard_page()) { return; }
112 112
 
113 113
 		?>
114 114
 		<style type="text/css" media="screen">
@@ -139,23 +139,23 @@  discard block
 block discarded – undo
139 139
 		global $plugin_page;
140 140
 
141 141
 		// Don't fetch -beta, etc.
142
-		list( $display_version ) = explode( '-', GravityView_Plugin::version );
142
+		list($display_version) = explode('-', GravityView_Plugin::version);
143 143
 
144
-		$selected = !empty( $plugin_page ) ? $plugin_page : 'gv-getting-started';
144
+		$selected = !empty($plugin_page) ? $plugin_page : 'gv-getting-started';
145 145
 		?>
146 146
 
147
-		<h1><img class="alignleft" src="<?php echo plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ); ?>" width="100" height="132" /><?php printf( esc_html__( 'Welcome to GravityView %s', 'gravityview' ), $display_version ); ?></h1>
148
-		<div class="about-text"><?php esc_html_e( 'Thank you for installing GravityView. Beautifully display your Gravity Forms entries.', 'gravityview' ); ?></div>
147
+		<h1><img class="alignleft" src="<?php echo plugins_url('assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE); ?>" width="100" height="132" /><?php printf(esc_html__('Welcome to GravityView %s', 'gravityview'), $display_version); ?></h1>
148
+		<div class="about-text"><?php esc_html_e('Thank you for installing GravityView. Beautifully display your Gravity Forms entries.', 'gravityview'); ?></div>
149 149
 
150 150
 		<h2 class="nav-tab-wrapper clear">
151
-			<a class="nav-tab <?php echo $selected == 'gv-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-getting-started', 'post_type' => 'gravityview'), 'edit.php' ) ) ); ?>">
152
-				<?php _e( "Getting Started", 'gravityview' ); ?>
151
+			<a class="nav-tab <?php echo $selected == 'gv-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'gv-getting-started', 'post_type' => 'gravityview'), 'edit.php'))); ?>">
152
+				<?php _e("Getting Started", 'gravityview'); ?>
153 153
 			</a>
154
-			<a class="nav-tab <?php echo $selected == 'gv-changelog' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-changelog', 'post_type' => 'gravityview'), 'edit.php' ) ) ); ?>">
155
-				<?php _e( "List of Changes", 'gravityview' ); ?>
154
+			<a class="nav-tab <?php echo $selected == 'gv-changelog' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'gv-changelog', 'post_type' => 'gravityview'), 'edit.php'))); ?>">
155
+				<?php _e("List of Changes", 'gravityview'); ?>
156 156
 			</a>
157
-			<a class="nav-tab <?php echo $selected == 'gv-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-credits', 'post_type' => 'gravityview'), 'edit.php' ) ) ); ?>">
158
-				<?php _e( 'Credits', 'gravityview' ); ?>
157
+			<a class="nav-tab <?php echo $selected == 'gv-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'gv-credits', 'post_type' => 'gravityview'), 'edit.php'))); ?>">
158
+				<?php _e('Credits', 'gravityview'); ?>
159 159
 			</a>
160 160
 		</h2>
161 161
 		<?php
@@ -205,14 +205,14 @@  discard block
 block discarded – undo
205 205
 
206 206
 				<div class="last-feature">
207 207
 				<h2>Embed Views in Posts &amp; Pages</h2>
208
-					<p><img src="<?php echo plugins_url( 'assets/images/screenshots/add-view-button.png', GRAVITYVIEW_FILE ); ?>" class="gv-welcome-screenshots" height="35" width="97" />Views don&rsquo;t need to be embedded in a post or page, but you can if you want. Embed Views using the "Add View" button above your content editor.</p>
208
+					<p><img src="<?php echo plugins_url('assets/images/screenshots/add-view-button.png', GRAVITYVIEW_FILE); ?>" class="gv-welcome-screenshots" height="35" width="97" />Views don&rsquo;t need to be embedded in a post or page, but you can if you want. Embed Views using the "Add View" button above your content editor.</p>
209 209
 				</div>
210 210
 
211 211
 			</div>
212 212
 
213 213
 			<div class="feature-section clear">
214 214
 				<h2>Configure Multiple Entry, Single Entry, and Edit Entry Layouts</h2>
215
-				<p><img src="<?php echo plugins_url( 'assets/images/screenshots/add-field.png', GRAVITYVIEW_FILE ); ?>" alt="Add a field dialog box" class="gv-welcome-screenshots" />You can configure what fields are displayed in <strong>Multiple Entry</strong>, <strong>Single Entry</strong>, and <strong>Edit Entry</strong> modes. These can be configured by clicking on the tabs in "View Configuration."</p>
215
+				<p><img src="<?php echo plugins_url('assets/images/screenshots/add-field.png', GRAVITYVIEW_FILE); ?>" alt="Add a field dialog box" class="gv-welcome-screenshots" />You can configure what fields are displayed in <strong>Multiple Entry</strong>, <strong>Single Entry</strong>, and <strong>Edit Entry</strong> modes. These can be configured by clicking on the tabs in "View Configuration."</p>
216 216
 
217 217
 				<ul class="ul-disc">
218 218
 					<li>Click "+ Add Field" to add a field to a zone</li>
@@ -256,13 +256,13 @@  discard block
 block discarded – undo
256 256
 
257 257
 				<div class="feature-section col two-col" style="margin:0; padding: 0;">
258 258
 					<div class="col col-1">
259
-						<div class="media-container" style="min-height:81px; border: none;"><img src="<?php echo plugins_url( 'assets/images/screenshots/pricing-merge-tags.jpg', GRAVITYVIEW_FILE ); ?>" alt="Pricing merge tags"></div>
259
+						<div class="media-container" style="min-height:81px; border: none;"><img src="<?php echo plugins_url('assets/images/screenshots/pricing-merge-tags.jpg', GRAVITYVIEW_FILE); ?>" alt="Pricing merge tags"></div>
260 260
 						<h4 class="higher">Pricing Merge Tags</h4>
261 261
 						<p>GravityView now offers better support for pricing Merge Tags to show details about orers. <a href="http://docs.gravityview.co/article/76-merge-tags">Read more about the Merge Tags</a>.</p>
262 262
 					</div>
263 263
 
264 264
 					<div class="col col-2 last-feature">
265
-						<div class="media-container" style="margin-top: 2em; min-height:80px;"><img src="<?php echo plugins_url( 'assets/images/screenshots/developing-future.jpg', GRAVITYVIEW_FILE ); ?>" alt="Developing the Future"></div>
265
+						<div class="media-container" style="margin-top: 2em; min-height:80px;"><img src="<?php echo plugins_url('assets/images/screenshots/developing-future.jpg', GRAVITYVIEW_FILE); ?>" alt="Developing the Future"></div>
266 266
 						<h4 class="higher">Laying the Groundwork</h4>
267 267
 						<p>We&rsquo;re working on a great new View Builder to make it easier than ever to configure View layouts. This release includes lots of behind-the-scenes&nbsp;changes.</p>
268 268
 					</div>
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
 
479 479
 			<?php $this->tabs(); ?>
480 480
 
481
-			<p class="about-description"><?php _e( 'GravityView is brought to you by:', 'gravityview' ); ?></p>
481
+			<p class="about-description"><?php _e('GravityView is brought to you by:', 'gravityview'); ?></p>
482 482
 
483 483
 			<div class="feature-section col two-col">
484 484
 
@@ -486,14 +486,14 @@  discard block
 block discarded – undo
486 486
 					<h2>Zack Katz</h2>
487 487
 					<h4 style="font-weight:0; margin-top:0">Project Lead &amp; Developer</h4>
488 488
 					<p></p>
489
-					<p><img style="float:left; margin: 0 15px 10px 0;" src="<?php echo plugins_url( 'assets/images/zack.jpg', GRAVITYVIEW_FILE ); ?>" width="94" height="94" />Zack has been developing integrations with Gravity Forms since 2009. He is the President of Katz Web Services and lives with his wife (and cat) in Denver, Colorado.</p>
489
+					<p><img style="float:left; margin: 0 15px 10px 0;" src="<?php echo plugins_url('assets/images/zack.jpg', GRAVITYVIEW_FILE); ?>" width="94" height="94" />Zack has been developing integrations with Gravity Forms since 2009. He is the President of Katz Web Services and lives with his wife (and cat) in Denver, Colorado.</p>
490 490
 					<p><a href="https://katz.co">View Zack&rsquo;s website</a></p>
491 491
 				</div>
492 492
 
493 493
 				<div class="col last-feature">
494 494
 					<h2>Luis Godinho</h2>
495 495
 					<h4 style="font-weight:0; margin-top:0">Developer &amp; Support</h4>
496
-					<p><img style="margin: 0 15px 10px 0;"  class="alignleft avatar" src="<?php echo plugins_url( 'assets/images/luis.jpg', GRAVITYVIEW_FILE ); ?>" width="94" height="94" />Luis is a WordPress developer passionate about WordPress. He is a co-founder and partner of GOMO, a digital agency located in Lisbon, Portugal.</p>
496
+					<p><img style="margin: 0 15px 10px 0;"  class="alignleft avatar" src="<?php echo plugins_url('assets/images/luis.jpg', GRAVITYVIEW_FILE); ?>" width="94" height="94" />Luis is a WordPress developer passionate about WordPress. He is a co-founder and partner of GOMO, a digital agency located in Lisbon, Portugal.</p>
497 497
 					<p><a href="http://tinygod.pt">View Luis&rsquo;s website</a></p>
498 498
 				</div>
499 499
 
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 
504 504
 			<div class="feature-section">
505 505
 				<div>
506
-					<h2><?php esc_attr_e( 'Contributors', 'gravityview' ); ?></h2>
506
+					<h2><?php esc_attr_e('Contributors', 'gravityview'); ?></h2>
507 507
 
508 508
 					<ul class="wp-people-group">
509 509
 						<li class="wp-person">Bengali translation by <a href="https://www.transifex.com/accounts/profile/tareqhi/">@tareqhi</a></li>
@@ -524,8 +524,8 @@  discard block
 block discarded – undo
524 524
 						<li class="wp-person">Code contributions by <a href="https://github.com/ryanduff">@ryanduff</a> and <a href="https://github.com/dmlinn">@dmlinn</a></li>
525 525
 					</ul>
526 526
 
527
-					<h4><?php esc_attr_e( 'Want to contribute?', 'gravityview' ); ?></h4>
528
-					<p><?php echo sprintf( esc_attr__( 'If you want to contribute to the code, %syou can on Github%s. If your contributions are accepted, you will be thanked here.', 'gravityview'), '<a href="https://github.com/katzwebservices/GravityView">', '</a>' ); ?></p>
527
+					<h4><?php esc_attr_e('Want to contribute?', 'gravityview'); ?></h4>
528
+					<p><?php echo sprintf(esc_attr__('If you want to contribute to the code, %syou can on Github%s. If your contributions are accepted, you will be thanked here.', 'gravityview'), '<a href="https://github.com/katzwebservices/GravityView">', '</a>'); ?></p>
529 529
 				</div>
530 530
 			</div>
531 531
 
@@ -565,34 +565,34 @@  discard block
 block discarded – undo
565 565
 		global $plugin_page;
566 566
 
567 567
 		// Bail if we're just editing the plugin
568
-		if( $plugin_page === 'plugin-editor.php' ) { return; }
568
+		if ($plugin_page === 'plugin-editor.php') { return; }
569 569
 
570 570
 		// Bail if no activation redirect
571
-		if ( ! get_transient( '_gv_activation_redirect' ) ) { return; }
571
+		if (!get_transient('_gv_activation_redirect')) { return; }
572 572
 
573 573
 		// Delete the redirect transient
574
-		delete_transient( '_gv_activation_redirect' );
574
+		delete_transient('_gv_activation_redirect');
575 575
 
576
-		$upgrade = get_option( 'gv_version_upgraded_from' );
576
+		$upgrade = get_option('gv_version_upgraded_from');
577 577
 
578 578
 		// Don't do anything if they've already seen the new version info
579
-		if( $upgrade === GravityView_Plugin::version ) {
579
+		if ($upgrade === GravityView_Plugin::version) {
580 580
 			return;
581 581
 		}
582 582
 
583 583
 		// Add "Upgraded From" Option
584
-		update_option( 'gv_version_upgraded_from', GravityView_Plugin::version );
584
+		update_option('gv_version_upgraded_from', GravityView_Plugin::version);
585 585
 
586 586
 		// Bail if activating from network, or bulk
587
-		if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { return; }
587
+		if (is_network_admin() || isset($_GET['activate-multi'])) { return; }
588 588
 
589 589
 		// First time install
590
-		if( ! $upgrade ) {
591
-			wp_safe_redirect( admin_url( 'edit.php?post_type=gravityview&page=gv-getting-started' ) ); exit;
590
+		if (!$upgrade) {
591
+			wp_safe_redirect(admin_url('edit.php?post_type=gravityview&page=gv-getting-started')); exit;
592 592
 		}
593 593
 		// Update
594 594
 		else {
595
-			wp_safe_redirect( admin_url( 'edit.php?post_type=gravityview&page=gv-changelog' ) ); exit;
595
+			wp_safe_redirect(admin_url('edit.php?post_type=gravityview&page=gv-changelog')); exit;
596 596
 		}
597 597
 	}
598 598
 }
Please login to merge, or discard this patch.
includes/class-common.php 1 patch
Spacing   +316 added lines, -316 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  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
 
@@ -25,18 +25,18 @@  discard block
 block discarded – undo
25 25
 	 * @param mixed $form_id
26 26
 	 * @return mixed False: no form ID specified or Gravity Forms isn't active. Array: Form returned from Gravity Forms
27 27
 	 */
28
-	public static function get_form( $form_id ) {
29
-		if ( empty( $form_id ) ) {
28
+	public static function get_form($form_id) {
29
+		if (empty($form_id)) {
30 30
 			return false;
31 31
 		}
32 32
 
33 33
 		// Only get_form_meta is cached. ::facepalm::
34
-		if ( class_exists( 'RGFormsModel' ) ) {
35
-			return GFFormsModel::get_form_meta( $form_id );
34
+		if (class_exists('RGFormsModel')) {
35
+			return GFFormsModel::get_form_meta($form_id);
36 36
 		}
37 37
 
38
-		if ( class_exists( 'GFAPI' ) ) {
39
-			return GFAPI::get_form( $form_id );
38
+		if (class_exists('GFAPI')) {
39
+			return GFAPI::get_form($form_id);
40 40
 		}
41 41
 
42 42
 		return false;
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
 	 *
56 56
 	 * @return bool True: user has at least one passed capability; False: user does not have any defined capabilities
57 57
 	 */
58
-	public static function has_cap( $caps = '', $object_id = null, $user_id = null ) {
59
-		return GravityView_Roles_Capabilities::has_cap( $caps, $object_id, $user_id );
58
+	public static function has_cap($caps = '', $object_id = null, $user_id = null) {
59
+		return GravityView_Roles_Capabilities::has_cap($caps, $object_id, $user_id);
60 60
 	}
61 61
 
62 62
 	/**
@@ -67,14 +67,14 @@  discard block
 block discarded – undo
67 67
 	 * @param array|GF_Fields $field Gravity Forms field or array
68 68
 	 * @return array Array version of $field
69 69
 	 */
70
-	public static function get_field_array( $field ) {
70
+	public static function get_field_array($field) {
71 71
 
72
-		if ( class_exists( 'GF_Fields' ) ) {
72
+		if (class_exists('GF_Fields')) {
73 73
 
74
-			$field_object = GF_Fields::create( $field );
74
+			$field_object = GF_Fields::create($field);
75 75
 
76 76
 			// Convert the field object in 1.9 to an array for backward compatibility
77
-			$field_array = get_object_vars( $field_object );
77
+			$field_array = get_object_vars($field_object);
78 78
 
79 79
 		} else {
80 80
 			$field_array = $field;
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	 *
94 94
 	 * @return array Array of Views as `WP_Post`. Empty array if none found.
95 95
 	 */
96
-	public static function get_all_views( $args = array() ) {
96
+	public static function get_all_views($args = array()) {
97 97
 
98 98
 		$default_params = array(
99 99
 			'post_type' => 'gravityview',
@@ -101,15 +101,15 @@  discard block
 block discarded – undo
101 101
 			'post_status' => 'publish',
102 102
 		);
103 103
 
104
-		$params = wp_parse_args( $args, $default_params );
104
+		$params = wp_parse_args($args, $default_params);
105 105
 
106 106
 		/**
107 107
 		 * @filter `gravityview/get_all_views/params` Modify the parameters sent to get all views.
108 108
 		 * @param[in,out]  array $params Array of parameters to pass to `get_posts()`
109 109
 		 */
110
-		$views_params = apply_filters( 'gravityview/get_all_views/params', $params );
110
+		$views_params = apply_filters('gravityview/get_all_views/params', $params);
111 111
 
112
-		$views = get_posts( $views_params );
112
+		$views = get_posts($views_params);
113 113
 
114 114
 		return $views;
115 115
 	}
@@ -120,11 +120,11 @@  discard block
 block discarded – undo
120 120
 	 * @param  int|string $entry_slug Entry slug
121 121
 	 * @return array           Gravity Forms form array
122 122
 	 */
123
-	public static function get_form_from_entry_id( $entry_slug ) {
123
+	public static function get_form_from_entry_id($entry_slug) {
124 124
 
125
-		$entry = self::get_entry( $entry_slug, true );
125
+		$entry = self::get_entry($entry_slug, true);
126 126
 
127
-		$form = self::get_form( $entry['form_id'] );
127
+		$form = self::get_form($entry['form_id']);
128 128
 
129 129
 		return $form;
130 130
 	}
@@ -138,13 +138,13 @@  discard block
 block discarded – undo
138 138
 	 *
139 139
 	 * @return bool|GF_Field[]
140 140
 	 */
141
-	public static function has_product_field( $form = array() ) {
141
+	public static function has_product_field($form = array()) {
142 142
 
143
-		$product_fields = apply_filters( 'gform_product_field_types', array( 'option', 'quantity', 'product', 'total', 'shipping', 'calculation', 'price' ) );
143
+		$product_fields = apply_filters('gform_product_field_types', array('option', 'quantity', 'product', 'total', 'shipping', 'calculation', 'price'));
144 144
 
145
-		$fields = GFAPI::get_fields_by_type( $form, $product_fields );
145
+		$fields = GFAPI::get_fields_by_type($form, $product_fields);
146 146
 
147
-		return empty( $fields ) ? false : $fields;
147
+		return empty($fields) ? false : $fields;
148 148
 	}
149 149
 
150 150
 	/**
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	 * @param  string $slug The entry slug, as returned by GravityView_API::get_entry_slug()
155 155
 	 * @return int|null       The entry ID, if exists; `NULL` if not
156 156
 	 */
157
-	public static function get_entry_id_from_slug( $slug ) {
157
+	public static function get_entry_id_from_slug($slug) {
158 158
 		global $wpdb;
159 159
 
160 160
 		$search_criteria = array(
@@ -173,9 +173,9 @@  discard block
 block discarded – undo
173 173
 			'page_size' => 1,
174 174
 		);
175 175
 
176
-		$results = GFAPI::get_entries( 0, $search_criteria, null, $paging );
176
+		$results = GFAPI::get_entries(0, $search_criteria, null, $paging);
177 177
 
178
-		$result = ( ! empty( $results ) && ! empty( $results[0]['id'] ) ) ? $results[0]['id'] : null;
178
+		$result = (!empty($results) && !empty($results[0]['id'])) ? $results[0]['id'] : null;
179 179
 
180 180
 		return $result;
181 181
 	}
@@ -190,9 +190,9 @@  discard block
 block discarded – undo
190 190
 	 */
191 191
 	public static function get_forms() {
192 192
 		$forms = array();
193
-		if ( class_exists( 'GFAPI' ) ) {
193
+		if (class_exists('GFAPI')) {
194 194
 			$gf_forms = GFAPI::get_forms();
195
-			foreach ( $gf_forms as $form ) {
195
+			foreach ($gf_forms as $form) {
196 196
 				$forms[] = array(
197 197
 					'id' => $form['id'],
198 198
 					'title' => $form['title'],
@@ -209,10 +209,10 @@  discard block
 block discarded – undo
209 209
 	 * @param string|array $form_id (default: '') or $form object
210 210
 	 * @return array
211 211
 	 */
212
-	public static function get_form_fields( $form = '', $add_default_properties = false, $include_parent_field = true ) {
212
+	public static function get_form_fields($form = '', $add_default_properties = false, $include_parent_field = true) {
213 213
 
214
-		if ( ! is_array( $form ) ) {
215
-			$form = self::get_form( $form );
214
+		if (!is_array($form)) {
215
+			$form = self::get_form($form);
216 216
 		}
217 217
 
218 218
 		$fields = array();
@@ -222,56 +222,56 @@  discard block
 block discarded – undo
222 222
 		$has_poll_fields = false;
223 223
 
224 224
 		// If GF_Field exists, we're using GF 1.9+, where add_default_properties has been deprecated.
225
-		if ( false === class_exists( 'GF_Field' ) && $add_default_properties ) {
226
-			$form = RGFormsModel::add_default_properties( $form );
225
+		if (false === class_exists('GF_Field') && $add_default_properties) {
226
+			$form = RGFormsModel::add_default_properties($form);
227 227
 		}
228 228
 
229
-		if ( $form ) {
230
-			foreach ( $form['fields'] as $field ) {
231
-				if ( $include_parent_field || empty( $field['inputs'] ) ) {
232
-					$fields[ $field['id'] ] = array(
233
-						'label' => rgar( $field, 'label' ),
229
+		if ($form) {
230
+			foreach ($form['fields'] as $field) {
231
+				if ($include_parent_field || empty($field['inputs'])) {
232
+					$fields[$field['id']] = array(
233
+						'label' => rgar($field, 'label'),
234 234
 						'parent' => null,
235
-						'type' => rgar( $field, 'type' ),
236
-						'adminLabel' => rgar( $field, 'adminLabel' ),
237
-						'adminOnly' => rgar( $field, 'adminOnly' ),
235
+						'type' => rgar($field, 'type'),
236
+						'adminLabel' => rgar($field, 'adminLabel'),
237
+						'adminOnly' => rgar($field, 'adminOnly'),
238 238
 					);
239 239
 				}
240 240
 
241
-				if ( $add_default_properties && ! empty( $field['inputs'] ) ) {
242
-					foreach ( $field['inputs'] as $input ) {
241
+				if ($add_default_properties && !empty($field['inputs'])) {
242
+					foreach ($field['inputs'] as $input) {
243 243
                         /**
244 244
                          * @hack
245 245
                          * In case of email/email confirmation, the input for email has the same id as the parent field
246 246
                          */
247
-                        if( 'email' == rgar( $field, 'type' ) && false === strpos( $input['id'], '.' ) ) {
247
+                        if ('email' == rgar($field, 'type') && false === strpos($input['id'], '.')) {
248 248
                             continue;
249 249
                         }
250
-						$fields[ (string)$input['id'] ] = array(
251
-							'label' => rgar( $input, 'label' ),
252
-							'customLabel' => rgar( $input, 'customLabel' ),
250
+						$fields[(string)$input['id']] = array(
251
+							'label' => rgar($input, 'label'),
252
+							'customLabel' => rgar($input, 'customLabel'),
253 253
 							'parent' => $field,
254
-							'type' => rgar( $field, 'type' ),
255
-							'adminLabel' => rgar( $field, 'adminLabel' ),
256
-							'adminOnly' => rgar( $field, 'adminOnly' ),
254
+							'type' => rgar($field, 'type'),
255
+							'adminLabel' => rgar($field, 'adminLabel'),
256
+							'adminOnly' => rgar($field, 'adminOnly'),
257 257
 						);
258 258
 					}
259 259
 				}
260 260
 
261 261
 				/** @since 1.14 */
262
-				if( 'list' === $field['type'] && !empty( $field['enableColumns'] ) ) {
262
+				if ('list' === $field['type'] && !empty($field['enableColumns'])) {
263 263
 
264
-					foreach ( (array)$field['choices'] as $key => $input ) {
264
+					foreach ((array)$field['choices'] as $key => $input) {
265 265
 
266
-						$input_id = sprintf( '%d.%d', $field['id'], $key ); // {field_id}.{column_key}
266
+						$input_id = sprintf('%d.%d', $field['id'], $key); // {field_id}.{column_key}
267 267
 
268
-						$fields[ $input_id ] = array(
269
-							'label'       => rgar( $input, 'text' ),
268
+						$fields[$input_id] = array(
269
+							'label'       => rgar($input, 'text'),
270 270
 							'customLabel' => '',
271 271
 							'parent'      => $field,
272
-							'type'        => rgar( $field, 'type' ),
273
-							'adminLabel'  => rgar( $field, 'adminLabel' ),
274
-							'adminOnly'   => rgar( $field, 'adminOnly' ),
272
+							'type'        => rgar($field, 'type'),
273
+							'adminLabel'  => rgar($field, 'adminLabel'),
274
+							'adminOnly'   => rgar($field, 'adminOnly'),
275 275
 						);
276 276
 					}
277 277
 				}
@@ -279,27 +279,27 @@  discard block
 block discarded – undo
279 279
 				/**
280 280
 				 * @since 1.8
281 281
 				 */
282
-				if( 'quiz' === $field['type'] ) {
282
+				if ('quiz' === $field['type']) {
283 283
 					$has_quiz_fields = true;
284 284
 				}
285 285
 
286 286
 				/**
287 287
 				 * @since 1.8
288 288
 				 */
289
-				if( 'poll' === $field['type'] ) {
289
+				if ('poll' === $field['type']) {
290 290
 					$has_poll_fields = true;
291 291
 				}
292 292
 
293
-				if( GFCommon::is_product_field( $field['type'] ) ){
293
+				if (GFCommon::is_product_field($field['type'])) {
294 294
 					$has_product_fields = true;
295 295
 				}
296 296
 
297 297
 				/**
298 298
 				 * @hack Version 1.9
299 299
 				 */
300
-				$field_for_is_post_field = class_exists( 'GF_Fields' ) ? (object) $field : (array) $field;
300
+				$field_for_is_post_field = class_exists('GF_Fields') ? (object)$field : (array)$field;
301 301
 
302
-				if ( GFCommon::is_post_field( $field_for_is_post_field ) ) {
302
+				if (GFCommon::is_post_field($field_for_is_post_field)) {
303 303
 					$has_post_fields = true;
304 304
 				}
305 305
 			}
@@ -308,19 +308,19 @@  discard block
 block discarded – undo
308 308
 		/**
309 309
 		 * @since 1.7
310 310
 		 */
311
-		if ( $has_post_fields ) {
311
+		if ($has_post_fields) {
312 312
 			$fields['post_id'] = array(
313
-				'label' => __( 'Post ID', 'gravityview' ),
313
+				'label' => __('Post ID', 'gravityview'),
314 314
 				'type' => 'post_id',
315 315
 			);
316 316
 		}
317 317
 
318
-		if ( $has_product_fields ) {
318
+		if ($has_product_fields) {
319 319
 
320
-			$payment_fields = GravityView_Fields::get_all( 'pricing' );
320
+			$payment_fields = GravityView_Fields::get_all('pricing');
321 321
 
322
-			foreach ( $payment_fields as $payment_field ) {
323
-				if( isset( $fields["{$payment_field->name}"] ) ) {
322
+			foreach ($payment_fields as $payment_field) {
323
+				if (isset($fields["{$payment_field->name}"])) {
324 324
 					continue;
325 325
 				}
326 326
 				$fields["{$payment_field->name}"] = array(
@@ -334,27 +334,27 @@  discard block
 block discarded – undo
334 334
 		/**
335 335
 		 * @since 1.8
336 336
 		 */
337
-		if( $has_quiz_fields ) {
337
+		if ($has_quiz_fields) {
338 338
 
339
-			$fields['gquiz_score']   = array(
340
-				'label' => __( 'Quiz Score Total', 'gravityview' ),
339
+			$fields['gquiz_score'] = array(
340
+				'label' => __('Quiz Score Total', 'gravityview'),
341 341
 				'type'  => 'quiz_score',
342
-				'desc'  => __( 'Displays the number of correct Quiz answers the user submitted.', 'gravityview' ),
342
+				'desc'  => __('Displays the number of correct Quiz answers the user submitted.', 'gravityview'),
343 343
 			);
344 344
 			$fields['gquiz_percent'] = array(
345
-				'label' => __( 'Quiz Percentage Grade', 'gravityview' ),
345
+				'label' => __('Quiz Percentage Grade', 'gravityview'),
346 346
 				'type'  => 'quiz_percent',
347
-				'desc'  => __( 'Displays the percentage of correct Quiz answers the user submitted.', 'gravityview' ),
347
+				'desc'  => __('Displays the percentage of correct Quiz answers the user submitted.', 'gravityview'),
348 348
 			);
349
-			$fields['gquiz_grade']   = array(
350
-				'label' => __( 'Quiz Letter Grade', 'gravityview' ),
349
+			$fields['gquiz_grade'] = array(
350
+				'label' => __('Quiz Letter Grade', 'gravityview'),
351 351
 				'type'  => 'quiz_grade',
352
-				'desc'  => __( 'Displays the Grade the user achieved based on Letter Grading configured in the Quiz Settings.', 'gravityview' ),
352
+				'desc'  => __('Displays the Grade the user achieved based on Letter Grading configured in the Quiz Settings.', 'gravityview'),
353 353
 			);
354 354
 			$fields['gquiz_is_pass'] = array(
355
-				'label' => __( 'Quiz Pass/Fail', 'gravityview' ),
355
+				'label' => __('Quiz Pass/Fail', 'gravityview'),
356 356
 				'type'  => 'quiz_is_pass',
357
-				'desc'  => __( 'Displays either Passed or Failed based on the Pass/Fail settings configured in the Quiz Settings.', 'gravityview' ),
357
+				'desc'  => __('Displays either Passed or Failed based on the Pass/Fail settings configured in the Quiz Settings.', 'gravityview'),
358 358
 			);
359 359
 		}
360 360
 
@@ -367,15 +367,15 @@  discard block
 block discarded – undo
367 367
 	 * @param  string $form_id (default: '')
368 368
 	 * @return array
369 369
 	 */
370
-	public static function get_entry_meta( $form_id, $only_default_column = true ) {
370
+	public static function get_entry_meta($form_id, $only_default_column = true) {
371 371
 
372
-		$extra_fields = GFFormsModel::get_entry_meta( $form_id );
372
+		$extra_fields = GFFormsModel::get_entry_meta($form_id);
373 373
 
374 374
 		$fields = array();
375 375
 
376
-		foreach ( $extra_fields as $key => $field ){
377
-			if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) {
378
-				$fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' );
376
+		foreach ($extra_fields as $key => $field) {
377
+			if (!empty($only_default_column) && !empty($field['is_default_column'])) {
378
+				$fields[$key] = array('label' => $field['label'], 'type' => 'entry_meta');
379 379
 			}
380 380
 		}
381 381
 
@@ -391,13 +391,13 @@  discard block
 block discarded – undo
391 391
 	 * @since  1.1.6
392 392
 	 * @return array|void          Array of entry IDs. Void if Gravity Forms isn't active.
393 393
 	 */
394
-	public static function get_entry_ids( $form_id, $search_criteria = array() ) {
394
+	public static function get_entry_ids($form_id, $search_criteria = array()) {
395 395
 
396
-		if ( ! class_exists( 'GFFormsModel' ) ) {
396
+		if (!class_exists('GFFormsModel')) {
397 397
 			return;
398 398
 		}
399 399
 
400
-		return GFFormsModel::search_lead_ids( $form_id, $search_criteria );
400
+		return GFFormsModel::search_lead_ids($form_id, $search_criteria);
401 401
 	}
402 402
 
403 403
 	/**
@@ -409,33 +409,33 @@  discard block
 block discarded – undo
409 409
 	 * @param array $form_ids array Gravity Forms form IDs
410 410
 	 * @return array
411 411
 	 */
412
-	public static function calculate_get_entries_criteria( $passed_criteria = array(), $form_ids = array() ) {
412
+	public static function calculate_get_entries_criteria($passed_criteria = array(), $form_ids = array()) {
413 413
 
414 414
 		$search_criteria_defaults = array(
415 415
 			'search_criteria' => null,
416 416
 			'sorting' => null,
417 417
 			'paging' => null,
418
-			'cache' => (isset( $passed_criteria['cache'] ) ? $passed_criteria['cache'] : true),
418
+			'cache' => (isset($passed_criteria['cache']) ? $passed_criteria['cache'] : true),
419 419
 		);
420 420
 
421
-		$criteria = wp_parse_args( $passed_criteria, $search_criteria_defaults );
421
+		$criteria = wp_parse_args($passed_criteria, $search_criteria_defaults);
422 422
 
423
-		if ( ! empty( $criteria['search_criteria']['field_filters'] ) ) {
424
-			foreach ( $criteria['search_criteria']['field_filters'] as &$filter ) {
423
+		if (!empty($criteria['search_criteria']['field_filters'])) {
424
+			foreach ($criteria['search_criteria']['field_filters'] as &$filter) {
425 425
 
426
-				if ( ! is_array( $filter ) ) {
426
+				if (!is_array($filter)) {
427 427
 					continue;
428 428
 				}
429 429
 
430 430
 				// By default, we want searches to be wildcard for each field.
431
-				$filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator'];
431
+				$filter['operator'] = empty($filter['operator']) ? 'contains' : $filter['operator'];
432 432
 
433 433
 				/**
434 434
 				 * @filter `gravityview_search_operator` Modify the search operator for the field (contains, is, isnot, etc)
435 435
 				 * @param string $operator Existing search operator
436 436
 				 * @param array $filter array with `key`, `value`, `operator`, `type` keys
437 437
 				 */
438
-				$filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter );
438
+				$filter['operator'] = apply_filters('gravityview_search_operator', $filter['operator'], $filter);
439 439
 			}
440 440
 		}
441 441
 
@@ -443,32 +443,32 @@  discard block
 block discarded – undo
443 443
 		 * Prepare date formats to be in Gravity Forms DB format;
444 444
 		 * $passed_criteria may include date formats incompatible with Gravity Forms.
445 445
 		 */
446
-		foreach ( array('start_date', 'end_date' ) as $key ) {
446
+		foreach (array('start_date', 'end_date') as $key) {
447 447
 
448
-			if ( ! empty( $criteria['search_criteria'][ $key ] ) ) {
448
+			if (!empty($criteria['search_criteria'][$key])) {
449 449
 
450 450
 				// Use date_create instead of new DateTime so it returns false if invalid date format.
451
-				$date = date_create( $criteria['search_criteria'][ $key ] );
451
+				$date = date_create($criteria['search_criteria'][$key]);
452 452
 
453
-				if ( $date ) {
453
+				if ($date) {
454 454
 					// Gravity Forms wants dates in the `Y-m-d H:i:s` format.
455
-					$criteria['search_criteria'][ $key ] = $date->format( 'Y-m-d H:i:s' );
455
+					$criteria['search_criteria'][$key] = $date->format('Y-m-d H:i:s');
456 456
 				} else {
457 457
 					// If it's an invalid date, unset it. Gravity Forms freaks out otherwise.
458
-					unset( $criteria['search_criteria'][ $key ] );
458
+					unset($criteria['search_criteria'][$key]);
459 459
 
460
-					do_action( 'gravityview_log_error', '[filter_get_entries_criteria] '.$key.' Date format not valid:', $criteria['search_criteria'][ $key ] );
460
+					do_action('gravityview_log_error', '[filter_get_entries_criteria] '.$key.' Date format not valid:', $criteria['search_criteria'][$key]);
461 461
 				}
462 462
 			}
463 463
 		}
464 464
 
465 465
 
466 466
 		// When multiple views are embedded, OR single entry, calculate the context view id and send it to the advanced filter
467
-		if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() || GravityView_frontend::getInstance()->getSingleEntry() ) {
467
+		if (class_exists('GravityView_View_Data') && GravityView_View_Data::getInstance()->has_multiple_views() || GravityView_frontend::getInstance()->getSingleEntry()) {
468 468
 			$criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id();
469
-		} elseif ( 'delete' === RGForms::get( 'action' ) ) {
470
-			$criteria['context_view_id'] = isset( $_GET['view_id'] ) ? $_GET['view_id'] : null;
471
-		} elseif( !isset( $criteria['context_view_id'] ) ) {
469
+		} elseif ('delete' === RGForms::get('action')) {
470
+			$criteria['context_view_id'] = isset($_GET['view_id']) ? $_GET['view_id'] : null;
471
+		} elseif (!isset($criteria['context_view_id'])) {
472 472
             // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget)
473 473
 			$criteria['context_view_id'] = null;
474 474
 		}
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
 		 * @param array $form_ids Forms to search
480 480
 		 * @param int $view_id ID of the view being used to search
481 481
 		 */
482
-		$criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria['context_view_id'] );
482
+		$criteria = apply_filters('gravityview_search_criteria', $criteria, $form_ids, $criteria['context_view_id']);
483 483
 
484 484
 		return (array)$criteria;
485 485
 
@@ -497,35 +497,35 @@  discard block
 block discarded – undo
497 497
 	 * @param mixed &$total Optional. An output parameter containing the total number of entries. Pass a non-null value to generate the total count. (default: null)
498 498
 	 * @return mixed False: Error fetching entries. Array: Multi-dimensional array of Gravity Forms entry arrays
499 499
 	 */
500
-	public static function get_entries( $form_ids = null, $passed_criteria = null, &$total = null ) {
500
+	public static function get_entries($form_ids = null, $passed_criteria = null, &$total = null) {
501 501
 
502 502
 		// Filter the criteria before query (includes Adv Filter)
503
-		$criteria = self::calculate_get_entries_criteria( $passed_criteria, $form_ids );
503
+		$criteria = self::calculate_get_entries_criteria($passed_criteria, $form_ids);
504 504
 
505
-		do_action( 'gravityview_log_debug', '[gravityview_get_entries] Final Parameters', $criteria );
505
+		do_action('gravityview_log_debug', '[gravityview_get_entries] Final Parameters', $criteria);
506 506
 
507 507
 		// Return value
508 508
 		$return = null;
509 509
 
510 510
 		/** Reduce # of database calls */
511
-		add_filter( 'gform_is_encrypted_field', '__return_false' );
511
+		add_filter('gform_is_encrypted_field', '__return_false');
512 512
 
513
-		if ( ! empty( $criteria['cache'] ) ) {
513
+		if (!empty($criteria['cache'])) {
514 514
 
515
-			$Cache = new GravityView_Cache( $form_ids, $criteria );
515
+			$Cache = new GravityView_Cache($form_ids, $criteria);
516 516
 
517
-			if ( $entries = $Cache->get() ) {
517
+			if ($entries = $Cache->get()) {
518 518
 
519 519
 				// Still update the total count when using cached results
520
-				if ( ! is_null( $total ) ) {
521
-					$total = GFAPI::count_entries( $form_ids, $criteria['search_criteria'] );
520
+				if (!is_null($total)) {
521
+					$total = GFAPI::count_entries($form_ids, $criteria['search_criteria']);
522 522
 				}
523 523
 
524 524
 				$return = $entries;
525 525
 			}
526 526
 		}
527 527
 
528
-		if ( is_null( $return ) && class_exists( 'GFAPI' ) && ( is_numeric( $form_ids ) || is_array( $form_ids ) ) ) {
528
+		if (is_null($return) && class_exists('GFAPI') && (is_numeric($form_ids) || is_array($form_ids))) {
529 529
 
530 530
 			/**
531 531
 			 * @filter `gravityview_pre_get_entries` Define entries to be used before GFAPI::get_entries() is called
@@ -535,24 +535,24 @@  discard block
 block discarded – undo
535 535
 			 * @param array $passed_criteria The original search criteria passed to `GVCommon::get_entries()`
536 536
 			 * @param  int|null $total Optional. An output parameter containing the total number of entries. Pass a non-null value to generate
537 537
 			 */
538
-			$entries = apply_filters( 'gravityview_before_get_entries', null, $criteria, $passed_criteria, $total );
538
+			$entries = apply_filters('gravityview_before_get_entries', null, $criteria, $passed_criteria, $total);
539 539
 
540 540
 			// No entries returned from gravityview_before_get_entries
541
-			if( is_null( $entries ) ) {
541
+			if (is_null($entries)) {
542 542
 
543
-				$entries = GFAPI::get_entries( $form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total );
543
+				$entries = GFAPI::get_entries($form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total);
544 544
 
545
-				if ( is_wp_error( $entries ) ) {
546
-					do_action( 'gravityview_log_error', $entries->get_error_message(), $entries );
545
+				if (is_wp_error($entries)) {
546
+					do_action('gravityview_log_error', $entries->get_error_message(), $entries);
547 547
 
548 548
 					return false;
549 549
 				}
550 550
 			}
551 551
 
552
-			if ( ! empty( $criteria['cache'] ) && isset( $Cache ) ) {
552
+			if (!empty($criteria['cache']) && isset($Cache)) {
553 553
 
554 554
 				// Cache results
555
-				$Cache->set( $entries, 'entries' );
555
+				$Cache->set($entries, 'entries');
556 556
 
557 557
 			}
558 558
 
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
 		}
561 561
 
562 562
 		/** Remove filter added above */
563
-		remove_filter( 'gform_is_encrypted_field', '__return_false' );
563
+		remove_filter('gform_is_encrypted_field', '__return_false');
564 564
 
565 565
 		/**
566 566
 		 * @filter `gravityview_entries` Modify the array of entries returned to GravityView after it has been fetched from the cache or from `GFAPI::get_entries()`.
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
 		 * @param array $passed_criteria The original search criteria passed to `GVCommon::get_entries()`
570 570
 		 * @param  int|null $total Optional. An output parameter containing the total number of entries. Pass a non-null value to generate
571 571
 		 */
572
-		$return = apply_filters( 'gravityview_entries', $return, $criteria, $passed_criteria, $total );
572
+		$return = apply_filters('gravityview_entries', $return, $criteria, $passed_criteria, $total);
573 573
 
574 574
 		return $return;
575 575
 	}
@@ -586,15 +586,15 @@  discard block
 block discarded – undo
586 586
 	 * @param boolean $check_entry_display Check whether the entry is visible for the current View configuration. Default: true. {@since 1.14}
587 587
 	 * @return array|boolean
588 588
 	 */
589
-	public static function get_entry( $entry_slug, $force_allow_ids = false, $check_entry_display = true ) {
589
+	public static function get_entry($entry_slug, $force_allow_ids = false, $check_entry_display = true) {
590 590
 
591
-		if ( class_exists( 'GFAPI' ) && ! empty( $entry_slug ) ) {
591
+		if (class_exists('GFAPI') && !empty($entry_slug)) {
592 592
 
593 593
 			/**
594 594
 			 * @filter `gravityview_custom_entry_slug` Whether to enable and use custom entry slugs.
595 595
 			 * @param boolean True: Allow for slugs based on entry values. False: always use entry IDs (default)
596 596
 			 */
597
-			$custom_slug = apply_filters( 'gravityview_custom_entry_slug', false );
597
+			$custom_slug = apply_filters('gravityview_custom_entry_slug', false);
598 598
 
599 599
 			/**
600 600
 			 * @filter `gravityview_custom_entry_slug_allow_id` When using a custom slug, allow access to the entry using the original slug (the Entry ID).
@@ -602,38 +602,38 @@  discard block
 block discarded – undo
602 602
 			 * - If enabled, you could access using the custom slug OR the entry id (example: `/entry/custom-slug/` OR `/entry/123/`)
603 603
 			 * @param boolean $custom_slug_id_access True: allow accessing the slug by ID; False: only use the slug passed to the method.
604 604
 			 */
605
-			$custom_slug_id_access = $force_allow_ids || apply_filters( 'gravityview_custom_entry_slug_allow_id', false );
605
+			$custom_slug_id_access = $force_allow_ids || apply_filters('gravityview_custom_entry_slug_allow_id', false);
606 606
 
607 607
 			/**
608 608
 			 * If we're using custom entry slugs, we do a meta value search
609 609
 			 * instead of doing a straightup ID search.
610 610
 			 */
611
-			if ( $custom_slug ) {
611
+			if ($custom_slug) {
612 612
 
613
-				$entry_id = self::get_entry_id_from_slug( $entry_slug );
613
+				$entry_id = self::get_entry_id_from_slug($entry_slug);
614 614
 
615 615
 			}
616 616
 
617 617
 			// If custom slug is off, search using the entry ID
618 618
 			// ID allow ID access is on, also use entry ID as a backup
619
-			if ( empty( $custom_slug ) || ! empty( $custom_slug_id_access ) ) {
619
+			if (empty($custom_slug) || !empty($custom_slug_id_access)) {
620 620
 				// Search for IDs matching $entry_slug
621 621
 				$entry_id = $entry_slug;
622 622
 			}
623 623
 
624
-			if ( empty( $entry_id ) ) {
624
+			if (empty($entry_id)) {
625 625
 				return false;
626 626
 			}
627 627
 
628 628
 			// fetch the entry
629
-			$entry = GFAPI::get_entry( $entry_id );
629
+			$entry = GFAPI::get_entry($entry_id);
630 630
 
631
-			if( $check_entry_display ) {
631
+			if ($check_entry_display) {
632 632
 				// Is the entry allowed
633
-				$entry = self::check_entry_display( $entry );
633
+				$entry = self::check_entry_display($entry);
634 634
 			}
635 635
 
636
-			return is_wp_error( $entry ) ? false : $entry;
636
+			return is_wp_error($entry) ? false : $entry;
637 637
 
638 638
 		}
639 639
 
@@ -657,51 +657,51 @@  discard block
 block discarded – undo
657 657
 	 *
658 658
 	 * @return bool True: matches, false: not matches
659 659
 	 */
660
-	public static function matches_operation( $val1, $val2, $operation ) {
660
+	public static function matches_operation($val1, $val2, $operation) {
661 661
 
662 662
 		$value = false;
663 663
 
664
-		if( 'context' === $val1 ) {
664
+		if ('context' === $val1) {
665 665
 
666
-			$matching_contexts = array( $val2 );
666
+			$matching_contexts = array($val2);
667 667
 
668 668
 			// We allow for non-standard contexts.
669
-			switch( $val2 ) {
669
+			switch ($val2) {
670 670
 				// Check for either single or edit
671 671
 				case 'singular':
672
-					$matching_contexts = array( 'single', 'edit' );
672
+					$matching_contexts = array('single', 'edit');
673 673
 					break;
674 674
 				// Use multiple as alias for directory for consistency
675 675
 				case 'multiple':
676
-					$matching_contexts = array( 'directory' );
676
+					$matching_contexts = array('directory');
677 677
 					break;
678 678
 			}
679 679
 
680
-			$val1 = in_array( gravityview_get_context(), $matching_contexts ) ? $val2 : false;
680
+			$val1 = in_array(gravityview_get_context(), $matching_contexts) ? $val2 : false;
681 681
 		}
682 682
 
683
-		switch ( $operation ) {
683
+		switch ($operation) {
684 684
 			case 'equals':
685
-				$value = GFFormsModel::matches_operation( $val1, $val2, 'is' );
685
+				$value = GFFormsModel::matches_operation($val1, $val2, 'is');
686 686
 				break;
687 687
 			case 'greater_than_or_is':
688 688
 			case 'greater_than_or_equals':
689
-				$is    = GFFormsModel::matches_operation( $val1, $val2, 'is' );
690
-				$gt    = GFFormsModel::matches_operation( $val1, $val2, 'greater_than' );
691
-				$value = ( $is || $gt );
689
+				$is    = GFFormsModel::matches_operation($val1, $val2, 'is');
690
+				$gt    = GFFormsModel::matches_operation($val1, $val2, 'greater_than');
691
+				$value = ($is || $gt);
692 692
 				break;
693 693
 			case 'less_than_or_is':
694 694
 			case 'less_than_or_equals':
695
-				$is    = GFFormsModel::matches_operation( $val1, $val2, 'is' );
696
-				$gt    = GFFormsModel::matches_operation( $val1, $val2, 'less_than' );
697
-				$value = ( $is || $gt );
695
+				$is    = GFFormsModel::matches_operation($val1, $val2, 'is');
696
+				$gt    = GFFormsModel::matches_operation($val1, $val2, 'less_than');
697
+				$value = ($is || $gt);
698 698
 				break;
699 699
 			case 'not_contains':
700
-				$contains = GFFormsModel::matches_operation( $val1, $val2, 'contains' );
701
-				$value    = ! $contains;
700
+				$contains = GFFormsModel::matches_operation($val1, $val2, 'contains');
701
+				$value    = !$contains;
702 702
 				break;
703 703
 			default:
704
-				$value = GFFormsModel::matches_operation( $val1, $val2, $operation );
704
+				$value = GFFormsModel::matches_operation($val1, $val2, $operation);
705 705
 		}
706 706
 
707 707
 		return $value;
@@ -719,41 +719,41 @@  discard block
 block discarded – undo
719 719
 	 * @param array $entry Gravity Forms Entry object
720 720
 	 * @return bool|array Returns 'false' if entry is not valid according to the view search filters (Adv Filter)
721 721
 	 */
722
-	public static function check_entry_display( $entry ) {
722
+	public static function check_entry_display($entry) {
723 723
 
724
-		if ( ! $entry || is_wp_error( $entry ) ) {
725
-			do_action( 'gravityview_log_debug', __METHOD__ . ' Entry was not found.', $entry );
724
+		if (!$entry || is_wp_error($entry)) {
725
+			do_action('gravityview_log_debug', __METHOD__.' Entry was not found.', $entry);
726 726
 			return false;
727 727
 		}
728 728
 
729
-		if ( empty( $entry['form_id'] ) ) {
730
-			do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry is empty! Entry:', $entry );
729
+		if (empty($entry['form_id'])) {
730
+			do_action('gravityview_log_debug', '[apply_filters_to_entry] Entry is empty! Entry:', $entry);
731 731
 			return false;
732 732
 		}
733 733
 
734 734
 		$criteria = self::calculate_get_entries_criteria();
735 735
 
736 736
 		// Make sure the current View is connected to the same form as the Entry
737
-		if( ! empty( $criteria['context_view_id'] ) ) {
738
-			$context_view_id = intval( $criteria['context_view_id'] );
739
-			$context_form_id = gravityview_get_form_id( $context_view_id );
740
-			if( intval( $context_form_id ) !== intval( $entry['form_id'] ) ) {
741
-				do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry['form_id'] ), $criteria['context_view_id'] );
737
+		if (!empty($criteria['context_view_id'])) {
738
+			$context_view_id = intval($criteria['context_view_id']);
739
+			$context_form_id = gravityview_get_form_id($context_view_id);
740
+			if (intval($context_form_id) !== intval($entry['form_id'])) {
741
+				do_action('gravityview_log_debug', sprintf('[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry['form_id']), $criteria['context_view_id']);
742 742
 				return false;
743 743
 			}
744 744
 		}
745 745
 
746
-		if ( empty( $criteria['search_criteria'] ) || ! is_array( $criteria['search_criteria'] ) ) {
747
-			do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No search criteria found:', $criteria );
746
+		if (empty($criteria['search_criteria']) || !is_array($criteria['search_criteria'])) {
747
+			do_action('gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No search criteria found:', $criteria);
748 748
 			return $entry;
749 749
 		}
750 750
 
751 751
 		$search_criteria = $criteria['search_criteria'];
752
-		unset( $criteria );
752
+		unset($criteria);
753 753
 
754 754
 		// check entry status
755
-		if ( array_key_exists( 'status', $search_criteria ) && $search_criteria['status'] != $entry['status'] ) {
756
-			do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry['status'] ), $search_criteria );
755
+		if (array_key_exists('status', $search_criteria) && $search_criteria['status'] != $entry['status']) {
756
+			do_action('gravityview_log_debug', sprintf('[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry['status']), $search_criteria);
757 757
 			return false;
758 758
 		}
759 759
 
@@ -761,53 +761,53 @@  discard block
 block discarded – undo
761 761
 		// @todo: Does it make sense to apply the Date create filters to the single entry?
762 762
 
763 763
 		// field_filters
764
-		if ( empty( $search_criteria['field_filters'] ) || ! is_array( $search_criteria['field_filters'] ) ) {
765
-			do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No field filters criteria found:', $search_criteria );
764
+		if (empty($search_criteria['field_filters']) || !is_array($search_criteria['field_filters'])) {
765
+			do_action('gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No field filters criteria found:', $search_criteria);
766 766
 			return $entry;
767 767
 		}
768 768
 
769 769
 		$filters = $search_criteria['field_filters'];
770
-		unset( $search_criteria );
770
+		unset($search_criteria);
771 771
 
772
-		$mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters['mode'] ) : 'all';
773
-		unset( $filters['mode'] );
772
+		$mode = array_key_exists('mode', $filters) ? strtolower($filters['mode']) : 'all';
773
+		unset($filters['mode']);
774 774
 
775
-		$form = self::get_form( $entry['form_id'] );
775
+		$form = self::get_form($entry['form_id']);
776 776
 
777
-		foreach ( $filters as $filter ) {
777
+		foreach ($filters as $filter) {
778 778
 
779
-			if ( ! isset( $filter['key'] ) ) {
779
+			if (!isset($filter['key'])) {
780 780
 				continue;
781 781
 			}
782 782
 
783 783
 			$k = $filter['key'];
784 784
 
785
-			if ( in_array( $k, array( 'created_by', 'payment_status' ) ) ) {
786
-				$field_value = $entry[ $k ];
785
+			if (in_array($k, array('created_by', 'payment_status'))) {
786
+				$field_value = $entry[$k];
787 787
 				$field = null;
788 788
 			} else {
789
-				$field = self::get_field( $form, $k );
790
-				$field_value  = GFFormsModel::get_lead_field_value( $entry, $field );
789
+				$field = self::get_field($form, $k);
790
+				$field_value = GFFormsModel::get_lead_field_value($entry, $field);
791 791
 			}
792 792
 
793
-			$operator = isset( $filter['operator'] ) ? strtolower( $filter['operator'] ) : 'is';
794
-			$is_value_match = GFFormsModel::is_value_match( $field_value, $filter['value'], $operator, $field );
793
+			$operator = isset($filter['operator']) ? strtolower($filter['operator']) : 'is';
794
+			$is_value_match = GFFormsModel::is_value_match($field_value, $filter['value'], $operator, $field);
795 795
 
796 796
 			// verify if we are already free to go!
797
-			if ( ! $is_value_match && 'all' === $mode ) {
798
-				do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry cannot be displayed. Failed one criteria for ALL mode', $filter );
797
+			if (!$is_value_match && 'all' === $mode) {
798
+				do_action('gravityview_log_debug', '[apply_filters_to_entry] Entry cannot be displayed. Failed one criteria for ALL mode', $filter);
799 799
 				return false;
800
-			} elseif ( $is_value_match && 'any' === $mode ) {
800
+			} elseif ($is_value_match && 'any' === $mode) {
801 801
 				return $entry;
802 802
 			}
803 803
 		}
804 804
 
805 805
 		// at this point, if in ALL mode, then entry is approved - all conditions were met.
806 806
 		// Or, for ANY mode, means none of the conditions were satisfied, so entry is not approved
807
-		if ( 'all' === $mode ) {
807
+		if ('all' === $mode) {
808 808
 			return $entry;
809 809
 		} else {
810
-			do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry cannot be displayed. Failed all the criteria for ANY mode', $filters );
810
+			do_action('gravityview_log_debug', '[apply_filters_to_entry] Entry cannot be displayed. Failed all the criteria for ANY mode', $filters);
811 811
 			return false;
812 812
 		}
813 813
 
@@ -832,7 +832,7 @@  discard block
 block discarded – undo
832 832
 	 *
833 833
 	 * @return int|null|string Formatted date based on the original date
834 834
 	 */
835
-	public static function format_date( $date_string = '', $args = array() ) {
835
+	public static function format_date($date_string = '', $args = array()) {
836 836
 
837 837
 		$default_atts = array(
838 838
 			'raw' => false,
@@ -843,39 +843,39 @@  discard block
 block discarded – undo
843 843
 			'time' => false,
844 844
 		);
845 845
 
846
-		$atts = wp_parse_args( $args, $default_atts );
846
+		$atts = wp_parse_args($args, $default_atts);
847 847
 
848 848
 		/**
849 849
 		 * Gravity Forms code to adjust date to locally-configured Time Zone
850 850
 		 * @see GFCommon::format_date() for original code
851 851
 		 */
852
-		$date_gmt_time   = mysql2date( 'G', $date_string );
853
-		$date_local_timestamp = GFCommon::get_local_timestamp( $date_gmt_time );
852
+		$date_gmt_time = mysql2date('G', $date_string);
853
+		$date_local_timestamp = GFCommon::get_local_timestamp($date_gmt_time);
854 854
 
855
-		$format  = rgar( $atts, 'format' );
856
-		$is_human  = ! empty( $atts['human'] );
857
-		$is_diff  = ! empty( $atts['diff'] );
858
-		$is_raw = ! empty( $atts['raw'] );
859
-		$is_timestamp = ! empty( $atts['timestamp'] );
860
-		$include_time = ! empty( $atts['time'] );
855
+		$format = rgar($atts, 'format');
856
+		$is_human = !empty($atts['human']);
857
+		$is_diff = !empty($atts['diff']);
858
+		$is_raw = !empty($atts['raw']);
859
+		$is_timestamp = !empty($atts['timestamp']);
860
+		$include_time = !empty($atts['time']);
861 861
 
862 862
 		// If we're using time diff, we want to have a different default format
863
-		if( empty( $format ) ) {
864
-			$format = $is_diff ? esc_html__( '%s ago', 'gravityview' ) : get_option( 'date_format' );
863
+		if (empty($format)) {
864
+			$format = $is_diff ? esc_html__('%s ago', 'gravityview') : get_option('date_format');
865 865
 		}
866 866
 
867 867
 		// If raw was specified, don't modify the stored value
868
-		if ( $is_raw ) {
868
+		if ($is_raw) {
869 869
 			$formatted_date = $date_string;
870
-		} elseif( $is_timestamp ) {
870
+		} elseif ($is_timestamp) {
871 871
 			$formatted_date = $date_local_timestamp;
872
-		} elseif ( $is_diff ) {
873
-			$formatted_date = sprintf( $format, human_time_diff( $date_gmt_time ) );
872
+		} elseif ($is_diff) {
873
+			$formatted_date = sprintf($format, human_time_diff($date_gmt_time));
874 874
 		} else {
875
-			$formatted_date = GFCommon::format_date( $date_string, $is_human, $format, $include_time );
875
+			$formatted_date = GFCommon::format_date($date_string, $is_human, $format, $include_time);
876 876
 		}
877 877
 
878
-		unset( $format, $is_diff, $is_human, $is_timestamp, $is_raw, $date_gmt_time, $date_local_timestamp, $default_atts );
878
+		unset($format, $is_diff, $is_human, $is_timestamp, $is_raw, $date_gmt_time, $date_local_timestamp, $default_atts);
879 879
 
880 880
 		return $formatted_date;
881 881
 	}
@@ -888,14 +888,14 @@  discard block
 block discarded – undo
888 888
 	 * @param string $field_id
889 889
 	 * @return string
890 890
 	 */
891
-	public static function get_field_label( $form = array(), $field_id = '' ) {
891
+	public static function get_field_label($form = array(), $field_id = '') {
892 892
 
893
-		if ( empty( $form ) || empty( $field_id ) ) {
893
+		if (empty($form) || empty($field_id)) {
894 894
 			return '';
895 895
 		}
896 896
 
897
-		$field = self::get_field( $form, $field_id );
898
-		return isset( $field['label'] ) ?  $field['label'] : '';
897
+		$field = self::get_field($form, $field_id);
898
+		return isset($field['label']) ? $field['label'] : '';
899 899
 
900 900
 	}
901 901
 
@@ -912,9 +912,9 @@  discard block
 block discarded – undo
912 912
 	 * @param string|int $field_id
913 913
 	 * @return array|null Array: Gravity Forms field array; NULL: Gravity Forms GFFormsModel does not exist
914 914
 	 */
915
-	public static function get_field( $form, $field_id ) {
916
-		if ( class_exists( 'GFFormsModel' ) ){
917
-			return GFFormsModel::get_field( $form, $field_id );
915
+	public static function get_field($form, $field_id) {
916
+		if (class_exists('GFFormsModel')) {
917
+			return GFFormsModel::get_field($form, $field_id);
918 918
 		} else {
919 919
 			return null;
920 920
 		}
@@ -930,16 +930,16 @@  discard block
 block discarded – undo
930 930
 	 * @param  WP_Post      $post WordPress post object
931 931
 	 * @return boolean           True: yep, GravityView; No: not!
932 932
 	 */
933
-	public static function has_gravityview_shortcode( $post = null ) {
934
-		if ( ! is_a( $post, 'WP_Post' ) ) {
933
+	public static function has_gravityview_shortcode($post = null) {
934
+		if (!is_a($post, 'WP_Post')) {
935 935
 			return false;
936 936
 		}
937 937
 
938
-		if ( 'gravityview' === get_post_type( $post ) ) {
938
+		if ('gravityview' === get_post_type($post)) {
939 939
 			return true;
940 940
 		}
941 941
 
942
-		return self::has_shortcode_r( $post->post_content, 'gravityview' ) ? true : false;
942
+		return self::has_shortcode_r($post->post_content, 'gravityview') ? true : false;
943 943
 
944 944
 	}
945 945
 
@@ -950,27 +950,27 @@  discard block
 block discarded – undo
950 950
 	 * @param string $content Content to check whether there's a shortcode
951 951
 	 * @param string $tag Current shortcode tag
952 952
 	 */
953
-	public static function has_shortcode_r( $content, $tag = 'gravityview' ) {
954
-		if ( false === strpos( $content, '[' ) ) {
953
+	public static function has_shortcode_r($content, $tag = 'gravityview') {
954
+		if (false === strpos($content, '[')) {
955 955
 			return false;
956 956
 		}
957 957
 
958
-		if ( shortcode_exists( $tag ) ) {
958
+		if (shortcode_exists($tag)) {
959 959
 
960 960
 			$shortcodes = array();
961 961
 
962
-			preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER );
963
-			if ( empty( $matches ) ){
962
+			preg_match_all('/'.get_shortcode_regex().'/s', $content, $matches, PREG_SET_ORDER);
963
+			if (empty($matches)) {
964 964
 				return false;
965 965
 			}
966 966
 
967
-			foreach ( $matches as $shortcode ) {
968
-				if ( $tag === $shortcode[2] ) {
967
+			foreach ($matches as $shortcode) {
968
+				if ($tag === $shortcode[2]) {
969 969
 
970 970
 					// Changed this to $shortcode instead of true so we get the parsed atts.
971 971
 					$shortcodes[] = $shortcode;
972 972
 
973
-				} else if ( isset( $shortcode[5] ) && $result = self::has_shortcode_r( $shortcode[5], $tag ) ) {
973
+				} else if (isset($shortcode[5]) && $result = self::has_shortcode_r($shortcode[5], $tag)) {
974 974
 					$shortcodes = $result;
975 975
 				}
976 976
 			}
@@ -994,7 +994,7 @@  discard block
 block discarded – undo
994 994
 	 *
995 995
 	 * @return array          Array with view details, as returned by get_posts()
996 996
 	 */
997
-	public static function get_connected_views( $form_id, $args = array() ) {
997
+	public static function get_connected_views($form_id, $args = array()) {
998 998
 
999 999
 		$defaults = array(
1000 1000
 			'post_type' => 'gravityview',
@@ -1003,9 +1003,9 @@  discard block
 block discarded – undo
1003 1003
 			'meta_value' => (int)$form_id,
1004 1004
 		);
1005 1005
 
1006
-		$args = wp_parse_args( $args, $defaults );
1006
+		$args = wp_parse_args($args, $defaults);
1007 1007
 
1008
-		$views = get_posts( $args );
1008
+		$views = get_posts($args);
1009 1009
 
1010 1010
 		return $views;
1011 1011
 	}
@@ -1017,8 +1017,8 @@  discard block
 block discarded – undo
1017 1017
 	 *
1018 1018
 	 * @return string ID of the connected Form, if exists. Empty string if not.
1019 1019
 	 */
1020
-	public static function get_meta_form_id( $view_id ) {
1021
-		return get_post_meta( $view_id, '_gravityview_form_id', true );
1020
+	public static function get_meta_form_id($view_id) {
1021
+		return get_post_meta($view_id, '_gravityview_form_id', true);
1022 1022
 	}
1023 1023
 
1024 1024
 	/**
@@ -1030,8 +1030,8 @@  discard block
 block discarded – undo
1030 1030
 	 *
1031 1031
 	 * @return string GravityView_Template::template_id value. Empty string if not.
1032 1032
 	 */
1033
-	public static function get_meta_template_id( $view_id ) {
1034
-		return get_post_meta( $view_id, '_gravityview_directory_template', true );
1033
+	public static function get_meta_template_id($view_id) {
1034
+		return get_post_meta($view_id, '_gravityview_directory_template', true);
1035 1035
 	}
1036 1036
 
1037 1037
 
@@ -1042,15 +1042,15 @@  discard block
 block discarded – undo
1042 1042
 	 * @param  int $post_id View ID
1043 1043
 	 * @return array          Associative array of settings with plugin defaults used if not set by the View
1044 1044
 	 */
1045
-	public static function get_template_settings( $post_id ) {
1045
+	public static function get_template_settings($post_id) {
1046 1046
 
1047
-		$settings = get_post_meta( $post_id, '_gravityview_template_settings', true );
1047
+		$settings = get_post_meta($post_id, '_gravityview_template_settings', true);
1048 1048
 
1049
-		if ( class_exists( 'GravityView_View_Data' ) ) {
1049
+		if (class_exists('GravityView_View_Data')) {
1050 1050
 
1051 1051
 			$defaults = GravityView_View_Data::get_default_args();
1052 1052
 
1053
-			return wp_parse_args( (array)$settings, $defaults );
1053
+			return wp_parse_args((array)$settings, $defaults);
1054 1054
 
1055 1055
 		}
1056 1056
 
@@ -1067,12 +1067,12 @@  discard block
 block discarded – undo
1067 1067
 	 * @param  string $key     Key for the setting
1068 1068
 	 * @return mixed|null          Setting value, or NULL if not set.
1069 1069
 	 */
1070
-	public static function get_template_setting( $post_id, $key ) {
1070
+	public static function get_template_setting($post_id, $key) {
1071 1071
 
1072
-		$settings = self::get_template_settings( $post_id );
1072
+		$settings = self::get_template_settings($post_id);
1073 1073
 
1074
-		if ( isset( $settings[ $key ] ) ) {
1075
-			return $settings[ $key ];
1074
+		if (isset($settings[$key])) {
1075
+			return $settings[$key];
1076 1076
 		}
1077 1077
 
1078 1078
 		return null;
@@ -1108,8 +1108,8 @@  discard block
 block discarded – undo
1108 1108
 	 * @param  int $post_id View ID
1109 1109
 	 * @return array          Multi-array of fields with first level being the field zones. See code comment.
1110 1110
 	 */
1111
-	public static function get_directory_fields( $post_id ) {
1112
-		return get_post_meta( $post_id, '_gravityview_directory_fields', true );
1111
+	public static function get_directory_fields($post_id) {
1112
+		return get_post_meta($post_id, '_gravityview_directory_fields', true);
1113 1113
 	}
1114 1114
 
1115 1115
 
@@ -1120,25 +1120,25 @@  discard block
 block discarded – undo
1120 1120
 	 * @param  int $formid Form ID
1121 1121
 	 * @return string         html
1122 1122
 	 */
1123
-	public static function get_sortable_fields( $formid, $current = '' ) {
1124
-		$output = '<option value="" ' . selected( '', $current, false ).'>' . esc_html__( 'Default', 'gravityview' ) .'</option>';
1123
+	public static function get_sortable_fields($formid, $current = '') {
1124
+		$output = '<option value="" '.selected('', $current, false).'>'.esc_html__('Default', 'gravityview').'</option>';
1125 1125
 
1126
-		if ( empty( $formid ) ) {
1126
+		if (empty($formid)) {
1127 1127
 			return $output;
1128 1128
 		}
1129 1129
 
1130
-		$fields = self::get_sortable_fields_array( $formid );
1130
+		$fields = self::get_sortable_fields_array($formid);
1131 1131
 
1132
-		if ( ! empty( $fields ) ) {
1132
+		if (!empty($fields)) {
1133 1133
 
1134
-			$blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', array( 'list', 'textarea' ), null );
1134
+			$blacklist_field_types = apply_filters('gravityview_blacklist_field_types', array('list', 'textarea'), null);
1135 1135
 
1136
-			foreach ( $fields as $id => $field ) {
1137
-				if ( in_array( $field['type'], $blacklist_field_types ) ) {
1136
+			foreach ($fields as $id => $field) {
1137
+				if (in_array($field['type'], $blacklist_field_types)) {
1138 1138
 					continue;
1139 1139
 				}
1140 1140
 
1141
-				$output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'>'. esc_attr( $field['label'] ) .'</option>';
1141
+				$output .= '<option value="'.$id.'" '.selected($id, $current, false).'>'.esc_attr($field['label']).'</option>';
1142 1142
 			}
1143 1143
 		}
1144 1144
 
@@ -1156,27 +1156,27 @@  discard block
 block discarded – undo
1156 1156
 	 *
1157 1157
 	 * @return array
1158 1158
 	 */
1159
-	public static function get_sortable_fields_array( $formid, $blacklist = array( 'list', 'textarea' ) ) {
1159
+	public static function get_sortable_fields_array($formid, $blacklist = array('list', 'textarea')) {
1160 1160
 
1161 1161
 		// Get fields with sub-inputs and no parent
1162
-		$fields = self::get_form_fields( $formid, true, false );
1162
+		$fields = self::get_form_fields($formid, true, false);
1163 1163
 
1164 1164
 		$date_created = array(
1165 1165
 			'date_created' => array(
1166 1166
 				'type' => 'date_created',
1167
-				'label' => __( 'Date Created', 'gravityview' ),
1167
+				'label' => __('Date Created', 'gravityview'),
1168 1168
 			),
1169 1169
 		);
1170 1170
 
1171 1171
         $fields = $date_created + $fields;
1172 1172
 
1173
-		$blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL );
1173
+		$blacklist_field_types = apply_filters('gravityview_blacklist_field_types', $blacklist, NULL);
1174 1174
 
1175 1175
 		// TODO: Convert to using array_filter
1176
-		foreach( $fields as $id => $field ) {
1176
+		foreach ($fields as $id => $field) {
1177 1177
 
1178
-			if( in_array( $field['type'], $blacklist_field_types ) ) {
1179
-				unset( $fields[ $id ] );
1178
+			if (in_array($field['type'], $blacklist_field_types)) {
1179
+				unset($fields[$id]);
1180 1180
 			}
1181 1181
 		}
1182 1182
 
@@ -1186,7 +1186,7 @@  discard block
 block discarded – undo
1186 1186
          * @param array $fields Sub-set of GF form fields that are sortable
1187 1187
          * @param int $formid The Gravity Forms form ID that the fields are from
1188 1188
          */
1189
-        $fields = apply_filters( 'gravityview/common/sortable_fields', $fields, $formid );
1189
+        $fields = apply_filters('gravityview/common/sortable_fields', $fields, $formid);
1190 1190
 
1191 1191
 		return $fields;
1192 1192
 	}
@@ -1197,15 +1197,15 @@  discard block
 block discarded – undo
1197 1197
 	 * @param  mixed $field_id Field ID or Field array
1198 1198
 	 * @return string field type
1199 1199
 	 */
1200
-	public static function get_field_type( $form = null, $field_id = '' ) {
1200
+	public static function get_field_type($form = null, $field_id = '') {
1201 1201
 
1202
-		if ( ! empty( $field_id ) && ! is_array( $field_id ) ) {
1203
-			$field = self::get_field( $form, $field_id );
1202
+		if (!empty($field_id) && !is_array($field_id)) {
1203
+			$field = self::get_field($form, $field_id);
1204 1204
 		} else {
1205 1205
 			$field = $field_id;
1206 1206
 		}
1207 1207
 
1208
-		return class_exists( 'RGFormsModel' ) ? RGFormsModel::get_input_type( $field ) : '';
1208
+		return class_exists('RGFormsModel') ? RGFormsModel::get_input_type($field) : '';
1209 1209
 
1210 1210
 	}
1211 1211
 
@@ -1216,17 +1216,17 @@  discard block
 block discarded – undo
1216 1216
 	 * @param  int|array  $field field key or field array
1217 1217
 	 * @return boolean
1218 1218
 	 */
1219
-	public static function is_field_numeric(  $form = null, $field = '' ) {
1219
+	public static function is_field_numeric($form = null, $field = '') {
1220 1220
 
1221
-		if ( ! is_array( $form ) && ! is_array( $field ) ) {
1222
-			$form = self::get_form( $form );
1221
+		if (!is_array($form) && !is_array($field)) {
1222
+			$form = self::get_form($form);
1223 1223
 		}
1224 1224
 
1225 1225
 		// If entry meta, it's a string. Otherwise, numeric
1226
-		if( ! is_numeric( $field ) && is_string( $field ) ) {
1226
+		if (!is_numeric($field) && is_string($field)) {
1227 1227
 			$type = $field;
1228 1228
 		} else {
1229
-			$type = self::get_field_type( $form, $field );
1229
+			$type = self::get_field_type($form, $field);
1230 1230
 		}
1231 1231
 
1232 1232
 		/**
@@ -1234,16 +1234,16 @@  discard block
 block discarded – undo
1234 1234
 		 * @since 1.5.2
1235 1235
 		 * @param array $numeric_types Fields that are numeric. Default: `[ number, time ]`
1236 1236
 		 */
1237
-		$numeric_types = apply_filters( 'gravityview/common/numeric_types', array( 'number', 'time' ) );
1237
+		$numeric_types = apply_filters('gravityview/common/numeric_types', array('number', 'time'));
1238 1238
 
1239 1239
 		// Defer to GravityView_Field setting, if the field type is registered and `is_numeric` is true
1240
-		if( $gv_field = GravityView_Fields::get( $type ) ) {
1241
-			if( true === $gv_field->is_numeric ) {
1240
+		if ($gv_field = GravityView_Fields::get($type)) {
1241
+			if (true === $gv_field->is_numeric) {
1242 1242
 				$numeric_types[] = $gv_field->is_numeric;
1243 1243
 			}
1244 1244
 		}
1245 1245
 
1246
-		$return = in_array( $type, $numeric_types );
1246
+		$return = in_array($type, $numeric_types);
1247 1247
 
1248 1248
 		return $return;
1249 1249
 	}
@@ -1262,19 +1262,19 @@  discard block
 block discarded – undo
1262 1262
 	 *
1263 1263
 	 * @return string Content, encrypted
1264 1264
 	 */
1265
-	public static function js_encrypt( $content, $message = '' ) {
1265
+	public static function js_encrypt($content, $message = '') {
1266 1266
 
1267 1267
 		$output = $content;
1268 1268
 
1269
-		if ( ! class_exists( 'StandalonePHPEnkoder' ) ) {
1270
-			include_once( GRAVITYVIEW_DIR . 'includes/lib/standalone-phpenkoder/StandalonePHPEnkoder.php' );
1269
+		if (!class_exists('StandalonePHPEnkoder')) {
1270
+			include_once(GRAVITYVIEW_DIR.'includes/lib/standalone-phpenkoder/StandalonePHPEnkoder.php');
1271 1271
 		}
1272 1272
 
1273
-		if ( class_exists( 'StandalonePHPEnkoder' ) ) {
1273
+		if (class_exists('StandalonePHPEnkoder')) {
1274 1274
 
1275 1275
 			$enkoder = new StandalonePHPEnkoder;
1276 1276
 
1277
-			$message = empty( $message ) ? __( 'Email hidden; Javascript is required.', 'gravityview' ) : $message;
1277
+			$message = empty($message) ? __('Email hidden; Javascript is required.', 'gravityview') : $message;
1278 1278
 
1279 1279
 			/**
1280 1280
 			 * @filter `gravityview/phpenkoder/msg` Modify the message shown when Javascript is disabled and an encrypted email field is displayed
@@ -1282,9 +1282,9 @@  discard block
 block discarded – undo
1282 1282
 			 * @param string $message Existing message
1283 1283
 			 * @param string $content Content to encrypt
1284 1284
 			 */
1285
-			$enkoder->enkode_msg = apply_filters( 'gravityview/phpenkoder/msg', $message, $content );
1285
+			$enkoder->enkode_msg = apply_filters('gravityview/phpenkoder/msg', $message, $content);
1286 1286
 
1287
-			$output = $enkoder->enkode( $content );
1287
+			$output = $enkoder->enkode($content);
1288 1288
 		}
1289 1289
 
1290 1290
 		return $output;
@@ -1301,25 +1301,25 @@  discard block
 block discarded – undo
1301 1301
 	 *
1302 1302
 	 * @author rubo77 at https://gist.github.com/rubo77/6821632
1303 1303
 	 **/
1304
-	public static function gv_parse_str( $string, &$result ) {
1305
-		if ( empty( $string ) ) {
1304
+	public static function gv_parse_str($string, &$result) {
1305
+		if (empty($string)) {
1306 1306
 			return false;
1307 1307
 		}
1308 1308
 
1309 1309
 		$result = array();
1310 1310
 
1311 1311
 		// find the pairs "name=value"
1312
-		$pairs = explode( '&', $string );
1312
+		$pairs = explode('&', $string);
1313 1313
 
1314
-		foreach ( $pairs as $pair ) {
1314
+		foreach ($pairs as $pair) {
1315 1315
 			// use the original parse_str() on each element
1316
-			parse_str( $pair, $params );
1316
+			parse_str($pair, $params);
1317 1317
 
1318
-			$k = key( $params );
1319
-			if ( ! isset( $result[ $k ] ) ) {
1318
+			$k = key($params);
1319
+			if (!isset($result[$k])) {
1320 1320
 				$result += $params;
1321
-			} elseif ( array_key_exists( $k, $params ) && is_array( $params[ $k ] ) ) {
1322
-				$result[ $k ] = self::array_merge_recursive_distinct( $result[ $k ], $params[ $k ] );
1321
+			} elseif (array_key_exists($k, $params) && is_array($params[$k])) {
1322
+				$result[$k] = self::array_merge_recursive_distinct($result[$k], $params[$k]);
1323 1323
 			}
1324 1324
 		}
1325 1325
 		return true;
@@ -1341,7 +1341,7 @@  discard block
 block discarded – undo
1341 1341
 	 *
1342 1342
 	 * @return string HTML output of anchor link. If empty $href, returns NULL
1343 1343
 	 */
1344
-	public static function get_link_html( $href = '', $anchor_text = '', $atts = array() ) {
1344
+	public static function get_link_html($href = '', $anchor_text = '', $atts = array()) {
1345 1345
 
1346 1346
 		// Supported attributes for anchor tags. HREF left out intentionally.
1347 1347
 		$allowed_atts = array(
@@ -1377,31 +1377,31 @@  discard block
 block discarded – undo
1377 1377
 		 * @filter `gravityview/get_link/allowed_atts` Modify the attributes that are allowed to be used in generating links
1378 1378
 		 * @param array $allowed_atts Array of attributes allowed
1379 1379
 		 */
1380
-		$allowed_atts = apply_filters( 'gravityview/get_link/allowed_atts', $allowed_atts );
1380
+		$allowed_atts = apply_filters('gravityview/get_link/allowed_atts', $allowed_atts);
1381 1381
 
1382 1382
 		// Make sure the attributes are formatted as array
1383
-		$passed_atts = wp_parse_args( $atts );
1383
+		$passed_atts = wp_parse_args($atts);
1384 1384
 
1385 1385
 		// Make sure the allowed attributes are only the ones in the $allowed_atts list
1386
-		$final_atts = shortcode_atts( $allowed_atts, $passed_atts );
1386
+		$final_atts = shortcode_atts($allowed_atts, $passed_atts);
1387 1387
 
1388 1388
 		// Remove attributes with empty values
1389
-		$final_atts = array_filter( $final_atts );
1389
+		$final_atts = array_filter($final_atts);
1390 1390
 
1391 1391
 		// If the href wasn't passed as an attribute, use the value passed to the function
1392
-		if ( empty( $final_atts['href'] ) && ! empty( $href ) ) {
1392
+		if (empty($final_atts['href']) && !empty($href)) {
1393 1393
 			$final_atts['href'] = $href;
1394 1394
 		}
1395 1395
 
1396
-		$final_atts['href'] = esc_url_raw( $href );
1396
+		$final_atts['href'] = esc_url_raw($href);
1397 1397
 
1398 1398
 		// For each attribute, generate the code
1399 1399
 		$output = '';
1400
-		foreach ( $final_atts as $attr => $value ) {
1401
-			$output .= sprintf( ' %s="%s"', $attr, esc_attr( $value ) );
1400
+		foreach ($final_atts as $attr => $value) {
1401
+			$output .= sprintf(' %s="%s"', $attr, esc_attr($value));
1402 1402
 		}
1403 1403
 
1404
-		$output = '<a'. $output .'>'. $anchor_text .'</a>';
1404
+		$output = '<a'.$output.'>'.$anchor_text.'</a>';
1405 1405
 
1406 1406
 		return $output;
1407 1407
 	}
@@ -1420,14 +1420,14 @@  discard block
 block discarded – undo
1420 1420
 	 * @author Daniel <daniel (at) danielsmedegaardbuus (dot) dk>
1421 1421
 	 * @author Gabriel Sobrinho <gabriel (dot) sobrinho (at) gmail (dot) com>
1422 1422
 	 */
1423
-	public static function array_merge_recursive_distinct( array &$array1, array &$array2 ) {
1423
+	public static function array_merge_recursive_distinct(array &$array1, array &$array2) {
1424 1424
 		$merged = $array1;
1425 1425
 
1426
-		foreach ( $array2 as $key => &$value )  {
1427
-			if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) {
1428
-				$merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value );
1426
+		foreach ($array2 as $key => &$value) {
1427
+			if (is_array($value) && isset($merged[$key]) && is_array($merged[$key])) {
1428
+				$merged[$key] = self::array_merge_recursive_distinct($merged[$key], $value);
1429 1429
 			} else {
1430
-				$merged[ $key ] = $value;
1430
+				$merged[$key] = $value;
1431 1431
 			}
1432 1432
 		}
1433 1433
 
@@ -1441,26 +1441,26 @@  discard block
 block discarded – undo
1441 1441
 	 * @param array $args Arguments to modify the user query. See get_users() {@since 1.14}
1442 1442
 	 * @return array Array of WP_User objects.
1443 1443
 	 */
1444
-	public static function get_users( $context = 'change_entry_creator', $args = array() ) {
1444
+	public static function get_users($context = 'change_entry_creator', $args = array()) {
1445 1445
 
1446 1446
 		$default_args = array(
1447 1447
 			'number' => 2000,
1448 1448
 			'orderby' => 'display_name',
1449 1449
 			'order' => 'ASC',
1450
-			'fields' => array( 'ID', 'display_name', 'user_login', 'user_nicename' )
1450
+			'fields' => array('ID', 'display_name', 'user_login', 'user_nicename')
1451 1451
 		);
1452 1452
 
1453 1453
 		// Merge in the passed arg
1454
-		$get_users_settings = wp_parse_args( $args, $default_args );
1454
+		$get_users_settings = wp_parse_args($args, $default_args);
1455 1455
 
1456 1456
 		/**
1457 1457
 		 * @filter `gravityview/get_users/{$context}` There are issues with too many users using [get_users()](http://codex.wordpress.org/Function_Reference/get_users) where it breaks the select. We try to keep it at a reasonable number. \n
1458 1458
 		 * `$context` is where are we using this information (e.g. change_entry_creator, search_widget ..)
1459 1459
 		 * @param array $settings Settings array, with `number` key defining the # of users to display
1460 1460
 		 */
1461
-		$get_users_settings = apply_filters( 'gravityview/get_users/'. $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) );
1461
+		$get_users_settings = apply_filters('gravityview/get_users/'.$context, apply_filters('gravityview_change_entry_creator_user_parameters', $get_users_settings));
1462 1462
 
1463
-		return get_users( $get_users_settings );
1463
+		return get_users($get_users_settings);
1464 1464
 	}
1465 1465
 
1466 1466
 
@@ -1472,8 +1472,8 @@  discard block
 block discarded – undo
1472 1472
      *
1473 1473
      * @return string
1474 1474
      */
1475
-    public static function generate_notice( $notice, $class = '' ) {
1476
-        return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>';
1475
+    public static function generate_notice($notice, $class = '') {
1476
+        return '<div class="gv-notice '.gravityview_sanitize_html_class($class).'">'.$notice.'</div>';
1477 1477
     }
1478 1478
 
1479 1479
 
@@ -1495,6 +1495,6 @@  discard block
 block discarded – undo
1495 1495
  *
1496 1496
  * @return string HTML output of anchor link. If empty $href, returns NULL
1497 1497
  */
1498
-function gravityview_get_link( $href = '', $anchor_text = '', $atts = array() ) {
1499
-	return GVCommon::get_link_html( $href, $anchor_text, $atts );
1498
+function gravityview_get_link($href = '', $anchor_text = '', $atts = array()) {
1499
+	return GVCommon::get_link_html($href, $anchor_text, $atts);
1500 1500
 }
Please login to merge, or discard this patch.
includes/helper-functions.php 1 patch
Spacing   +73 added lines, -73 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,22 +90,22 @@  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( 'trim', $classes );
105
-		$classes = array_map( 'sanitize_html_class', $classes );
106
-		$classes = array_filter( $classes );
104
+		$classes = array_map('trim', $classes);
105
+		$classes = array_map('sanitize_html_class', $classes);
106
+		$classes = array_filter($classes);
107 107
 
108
-		return implode( ' ', $classes );
108
+		return implode(' ', $classes);
109 109
 	}
110 110
 }
111 111
 
@@ -123,9 +123,9 @@  discard block
 block discarded – undo
123 123
  *
124 124
  * @return string Stripped string!
125 125
  */
126
-function gravityview_strip_whitespace( $string ) {
127
-	$string = normalize_whitespace( $string );
128
-	return preg_replace('/[\r\n\t ]+/', ' ', $string );
126
+function gravityview_strip_whitespace($string) {
127
+	$string = normalize_whitespace($string);
128
+	return preg_replace('/[\r\n\t ]+/', ' ', $string);
129 129
 }
130 130
 
131 131
 /**
@@ -138,13 +138,13 @@  discard block
 block discarded – undo
138 138
  * @param mixed $object Pass pseudo-global to the included file
139 139
  * @return string Included file contents
140 140
  */
141
-function gravityview_ob_include( $file_path, $object = NULL ) {
142
-	if( ! file_exists( $file_path ) ) {
143
-		do_action( 'gravityview_log_error', __FUNCTION__ . ': File path does not exist. ', $file_path );
141
+function gravityview_ob_include($file_path, $object = NULL) {
142
+	if (!file_exists($file_path)) {
143
+		do_action('gravityview_log_error', __FUNCTION__.': File path does not exist. ', $file_path);
144 144
 		return '';
145 145
 	}
146 146
 	ob_start();
147
-	include( $file_path );
147
+	include($file_path);
148 148
 	return ob_get_clean();
149 149
 }
150 150
 
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
  */
156 156
 function gravityview_get_floaty() {
157 157
 
158
-	if( function_exists('is_rtl') && is_rtl() ) {
158
+	if (function_exists('is_rtl') && is_rtl()) {
159 159
 		$style = 'margin:10px 10px 10px 0;';
160 160
 		$class = 'alignright';
161 161
 	} else {
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 		$class = 'alignleft';
164 164
 	}
165 165
 
166
-	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.'" />';
166
+	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.'" />';
167 167
 }
168 168
 
169 169
 /**
@@ -183,21 +183,21 @@  discard block
 block discarded – undo
183 183
  *
184 184
  * @return string Converted number in string format.
185 185
  */
186
-function gravityview_number_format( $number, $decimals = '' ) {
186
+function gravityview_number_format($number, $decimals = '') {
187 187
 	global $wp_locale;
188 188
 
189
-	if( '' === $decimals ) {
189
+	if ('' === $decimals) {
190 190
 
191
-		$decimal_point = isset( $wp_locale ) ? $wp_locale->number_format['decimal_point'] : '.';
191
+		$decimal_point = isset($wp_locale) ? $wp_locale->number_format['decimal_point'] : '.';
192 192
 
193 193
 		/**
194 194
 		 * Calculate the position of the decimal point in the number
195 195
 		 * @see http://stackoverflow.com/a/2430144/480856
196 196
 		 */
197
-		$decimals = strlen( substr( strrchr( $number, $decimal_point ), 1 ) );
197
+		$decimals = strlen(substr(strrchr($number, $decimal_point), 1));
198 198
 	}
199 199
 
200
-	$number = number_format_i18n( $number, (int)$decimals );
200
+	$number = number_format_i18n($number, (int)$decimals);
201 201
 
202 202
 	return $number;
203 203
 }
@@ -211,13 +211,13 @@  discard block
 block discarded – undo
211 211
  * @param  string $value Existing URL
212 212
  * @return string        If parse_url doesn't find a 'host', returns original value. Otherwise, returns formatted link.
213 213
  */
214
-function gravityview_format_link( $value = null ) {
214
+function gravityview_format_link($value = null) {
215 215
 
216 216
 
217
-	$parts = parse_url( $value );
217
+	$parts = parse_url($value);
218 218
 
219 219
 	// No domain? Strange...show the original text.
220
-	if( empty( $parts['host'] ) ) {
220
+	if (empty($parts['host'])) {
221 221
 		return $value;
222 222
 	}
223 223
 
@@ -230,9 +230,9 @@  discard block
 block discarded – undo
230 230
 	 * @param boolean $enable Whether to strip the scheme. Return false to show scheme. (default: true)\n
231 231
 	 * If true: `http://example.com => example.com`
232 232
 	 */
233
-	if( false === apply_filters('gravityview_anchor_text_striphttp', true) ) {
233
+	if (false === apply_filters('gravityview_anchor_text_striphttp', true)) {
234 234
 
235
-		if( isset( $parts['scheme'] ) ) {
235
+		if (isset($parts['scheme'])) {
236 236
 			$return .= $parts['scheme'];
237 237
 		}
238 238
 
@@ -247,10 +247,10 @@  discard block
 block discarded – undo
247 247
 	 * @param boolean $enable Whether to strip www. Return false to show www. (default: true)\n
248 248
 	 * If true: `www.example.com => example.com`
249 249
 	 */
250
-	$strip_www = apply_filters('gravityview_anchor_text_stripwww', true );
250
+	$strip_www = apply_filters('gravityview_anchor_text_stripwww', true);
251 251
 
252
-	if( $strip_www ) {
253
-		$domain = str_replace('www.', '', $domain );
252
+	if ($strip_www) {
253
+		$domain = str_replace('www.', '', $domain);
254 254
 	}
255 255
 
256 256
 	/**
@@ -262,9 +262,9 @@  discard block
 block discarded – undo
262 262
 	 */
263 263
 	$strip_subdomains = apply_filters('gravityview_anchor_text_nosubdomain', true);
264 264
 
265
-	if( $strip_subdomains ) {
265
+	if ($strip_subdomains) {
266 266
 
267
-		$domain = _gravityview_strip_subdomain( $parts['host'] );
267
+		$domain = _gravityview_strip_subdomain($parts['host']);
268 268
 
269 269
 	}
270 270
 
@@ -280,9 +280,9 @@  discard block
 block discarded – undo
280 280
 	 */
281 281
 	$root_only = apply_filters('gravityview_anchor_text_rootonly', true);
282 282
 
283
-	if( empty( $root_only ) ) {
283
+	if (empty($root_only)) {
284 284
 
285
-		if( isset( $parts['path'] ) ) {
285
+		if (isset($parts['path'])) {
286 286
 			$return .= $parts['path'];
287 287
 		}
288 288
 	}
@@ -293,11 +293,11 @@  discard block
 block discarded – undo
293 293
 	 * @param boolean $enable Whether to enable "root only". Return false to show full path. (default: true)\n
294 294
 	 * If true: `http://example.com/?query=example => example.com`
295 295
 	 */
296
-	$strip_query_string = apply_filters('gravityview_anchor_text_noquerystring', true );
296
+	$strip_query_string = apply_filters('gravityview_anchor_text_noquerystring', true);
297 297
 
298
-	if( empty( $strip_query_string ) ) {
298
+	if (empty($strip_query_string)) {
299 299
 
300
-		if( isset( $parts['query'] ) ) {
300
+		if (isset($parts['query'])) {
301 301
 			$return .= '?'.$parts['query'];
302 302
 		}
303 303
 
@@ -313,9 +313,9 @@  discard block
 block discarded – undo
313 313
  * @param  string $domain Domain to check if it's a TLD or subdomain
314 314
  * @return string         Extracted domain if it has a subdomain
315 315
  */
316
-function _gravityview_strip_subdomain( $string_maybe_has_subdomain ) {
316
+function _gravityview_strip_subdomain($string_maybe_has_subdomain) {
317 317
 
318
-	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 ) ) {
318
+	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)) {
319 319
 		return $matches['domain'];
320 320
 	} else {
321 321
 		return $string_maybe_has_subdomain;
@@ -335,37 +335,37 @@  discard block
 block discarded – undo
335 335
  * @param boolean $allow_string_booleans Whether to check if 'yes', 'true' => `true` and 'no', 'false' => `false`
336 336
  * @return boolean        True: empty; false: not empty
337 337
  */
338
-function gv_empty( $value, $zero_is_empty = true, $allow_string_booleans = true ) {
338
+function gv_empty($value, $zero_is_empty = true, $allow_string_booleans = true) {
339 339
 
340
-	if(
341
-		! isset( $value ) // If it's not set, it's empty!
340
+	if (
341
+		!isset($value) // If it's not set, it's empty!
342 342
 		|| false === $value
343 343
 		|| null === $value
344 344
 	    || '' === $value // Empty string
345 345
 		|| array() === $value // Empty array
346
-		|| ( is_object( $value ) && ! get_object_vars( $value ) ) // Empty object
346
+		|| (is_object($value) && !get_object_vars($value)) // Empty object
347 347
 	) {
348 348
 		return true;
349 349
 	}
350 350
 
351
-	if( is_string( $value ) && $allow_string_booleans ) {
351
+	if (is_string($value) && $allow_string_booleans) {
352 352
 
353
-		$value = trim( $value );
354
-		$value = strtolower( $value );
353
+		$value = trim($value);
354
+		$value = strtolower($value);
355 355
 
356
-		if ( in_array( $value, array( 'yes', 'true' ), true ) ) {
356
+		if (in_array($value, array('yes', 'true'), true)) {
357 357
 			$value = true;
358
-		} else if( in_array( $value, array( 'no', 'false' ), true ) ) {
358
+		} else if (in_array($value, array('no', 'false'), true)) {
359 359
 			$value = false;
360 360
 		}
361 361
 	}
362 362
 
363 363
 	// If zero isn't empty, then if $value is a number and it's empty, it's zero. Thus, return false.
364
-	if( ! $zero_is_empty && is_numeric( $value ) && empty( $value ) ) {
364
+	if (!$zero_is_empty && is_numeric($value) && empty($value)) {
365 365
 		return false;
366 366
 	}
367 367
 
368
-	return empty( $value );
368
+	return empty($value);
369 369
 }
370 370
 
371 371
 /**
@@ -378,17 +378,17 @@  discard block
 block discarded – undo
378 378
  *
379 379
  * @return bool True: it's a valid datetime, formatted as expected. False: it's not a date formatted as expected.
380 380
  */
381
-function gravityview_is_valid_datetime( $datetime, $expected_format = 'Y-m-d' ) {
381
+function gravityview_is_valid_datetime($datetime, $expected_format = 'Y-m-d') {
382 382
 
383 383
 	/**
384 384
 	 * @var bool|DateTime False if not a valid date, (like a relative date). DateTime if a date was created.
385 385
 	 */
386
-	$formatted_date = DateTime::createFromFormat( $expected_format, $datetime );
386
+	$formatted_date = DateTime::createFromFormat($expected_format, $datetime);
387 387
 
388 388
 	/**
389 389
 	 * @see http://stackoverflow.com/a/19271434/480856
390 390
 	 */
391
-	return ( $formatted_date && $formatted_date->format( $expected_format ) === $datetime );
391
+	return ($formatted_date && $formatted_date->format($expected_format) === $datetime);
392 392
 }
393 393
 
394 394
 /**
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
  *
407 407
  * @return array Multidimensional array with `text` (Category Name) and `value` (Category ID) keys.
408 408
  */
409
-function gravityview_get_terms_choices( $args = array() ) {
409
+function gravityview_get_terms_choices($args = array()) {
410 410
 
411 411
 	$defaults = array(
412 412
 		'type'         => 'post',
@@ -420,21 +420,21 @@  discard block
 block discarded – undo
420 420
 		'fields'       => 'id=>name',
421 421
 	);
422 422
 
423
-	$args = wp_parse_args( $args, $defaults );
423
+	$args = wp_parse_args($args, $defaults);
424 424
 
425 425
 	/**
426 426
 	 * @filter `gravityview_get_terms_choices_args` Modify the arguments passed to `get_terms()`
427 427
 	 * @see get_terms()
428 428
 	 * @since 1.15.3
429 429
 	 */
430
-	$args = apply_filters( 'gravityview_get_terms_choices_args', $args );
430
+	$args = apply_filters('gravityview_get_terms_choices_args', $args);
431 431
 
432
-	$terms = get_terms( $args['taxonomy'], $args );
432
+	$terms = get_terms($args['taxonomy'], $args);
433 433
 
434 434
 	$choices = array();
435 435
 
436
-	if ( is_array( $terms ) ) {
437
-		foreach ( $terms as $term_id => $term_name ) {
436
+	if (is_array($terms)) {
437
+		foreach ($terms as $term_id => $term_name) {
438 438
 			$choices[] = array(
439 439
 				'text'  => $term_name,
440 440
 				'value' => $term_id
Please login to merge, or discard this patch.
includes/class-api.php 1 patch
Spacing   +223 added lines, -223 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,
@@ -295,13 +295,13 @@  discard block
 block discarded – undo
295 295
 		    'field_path' => $field_path, /** {@since 1.16} */
296 296
 		));
297 297
 
298
-		if( ! empty( $field_path ) ) {
298
+		if (!empty($field_path)) {
299 299
 
300
-			do_action( 'gravityview_log_debug', sprintf('[field_value] Rendering %s', $field_path ) );
300
+			do_action('gravityview_log_debug', sprintf('[field_value] Rendering %s', $field_path));
301 301
 
302 302
 			ob_start();
303 303
 
304
-			load_template( $field_path, false );
304
+			load_template($field_path, false);
305 305
 
306 306
 			$output = ob_get_clean();
307 307
 
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 		 * @param array  $field_settings Settings for the particular GV field
323 323
 		 * @param array  $field Field array, as fetched from GravityView_View::getCurrentField()
324 324
 		 */
325
-		$output = apply_filters( 'gravityview_field_entry_value_' . $field_type . '_pre_link', $output, $entry, $field_settings, $gravityview_view->getCurrentField() );
325
+		$output = apply_filters('gravityview_field_entry_value_'.$field_type.'_pre_link', $output, $entry, $field_settings, $gravityview_view->getCurrentField());
326 326
 
327 327
 		/**
328 328
 		 * Link to the single entry by wrapping the output in an anchor tag
@@ -330,11 +330,11 @@  discard block
 block discarded – undo
330 330
 		 * Fields can override this by modifying the field data variable inside the field. See /templates/fields/post_image.php for an example.
331 331
 		 *
332 332
 		 */
333
-		if( !empty( $field_settings['show_as_link'] ) && ! gv_empty( $output, false, false ) ) {
333
+		if (!empty($field_settings['show_as_link']) && !gv_empty($output, false, false)) {
334 334
 
335
-			$link_atts = empty( $field_settings['new_window'] ) ? array() : array( 'target' => '_blank' );
335
+			$link_atts = empty($field_settings['new_window']) ? array() : array('target' => '_blank');
336 336
 
337
-			$output = self::entry_link_html( $entry, $output, $link_atts, $field_settings );
337
+			$output = self::entry_link_html($entry, $output, $link_atts, $field_settings);
338 338
 
339 339
 		}
340 340
 
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 		 * @param  array $field_settings Settings for the particular GV field
347 347
 		 * @param array $field Current field being displayed
348 348
 		 */
349
-		$output = apply_filters( 'gravityview_field_entry_value_'.$field_type, $output, $entry, $field_settings, $gravityview_view->getCurrentField() );
349
+		$output = apply_filters('gravityview_field_entry_value_'.$field_type, $output, $entry, $field_settings, $gravityview_view->getCurrentField());
350 350
 
351 351
 		/**
352 352
 		 * @filter `gravityview_field_entry_value` Modify the field value output for all field types
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 		 * @param  array $field_settings Settings for the particular GV field
356 356
 		 * @param array $field_data  {@since 1.6}
357 357
 		 */
358
-		$output = apply_filters( 'gravityview_field_entry_value', $output, $entry, $field_settings, $gravityview_view->getCurrentField() );
358
+		$output = apply_filters('gravityview_field_entry_value', $output, $entry, $field_settings, $gravityview_view->getCurrentField());
359 359
 
360 360
 		return $output;
361 361
 	}
@@ -369,18 +369,18 @@  discard block
 block discarded – undo
369 369
 	 * @param array $entry Gravity Forms entry array
370 370
 	 * @param array $field_settings Array of field settings. Optional, but passed to the `gravityview_field_entry_link` filter
371 371
 	 */
372
-	public static function entry_link_html( $entry = array(), $anchor_text = '', $passed_tag_atts = array(), $field_settings = array() ) {
372
+	public static function entry_link_html($entry = array(), $anchor_text = '', $passed_tag_atts = array(), $field_settings = array()) {
373 373
 
374
-		if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry['id'] ) ) {
374
+		if (empty($entry) || !is_array($entry) || !isset($entry['id'])) {
375 375
 
376
-			do_action( 'gravityview_log_debug', 'GravityView_API[entry_link_tag] Entry not defined; returning null', $entry );
376
+			do_action('gravityview_log_debug', 'GravityView_API[entry_link_tag] Entry not defined; returning null', $entry);
377 377
 
378 378
 			return NULL;
379 379
 		}
380 380
 
381
-		$href = self::entry_link( $entry );
381
+		$href = self::entry_link($entry);
382 382
 
383
-		$link = gravityview_get_link( $href, $anchor_text, $passed_tag_atts );
383
+		$link = gravityview_get_link($href, $anchor_text, $passed_tag_atts);
384 384
 
385 385
 		/**
386 386
 		 * @filter `gravityview_field_entry_link` Modify the link HTML
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 		 * @param array  $entry The GF entry array
390 390
 		 * @param  array $field_settings Settings for the particular GV field
391 391
 		 */
392
-		$output = apply_filters( 'gravityview_field_entry_link', $link, $href, $entry, $field_settings );
392
+		$output = apply_filters('gravityview_field_entry_link', $link, $href, $entry, $field_settings);
393 393
 
394 394
 		return $output;
395 395
 	}
@@ -404,11 +404,11 @@  discard block
 block discarded – undo
404 404
 
405 405
 		$is_search = false;
406 406
 
407
-		if( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) {
407
+		if ($gravityview_view && ($gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search)) {
408 408
 			$is_search = true;
409 409
 		}
410 410
 
411
-		if($is_search) {
411
+		if ($is_search) {
412 412
 			$output = __('This search returned no results.', 'gravityview');
413 413
 		} else {
414 414
 			$output = __('No entries match your request.', 'gravityview');
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 		 * @param string $output The existing "No Entries" text
420 420
 		 * @param boolean $is_search Is the current page a search result, or just a multiple entries screen?
421 421
 		 */
422
-		$output = apply_filters( 'gravitview_no_entries_text', $output, $is_search);
422
+		$output = apply_filters('gravitview_no_entries_text', $output, $is_search);
423 423
 
424 424
 		return $wpautop ? wpautop($output) : $output;
425 425
 	}
@@ -433,42 +433,42 @@  discard block
 block discarded – undo
433 433
 	 * @param boolean $add_query_args Add pagination and sorting arguments
434 434
 	 * @return string      Permalink to multiple entries view
435 435
 	 */
436
-	public static function directory_link( $post_id = NULL, $add_query_args = true ) {
436
+	public static function directory_link($post_id = NULL, $add_query_args = true) {
437 437
 		global $post;
438 438
 
439 439
 		$gravityview_view = GravityView_View::getInstance();
440 440
 
441
-		if( empty( $post_id ) ) {
441
+		if (empty($post_id)) {
442 442
 
443 443
 			$post_id = false;
444 444
 
445 445
 			// DataTables passes the Post ID
446
-			if( defined('DOING_AJAX') && DOING_AJAX ) {
446
+			if (defined('DOING_AJAX') && DOING_AJAX) {
447 447
 
448
-				$post_id = isset( $_POST['post_id'] ) ? (int)$_POST['post_id'] : false;
448
+				$post_id = isset($_POST['post_id']) ? (int)$_POST['post_id'] : false;
449 449
 
450 450
 			} else {
451 451
 
452 452
 				// The Post ID has been passed via the shortcode
453
-				if( !empty( $gravityview_view ) && $gravityview_view->getPostId() ) {
453
+				if (!empty($gravityview_view) && $gravityview_view->getPostId()) {
454 454
 
455 455
 					$post_id = $gravityview_view->getPostId();
456 456
 
457 457
 				} else {
458 458
 
459 459
 					// This is a GravityView post type
460
-					if( GravityView_frontend::getInstance()->isGravityviewPostType() ) {
460
+					if (GravityView_frontend::getInstance()->isGravityviewPostType()) {
461 461
 
462
-						$post_id = isset( $gravityview_view ) ? $gravityview_view->getViewId() : $post->ID;
462
+						$post_id = isset($gravityview_view) ? $gravityview_view->getViewId() : $post->ID;
463 463
 
464 464
 					} else {
465 465
 
466 466
 						// This is an embedded GravityView; use the embedded post's ID as the base.
467
-						if( GravityView_frontend::getInstance()->isPostHasShortcode() && is_a( $post, 'WP_Post' ) ) {
467
+						if (GravityView_frontend::getInstance()->isPostHasShortcode() && is_a($post, 'WP_Post')) {
468 468
 
469 469
 							$post_id = $post->ID;
470 470
 
471
-						} elseif( $gravityview_view->getViewId() ) {
471
+						} elseif ($gravityview_view->getViewId()) {
472 472
 
473 473
 							// The GravityView has been embedded in a widget or in a template, and
474 474
 							// is not in the current content. Thus, we defer to the View's own ID.
@@ -483,39 +483,39 @@  discard block
 block discarded – undo
483 483
 		}
484 484
 
485 485
 		// No post ID, get outta here.
486
-		if( empty( $post_id ) ) {
486
+		if (empty($post_id)) {
487 487
 			return NULL;
488 488
 		}
489 489
 
490 490
 		// If we've saved the permalink in memory, use it
491 491
 		// @since 1.3
492
-		$link = wp_cache_get( 'gv_directory_link_'.$post_id );
492
+		$link = wp_cache_get('gv_directory_link_'.$post_id);
493 493
 
494
-		if( empty( $link ) ) {
494
+		if (empty($link)) {
495 495
 
496
-			$link = get_permalink( $post_id );
496
+			$link = get_permalink($post_id);
497 497
 
498 498
 			// If not yet saved, cache the permalink.
499 499
 			// @since 1.3
500
-			wp_cache_set( 'gv_directory_link_'.$post_id, $link );
500
+			wp_cache_set('gv_directory_link_'.$post_id, $link);
501 501
 
502 502
 		}
503 503
 
504 504
 		// Deal with returning to proper pagination for embedded views
505
-		if( $link && $add_query_args ) {
505
+		if ($link && $add_query_args) {
506 506
 
507 507
 			$args = array();
508 508
 
509
-			if( $pagenum = rgget('pagenum') ) {
510
-				$args['pagenum'] = intval( $pagenum );
509
+			if ($pagenum = rgget('pagenum')) {
510
+				$args['pagenum'] = intval($pagenum);
511 511
 			}
512 512
 
513
-			if( $sort = rgget('sort') ) {
513
+			if ($sort = rgget('sort')) {
514 514
 				$args['sort'] = $sort;
515 515
 				$args['dir'] = rgget('dir');
516 516
 			}
517 517
 
518
-			$link = add_query_arg( $args, $link );
518
+			$link = add_query_arg($args, $link);
519 519
 		}
520 520
 
521 521
 		return $link;
@@ -532,10 +532,10 @@  discard block
 block discarded – undo
532 532
 	 * @param  array  $entry        Entry data passed to provide additional information when generating the hash. Optional - don't rely on it being available.
533 533
 	 * @return string               Hashed unique value for entry
534 534
 	 */
535
-	private static function get_custom_entry_slug( $id, $entry = array() ) {
535
+	private static function get_custom_entry_slug($id, $entry = array()) {
536 536
 
537 537
 		// Generate an unique hash to use as the default value
538
-		$slug = substr( wp_hash( $id, 'gravityview'.$id ), 0, 8 );
538
+		$slug = substr(wp_hash($id, 'gravityview'.$id), 0, 8);
539 539
 
540 540
 		/**
541 541
 		 * @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}`
@@ -543,14 +543,14 @@  discard block
 block discarded – undo
543 543
 		 * @param  string $id The entry ID
544 544
 		 * @param  array $entry Entry data array. May be empty.
545 545
 		 */
546
-		$slug = apply_filters( 'gravityview_entry_slug', $slug, $id, $entry );
546
+		$slug = apply_filters('gravityview_entry_slug', $slug, $id, $entry);
547 547
 
548 548
 		// Make sure we have something - use the original ID as backup.
549
-		if( empty( $slug ) ) {
549
+		if (empty($slug)) {
550 550
 			$slug = $id;
551 551
 		}
552 552
 
553
-		return sanitize_title( $slug );
553
+		return sanitize_title($slug);
554 554
 	}
555 555
 
556 556
 	/**
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
 	 * @param  array  $entry        Gravity Forms Entry array, optional. Used only to provide data to customize the `gravityview_entry_slug` filter
565 565
 	 * @return string               Unique slug ID, passed through `sanitize_title()`
566 566
 	 */
567
-	public static function get_entry_slug( $id_or_string, $entry = array() ) {
567
+	public static function get_entry_slug($id_or_string, $entry = array()) {
568 568
 
569 569
 		/**
570 570
 		 * Default: use the entry ID as the unique identifier
@@ -575,32 +575,32 @@  discard block
 block discarded – undo
575 575
 		 * @filter `gravityview_custom_entry_slug` Whether to enable and use custom entry slugs.
576 576
 		 * @param boolean True: Allow for slugs based on entry values. False: always use entry IDs (default)
577 577
 		 */
578
-		$custom = apply_filters('gravityview_custom_entry_slug', false );
578
+		$custom = apply_filters('gravityview_custom_entry_slug', false);
579 579
 
580 580
 		// If we're using custom slug...
581
-		if ( $custom ) {
581
+		if ($custom) {
582 582
 
583 583
 			// Get the entry hash
584
-			$hash = self::get_custom_entry_slug( $id_or_string, $entry );
584
+			$hash = self::get_custom_entry_slug($id_or_string, $entry);
585 585
 
586 586
 			// See if the entry already has a hash set
587
-			$value = gform_get_meta( $id_or_string, 'gravityview_unique_id' );
587
+			$value = gform_get_meta($id_or_string, 'gravityview_unique_id');
588 588
 
589 589
 			// If it does have a hash set, and the hash is expected, use it.
590 590
 			// This check allows users to change the hash structure using the
591 591
 			// gravityview_entry_hash filter and have the old hashes expire.
592
-			if( empty( $value ) || $value !== $hash ) {
592
+			if (empty($value) || $value !== $hash) {
593 593
 
594
-				gform_update_meta( $id_or_string, 'gravityview_unique_id', $hash );
594
+				gform_update_meta($id_or_string, 'gravityview_unique_id', $hash);
595 595
 
596 596
 			}
597 597
 
598 598
 			$slug = $hash;
599 599
 
600
-			unset( $value, $hash );
600
+			unset($value, $hash);
601 601
 		}
602 602
 
603
-		return sanitize_title( $slug );
603
+		return sanitize_title($slug);
604 604
 	}
605 605
 
606 606
     /**
@@ -611,18 +611,18 @@  discard block
 block discarded – undo
611 611
      * @param $entry array Gravity Forms entry object
612 612
      * @param $form array Gravity Forms form object
613 613
      */
614
-    public static function entry_create_custom_slug( $entry, $form ) {
614
+    public static function entry_create_custom_slug($entry, $form) {
615 615
         /**
616 616
          * @filter `gravityview_custom_entry_slug` On entry creation, check if we are using the custom entry slug feature and update the meta
617 617
          * @param boolean $custom Should we process the custom entry slug?
618 618
          */
619
-        $custom = apply_filters( 'gravityview_custom_entry_slug', false );
620
-        if( $custom ) {
619
+        $custom = apply_filters('gravityview_custom_entry_slug', false);
620
+        if ($custom) {
621 621
             // create the gravityview_unique_id and save it
622 622
 
623 623
             // Get the entry hash
624
-            $hash = self::get_custom_entry_slug( $entry['id'], $entry );
625
-            gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash );
624
+            $hash = self::get_custom_entry_slug($entry['id'], $entry);
625
+            gform_update_meta($entry['id'], 'gravityview_unique_id', $hash);
626 626
 
627 627
         }
628 628
     }
@@ -637,55 +637,55 @@  discard block
 block discarded – undo
637 637
 	 * @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}
638 638
 	 * @return string          Link to the entry with the directory parent slug
639 639
 	 */
640
-	public static function entry_link( $entry, $post_id = NULL, $add_directory_args = true ) {
640
+	public static function entry_link($entry, $post_id = NULL, $add_directory_args = true) {
641 641
 
642
-		if( ! empty( $entry ) && ! is_array( $entry ) ) {
643
-			$entry = GVCommon::get_entry( $entry );
644
-		} else if( empty( $entry ) ) {
642
+		if (!empty($entry) && !is_array($entry)) {
643
+			$entry = GVCommon::get_entry($entry);
644
+		} else if (empty($entry)) {
645 645
 			$entry = GravityView_frontend::getInstance()->getEntry();
646 646
 		}
647 647
 
648 648
 		// Second parameter used to be passed as $field; this makes sure it's not an array
649
-		if( !is_numeric( $post_id ) ) {
649
+		if (!is_numeric($post_id)) {
650 650
 			$post_id = NULL;
651 651
 		}
652 652
 
653 653
 		// Get the permalink to the View
654
-		$directory_link = self::directory_link( $post_id, false );
654
+		$directory_link = self::directory_link($post_id, false);
655 655
 
656 656
 		// No post ID? Get outta here.
657
-		if( empty( $directory_link ) ) {
657
+		if (empty($directory_link)) {
658 658
 			return '';
659 659
 		}
660 660
 
661 661
 		$query_arg_name = GravityView_Post_Types::get_entry_var_name();
662 662
 
663
-		$entry_slug = self::get_entry_slug( $entry['id'], $entry );
663
+		$entry_slug = self::get_entry_slug($entry['id'], $entry);
664 664
 
665
-		if( get_option('permalink_structure') && !is_preview() ) {
665
+		if (get_option('permalink_structure') && !is_preview()) {
666 666
 
667 667
 			$args = array();
668 668
 
669
-			$directory_link = trailingslashit( $directory_link ) . $query_arg_name . '/'. $entry_slug .'/';
669
+			$directory_link = trailingslashit($directory_link).$query_arg_name.'/'.$entry_slug.'/';
670 670
 
671 671
 		} else {
672 672
 
673
-			$args = array( $query_arg_name => $entry_slug );
673
+			$args = array($query_arg_name => $entry_slug);
674 674
 		}
675 675
 
676 676
 		/**
677 677
 		 * @since 1.7.3
678 678
 		 */
679
-		if( $add_directory_args ) {
679
+		if ($add_directory_args) {
680 680
 
681
-			if( !empty( $_GET['pagenum'] ) ) {
682
-				$args['pagenum'] = intval( $_GET['pagenum'] );
681
+			if (!empty($_GET['pagenum'])) {
682
+				$args['pagenum'] = intval($_GET['pagenum']);
683 683
 			}
684 684
 
685 685
 			/**
686 686
 			 * @since 1.7
687 687
 			 */
688
-			if( $sort = rgget('sort') ) {
688
+			if ($sort = rgget('sort')) {
689 689
 				$args['sort'] = $sort;
690 690
 				$args['dir'] = rgget('dir');
691 691
 			}
@@ -697,11 +697,11 @@  discard block
 block discarded – undo
697 697
 		 * has the view id so that Advanced Filters can be applied correctly when rendering the single view
698 698
 		 * @see GravityView_frontend::get_context_view_id()
699 699
 		 */
700
-		if( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() ) {
700
+		if (class_exists('GravityView_View_Data') && GravityView_View_Data::getInstance()->has_multiple_views()) {
701 701
 			$args['gvid'] = gravityview_get_view_id();
702 702
 		}
703 703
 
704
-		return add_query_arg( $args, $directory_link );
704
+		return add_query_arg($args, $directory_link);
705 705
 
706 706
 	}
707 707
 
@@ -711,12 +711,12 @@  discard block
 block discarded – undo
711 711
 
712 712
 // inside loop functions
713 713
 
714
-function gv_label( $field, $entry = NULL ) {
715
-	return GravityView_API::field_label( $field, $entry );
714
+function gv_label($field, $entry = NULL) {
715
+	return GravityView_API::field_label($field, $entry);
716 716
 }
717 717
 
718
-function gv_class( $field, $form = NULL, $entry = array() ) {
719
-	return GravityView_API::field_class( $field, $form, $entry  );
718
+function gv_class($field, $form = NULL, $entry = array()) {
719
+	return GravityView_API::field_class($field, $form, $entry);
720 720
 }
721 721
 
722 722
 /**
@@ -730,61 +730,61 @@  discard block
 block discarded – undo
730 730
  *
731 731
  * @return string CSS class, sanitized by gravityview_sanitize_html_class()
732 732
  */
733
-function gv_container_class( $passed_css_class = '', $echo = true ) {
733
+function gv_container_class($passed_css_class = '', $echo = true) {
734 734
 
735
-	$passed_css_class = trim( $passed_css_class );
735
+	$passed_css_class = trim($passed_css_class);
736 736
 
737 737
 	$view_id = GravityView_View::getInstance()->getViewId();
738 738
 
739
-	$default_css_class = ! empty( $view_id ) ? sprintf( 'gv-container gv-container-%d', $view_id ) : 'gv-container';
739
+	$default_css_class = !empty($view_id) ? sprintf('gv-container gv-container-%d', $view_id) : 'gv-container';
740 740
 
741
-	if( GravityView_View::getInstance()->isHideUntilSearched() ) {
741
+	if (GravityView_View::getInstance()->isHideUntilSearched()) {
742 742
 		$default_css_class .= ' hidden';
743 743
 	}
744 744
 
745
-	$css_class = trim( $passed_css_class . ' '. $default_css_class );
745
+	$css_class = trim($passed_css_class.' '.$default_css_class);
746 746
 
747 747
 	/**
748 748
 	 * @filter `gravityview/render/container/class` Modify the CSS class to be added to the wrapper <div> of a View
749 749
 	 * @since 1.5.4
750 750
 	 * @param[in,out] string $css_class Default: `gv-container gv-container-{view id}`. If View is hidden until search, adds ` hidden`
751 751
 	 */
752
-	$css_class = apply_filters( 'gravityview/render/container/class', $css_class );
752
+	$css_class = apply_filters('gravityview/render/container/class', $css_class);
753 753
 
754
-	$css_class = gravityview_sanitize_html_class( $css_class );
754
+	$css_class = gravityview_sanitize_html_class($css_class);
755 755
 
756
-	if( $echo ) {
756
+	if ($echo) {
757 757
 		echo $css_class;
758 758
 	}
759 759
 
760 760
 	return $css_class;
761 761
 }
762 762
 
763
-function gv_value( $entry, $field ) {
763
+function gv_value($entry, $field) {
764 764
 
765
-	$value = GravityView_API::field_value( $entry, $field );
765
+	$value = GravityView_API::field_value($entry, $field);
766 766
 
767
-	if( $value === '') {
767
+	if ($value === '') {
768 768
 		/**
769 769
 		 * @filter `gravityview_empty_value` What to display when a field is empty
770 770
 		 * @param string $value (empty string)
771 771
 		 */
772
-		$value = apply_filters( 'gravityview_empty_value', '' );
772
+		$value = apply_filters('gravityview_empty_value', '');
773 773
 	}
774 774
 
775 775
 	return $value;
776 776
 }
777 777
 
778
-function gv_directory_link( $post = NULL, $add_pagination = true ) {
779
-	return GravityView_API::directory_link( $post, $add_pagination );
778
+function gv_directory_link($post = NULL, $add_pagination = true) {
779
+	return GravityView_API::directory_link($post, $add_pagination);
780 780
 }
781 781
 
782
-function gv_entry_link( $entry, $post_id = NULL ) {
783
-	return GravityView_API::entry_link( $entry, $post_id );
782
+function gv_entry_link($entry, $post_id = NULL) {
783
+	return GravityView_API::entry_link($entry, $post_id);
784 784
 }
785 785
 
786 786
 function gv_no_results($wpautop = true) {
787
-	return GravityView_API::no_results( $wpautop );
787
+	return GravityView_API::no_results($wpautop);
788 788
 }
789 789
 
790 790
 /**
@@ -796,21 +796,21 @@  discard block
 block discarded – undo
796 796
 
797 797
 	$href = gv_directory_link();
798 798
 
799
-	if( empty( $href ) ) { return NULL; }
799
+	if (empty($href)) { return NULL; }
800 800
 
801 801
 	// calculate link label
802 802
 	$gravityview_view = GravityView_View::getInstance();
803 803
 
804
-	$label = $gravityview_view->getBackLinkLabel() ? $gravityview_view->getBackLinkLabel() : __( '&larr; Go back', 'gravityview' );
804
+	$label = $gravityview_view->getBackLinkLabel() ? $gravityview_view->getBackLinkLabel() : __('&larr; Go back', 'gravityview');
805 805
 
806 806
 	/**
807 807
 	 * @filter `gravityview_go_back_label` Modify the back link text
808 808
 	 * @since 1.0.9
809 809
 	 * @param string $label Existing label text
810 810
 	 */
811
-	$label = apply_filters( 'gravityview_go_back_label', $label );
811
+	$label = apply_filters('gravityview_go_back_label', $label);
812 812
 
813
-	$link = gravityview_get_link( $href, esc_html( $label ), array(
813
+	$link = gravityview_get_link($href, esc_html($label), array(
814 814
 		'data-viewid' => $gravityview_view->getViewId()
815 815
 	));
816 816
 
@@ -829,9 +829,9 @@  discard block
 block discarded – undo
829 829
  * @param  string 	$display_value The value generated by Gravity Forms
830 830
  * @return string                Value
831 831
  */
832
-function gravityview_get_field_value( $entry, $field_id, $display_value ) {
832
+function gravityview_get_field_value($entry, $field_id, $display_value) {
833 833
 
834
-	if( floatval( $field_id ) === floor( floatval( $field_id ) ) ) {
834
+	if (floatval($field_id) === floor(floatval($field_id))) {
835 835
 
836 836
 		// For the complete field value as generated by Gravity Forms
837 837
 		return $display_value;
@@ -839,7 +839,7 @@  discard block
 block discarded – undo
839 839
 	} else {
840 840
 
841 841
 		// For one part of the address (City, ZIP, etc.)
842
-		return isset( $entry[ $field_id ] ) ? $entry[ $field_id ] : '';
842
+		return isset($entry[$field_id]) ? $entry[$field_id] : '';
843 843
 
844 844
 	}
845 845
 
@@ -855,48 +855,48 @@  discard block
 block discarded – undo
855 855
  * @param  string      $taxonomy Type of term (`post_tag` or `category`)
856 856
  * @return string                CSV of linked terms
857 857
  */
858
-function gravityview_convert_value_to_term_list( $value, $taxonomy = 'post_tag' ) {
858
+function gravityview_convert_value_to_term_list($value, $taxonomy = 'post_tag') {
859 859
 
860 860
 	$output = array();
861 861
 
862
-	$terms = explode( ', ', $value );
862
+	$terms = explode(', ', $value);
863 863
 
864
-	foreach ($terms as $term_name ) {
864
+	foreach ($terms as $term_name) {
865 865
 
866 866
 		// If we're processing a category,
867
-		if( $taxonomy === 'category' ) {
867
+		if ($taxonomy === 'category') {
868 868
 
869 869
 			// Use rgexplode to prevent errors if : doesn't exist
870
-			list( $term_name, $term_id ) = rgexplode( ':', $value, 2 );
870
+			list($term_name, $term_id) = rgexplode(':', $value, 2);
871 871
 
872 872
 			// The explode was succesful; we have the category ID
873
-			if( !empty( $term_id )) {
874
-				$term = get_term_by( 'id', $term_id, $taxonomy );
873
+			if (!empty($term_id)) {
874
+				$term = get_term_by('id', $term_id, $taxonomy);
875 875
 			} else {
876 876
 			// We have to fall back to the name
877
-				$term = get_term_by( 'name', $term_name, $taxonomy );
877
+				$term = get_term_by('name', $term_name, $taxonomy);
878 878
 			}
879 879
 
880 880
 		} else {
881 881
 			// Use the name of the tag to get the full term information
882
-			$term = get_term_by( 'name', $term_name, $taxonomy );
882
+			$term = get_term_by('name', $term_name, $taxonomy);
883 883
 		}
884 884
 
885 885
 		// There's still a tag/category here.
886
-		if( $term ) {
886
+		if ($term) {
887 887
 
888
-			$term_link = get_term_link( $term, $taxonomy );
888
+			$term_link = get_term_link($term, $taxonomy);
889 889
 
890 890
 			// If there was an error, continue to the next term.
891
-			if ( is_wp_error( $term_link ) ) {
891
+			if (is_wp_error($term_link)) {
892 892
 			    continue;
893 893
 			}
894 894
 
895
-			$output[] = gravityview_get_link( $term_link, esc_html( $term->name ) );
895
+			$output[] = gravityview_get_link($term_link, esc_html($term->name));
896 896
 		}
897 897
 	}
898 898
 
899
-	return implode(', ', $output );
899
+	return implode(', ', $output);
900 900
 }
901 901
 
902 902
 /**
@@ -906,12 +906,12 @@  discard block
 block discarded – undo
906 906
  * @param  string      $taxonomy Taxonomy of term to fetch.
907 907
  * @return string                String with terms
908 908
  */
909
-function gravityview_get_the_term_list( $post_id, $link = true, $taxonomy = 'post_tag' ) {
909
+function gravityview_get_the_term_list($post_id, $link = true, $taxonomy = 'post_tag') {
910 910
 
911
-	$output = get_the_term_list( $post_id, $taxonomy, NULL, ', ' );
911
+	$output = get_the_term_list($post_id, $taxonomy, NULL, ', ');
912 912
 
913
-	if( empty( $link ) ) {
914
-		return strip_tags( $output);
913
+	if (empty($link)) {
914
+		return strip_tags($output);
915 915
 	}
916 916
 
917 917
 	return $output;
@@ -930,17 +930,17 @@  discard block
 block discarded – undo
930 930
 	$fe = GravityView_frontend::getInstance();
931 931
 
932 932
 	// Solve problem when loading content via admin-ajax.php
933
-	if( ! $fe->getGvOutputData() ) {
933
+	if (!$fe->getGvOutputData()) {
934 934
 
935
-		do_action( 'gravityview_log_debug', '[gravityview_get_current_views] gv_output_data not defined; parsing content.' );
935
+		do_action('gravityview_log_debug', '[gravityview_get_current_views] gv_output_data not defined; parsing content.');
936 936
 
937 937
 		$fe->parse_content();
938 938
 	}
939 939
 
940 940
 	// Make 100% sure that we're dealing with a properly called situation
941
-	if( !is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) {
941
+	if (!is_a($fe->getGvOutputData(), 'GravityView_View_Data')) {
942 942
 
943
-		do_action( 'gravityview_log_debug', '[gravityview_get_current_views] gv_output_data not an object or get_view not callable.', $fe->getGvOutputData() );
943
+		do_action('gravityview_log_debug', '[gravityview_get_current_views] gv_output_data not an object or get_view not callable.', $fe->getGvOutputData());
944 944
 
945 945
 		return array();
946 946
 	}
@@ -954,18 +954,18 @@  discard block
 block discarded – undo
954 954
  * @see  GravityView_View_Data::get_view()
955 955
  * @return array View data with `id`, `view_id`, `form_id`, `template_id`, `atts`, `fields`, `widgets`, `form` keys.
956 956
  */
957
-function gravityview_get_current_view_data( $view_id = 0 ) {
957
+function gravityview_get_current_view_data($view_id = 0) {
958 958
 
959 959
 	$fe = GravityView_frontend::getInstance();
960 960
 
961
-	if( ! $fe->getGvOutputData() ) { return array(); }
961
+	if (!$fe->getGvOutputData()) { return array(); }
962 962
 
963 963
 	// If not set, grab the current view ID
964
-	if( empty( $view_id ) ) {
964
+	if (empty($view_id)) {
965 965
 		$view_id = $fe->get_context_view_id();
966 966
 	}
967 967
 
968
-	return $fe->getGvOutputData()->get_view( $view_id );
968
+	return $fe->getGvOutputData()->get_view($view_id);
969 969
 }
970 970
 
971 971
 // Templates' hooks
@@ -974,7 +974,7 @@  discard block
 block discarded – undo
974 974
 	 * @action `gravityview_before` Display content before a View. Used to render widget areas. Rendered outside the View container `<div>`
975 975
 	 * @param int $view_id The ID of the View being displayed
976 976
 	 */
977
-	do_action( 'gravityview_before', gravityview_get_view_id() );
977
+	do_action('gravityview_before', gravityview_get_view_id());
978 978
 }
979 979
 
980 980
 function gravityview_header() {
@@ -982,7 +982,7 @@  discard block
 block discarded – undo
982 982
 	 * @action `gravityview_header` Prepend content to the View container `<div>`
983 983
 	 * @param int $view_id The ID of the View being displayed
984 984
 	 */
985
-	do_action( 'gravityview_header', gravityview_get_view_id() );
985
+	do_action('gravityview_header', gravityview_get_view_id());
986 986
 }
987 987
 
988 988
 function gravityview_footer() {
@@ -990,7 +990,7 @@  discard block
 block discarded – undo
990 990
 	 * @action `gravityview_after` Display content after a View. Used to render footer widget areas. Rendered outside the View container `<div>`
991 991
 	 * @param int $view_id The ID of the View being displayed
992 992
 	 */
993
-	do_action( 'gravityview_footer', gravityview_get_view_id() );
993
+	do_action('gravityview_footer', gravityview_get_view_id());
994 994
 }
995 995
 
996 996
 function gravityview_after() {
@@ -998,7 +998,7 @@  discard block
 block discarded – undo
998 998
 	 * @action `gravityview_after` Append content to the View container `<div>`
999 999
 	 * @param int $view_id The ID of the View being displayed
1000 1000
 	 */
1001
-	do_action( 'gravityview_after', gravityview_get_view_id() );
1001
+	do_action('gravityview_after', gravityview_get_view_id());
1002 1002
 }
1003 1003
 
1004 1004
 /**
@@ -1024,13 +1024,13 @@  discard block
 block discarded – undo
1024 1024
 	 * The Edit Entry functionality overrides this value.
1025 1025
 	 * @param boolean $is_edit_entry
1026 1026
 	 */
1027
-	$is_edit_entry = apply_filters( 'gravityview_is_edit_entry', false );
1027
+	$is_edit_entry = apply_filters('gravityview_is_edit_entry', false);
1028 1028
 
1029
-	if( $is_edit_entry ) {
1029
+	if ($is_edit_entry) {
1030 1030
 		$context = 'edit';
1031
-	} else if( class_exists( 'GravityView_frontend' ) && $single = GravityView_frontend::is_single_entry() ) {
1031
+	} else if (class_exists('GravityView_frontend') && $single = GravityView_frontend::is_single_entry()) {
1032 1032
 		$context = 'single';
1033
-	} else if( class_exists( 'GravityView_View' ) ) {
1033
+	} else if (class_exists('GravityView_View')) {
1034 1034
 		$context = GravityView_View::getInstance()->getContext();
1035 1035
 	}
1036 1036
 
@@ -1055,18 +1055,18 @@  discard block
 block discarded – undo
1055 1055
  * @param  string $gv_class Field class to add to the output HTML
1056 1056
  * @return array           Array of file output, with `file_path` and `html` keys (see comments above)
1057 1057
  */
1058
-function gravityview_get_files_array( $value, $gv_class = '' ) {
1058
+function gravityview_get_files_array($value, $gv_class = '') {
1059 1059
 	/** @define "GRAVITYVIEW_DIR" "../" */
1060 1060
 
1061
-	if( !class_exists( 'GravityView_Field' ) ) {
1062
-		include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field.php' );
1061
+	if (!class_exists('GravityView_Field')) {
1062
+		include_once(GRAVITYVIEW_DIR.'includes/fields/class-gravityview-field.php');
1063 1063
 	}
1064 1064
 
1065
-	if( !class_exists( 'GravityView_Field_FileUpload' ) ) {
1066
-		include_once( GRAVITYVIEW_DIR .'includes/fields/fileupload.php' );
1065
+	if (!class_exists('GravityView_Field_FileUpload')) {
1066
+		include_once(GRAVITYVIEW_DIR.'includes/fields/fileupload.php');
1067 1067
 	}
1068 1068
 
1069
-	return GravityView_Field_FileUpload::get_files_array( $value, $gv_class );
1069
+	return GravityView_Field_FileUpload::get_files_array($value, $gv_class);
1070 1070
 }
1071 1071
 
1072 1072
 /**
@@ -1080,16 +1080,16 @@  discard block
 block discarded – undo
1080 1080
  * @param  string $address Address
1081 1081
  * @return string          URL of link to map of address
1082 1082
  */
1083
-function gravityview_get_map_link( $address ) {
1083
+function gravityview_get_map_link($address) {
1084 1084
 
1085
-	$address_qs = str_replace( array( '<br />', "\n" ), ' ', $address ); // Replace \n with spaces
1086
-	$address_qs = urlencode( $address_qs );
1085
+	$address_qs = str_replace(array('<br />', "\n"), ' ', $address); // Replace \n with spaces
1086
+	$address_qs = urlencode($address_qs);
1087 1087
 
1088 1088
 	$url = "https://maps.google.com/maps?q={$address_qs}";
1089 1089
 
1090
-	$link_text = esc_html__( 'Map It', 'gravityview' );
1090
+	$link_text = esc_html__('Map It', 'gravityview');
1091 1091
 
1092
-	$link = gravityview_get_link( $url, $link_text, 'class=map-it-link' );
1092
+	$link = gravityview_get_link($url, $link_text, 'class=map-it-link');
1093 1093
 
1094 1094
 	/**
1095 1095
 	 * @filter `gravityview_map_link` Modify the map link generated. You can use a different mapping service, for example.
@@ -1097,7 +1097,7 @@  discard block
 block discarded – undo
1097 1097
 	 * @param[in] string $address Address to generate link for
1098 1098
 	 * @param[in] string $url URL generated by the function
1099 1099
 	 */
1100
-	$link = apply_filters( 'gravityview_map_link', $link, $address, $url );
1100
+	$link = apply_filters('gravityview_map_link', $link, $address, $url);
1101 1101
 
1102 1102
 	return $link;
1103 1103
 }
@@ -1118,7 +1118,7 @@  discard block
 block discarded – undo
1118 1118
  * @param  array $passed_args Associative array with field data. `field` and `form` are required.
1119 1119
  * @return string Field output. If empty value and hide empty is true, return empty.
1120 1120
  */
1121
-function gravityview_field_output( $passed_args ) {
1121
+function gravityview_field_output($passed_args) {
1122 1122
 	$defaults = array(
1123 1123
 		'entry' => null,
1124 1124
 		'field' => null,
@@ -1130,7 +1130,7 @@  discard block
 block discarded – undo
1130 1130
 		'zone_id' => null,
1131 1131
 	);
1132 1132
 
1133
-	$args = wp_parse_args( $passed_args, $defaults );
1133
+	$args = wp_parse_args($passed_args, $defaults);
1134 1134
 
1135 1135
 	/**
1136 1136
 	 * @filter `gravityview/field_output/args` Modify the args before generation begins
@@ -1138,15 +1138,15 @@  discard block
 block discarded – undo
1138 1138
 	 * @param array $args Associative array; `field` and `form` is required.
1139 1139
 	 * @param array $passed_args Original associative array with field data. `field` and `form` are required.
1140 1140
 	 */
1141
-	$args = apply_filters( 'gravityview/field_output/args', $args, $passed_args );
1141
+	$args = apply_filters('gravityview/field_output/args', $args, $passed_args);
1142 1142
 
1143 1143
 	// Required fields.
1144
-	if ( empty( $args['field'] ) || empty( $args['form'] ) ) {
1145
-		do_action( 'gravityview_log_error', '[gravityview_field_output] Field or form are empty.', $args );
1144
+	if (empty($args['field']) || empty($args['form'])) {
1145
+		do_action('gravityview_log_error', '[gravityview_field_output] Field or form are empty.', $args);
1146 1146
 		return '';
1147 1147
 	}
1148 1148
 
1149
-	$entry = empty( $args['entry'] ) ? array() : $args['entry'];
1149
+	$entry = empty($args['entry']) ? array() : $args['entry'];
1150 1150
 
1151 1151
 	/**
1152 1152
 	 * Create the content variables for replacing.
@@ -1162,36 +1162,36 @@  discard block
 block discarded – undo
1162 1162
 		'field_id' => '',
1163 1163
 	);
1164 1164
 
1165
-	$context['value'] = gv_value( $entry, $args['field'] );
1165
+	$context['value'] = gv_value($entry, $args['field']);
1166 1166
 
1167 1167
 	// If the value is empty and we're hiding empty, return empty.
1168
-	if ( $context['value'] === '' && ! empty( $args['hide_empty'] ) ) {
1168
+	if ($context['value'] === '' && !empty($args['hide_empty'])) {
1169 1169
 		return '';
1170 1170
 	}
1171 1171
 
1172
-	if ( $context['value'] !== '' && ! empty( $args['wpautop'] ) ) {
1173
-		$context['value'] = wpautop( $context['value'] );
1172
+	if ($context['value'] !== '' && !empty($args['wpautop'])) {
1173
+		$context['value'] = wpautop($context['value']);
1174 1174
 	}
1175 1175
 
1176 1176
 	// Get width setting, if exists
1177
-	$context['width'] = GravityView_API::field_width( $args['field'] );
1177
+	$context['width'] = GravityView_API::field_width($args['field']);
1178 1178
 
1179 1179
 	// If replacing with CSS inline formatting, let's do it.
1180
-	$context['width:style'] = GravityView_API::field_width( $args['field'], 'width:' . $context['width'] . '%;' );
1180
+	$context['width:style'] = GravityView_API::field_width($args['field'], 'width:'.$context['width'].'%;');
1181 1181
 
1182 1182
 	// Grab the Class using `gv_class`
1183
-	$context['class'] = gv_class( $args['field'], $args['form'], $entry );
1184
-	$context['field_id'] = GravityView_API::field_html_attr_id( $args['field'], $args['form'], $entry );
1183
+	$context['class'] = gv_class($args['field'], $args['form'], $entry);
1184
+	$context['field_id'] = GravityView_API::field_html_attr_id($args['field'], $args['form'], $entry);
1185 1185
 
1186 1186
 	// Get field label if needed
1187
-	if ( ! empty( $args['label_markup'] ) && ! empty( $args['field']['show_label'] ) ) {
1188
-		$context['label'] = str_replace( array( '{{label}}', '{{ label }}' ), '<span class="gv-field-label">{{ label_value }}</span>', $args['label_markup'] );
1187
+	if (!empty($args['label_markup']) && !empty($args['field']['show_label'])) {
1188
+		$context['label'] = str_replace(array('{{label}}', '{{ label }}'), '<span class="gv-field-label">{{ label_value }}</span>', $args['label_markup']);
1189 1189
 	}
1190 1190
 
1191 1191
 	// Default Label value
1192
-	$context['label_value'] = gv_label( $args['field'], $entry );
1192
+	$context['label_value'] = gv_label($args['field'], $entry);
1193 1193
 
1194
-	if ( empty( $context['label'] ) && ! empty( $context['label_value'] ) ){
1194
+	if (empty($context['label']) && !empty($context['label_value'])) {
1195 1195
 		$context['label'] = '<span class="gv-field-label">{{ label_value }}</span>';
1196 1196
 	}
1197 1197
 
@@ -1201,37 +1201,37 @@  discard block
 block discarded – undo
1201 1201
 	 * @param string $markup The HTML for the markup
1202 1202
 	 * @param array $args All args for the field output
1203 1203
 	 */
1204
-	$html = apply_filters( 'gravityview/field_output/pre_html', $args['markup'], $args );
1204
+	$html = apply_filters('gravityview/field_output/pre_html', $args['markup'], $args);
1205 1205
 
1206 1206
 	/**
1207 1207
 	 * @filter `gravityview/field_output/open_tag` Modify the opening tags for the template content placeholders
1208 1208
 	 * @since 1.11
1209 1209
 	 * @param string $open_tag Open tag for template content placeholders. Default: `{{`
1210 1210
 	 */
1211
-	$open_tag = apply_filters( 'gravityview/field_output/open_tag', '{{', $args );
1211
+	$open_tag = apply_filters('gravityview/field_output/open_tag', '{{', $args);
1212 1212
 
1213 1213
 	/**
1214 1214
 	 * @filter `gravityview/field_output/close_tag` Modify the closing tags for the template content placeholders
1215 1215
 	 * @since 1.11
1216 1216
 	 * @param string $close_tag Close tag for template content placeholders. Default: `}}`
1217 1217
 	 */
1218
-	$close_tag = apply_filters( 'gravityview/field_output/close_tag', '}}', $args );
1218
+	$close_tag = apply_filters('gravityview/field_output/close_tag', '}}', $args);
1219 1219
 
1220 1220
 	/**
1221 1221
 	 * Loop through each of the tags to replace and replace both `{{tag}}` and `{{ tag }}` with the values
1222 1222
 	 * @since 1.11
1223 1223
 	 */
1224
-	foreach ( $context as $tag => $value ) {
1224
+	foreach ($context as $tag => $value) {
1225 1225
 
1226 1226
 		// If the tag doesn't exist just skip it
1227
-		if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ){
1227
+		if (false === strpos($html, $open_tag.$tag.$close_tag) && false === strpos($html, $open_tag.' '.$tag.' '.$close_tag)) {
1228 1228
 			continue;
1229 1229
 		}
1230 1230
 
1231 1231
 		// Array to search
1232 1232
 		$search = array(
1233
-			$open_tag . $tag . $close_tag,
1234
-			$open_tag . ' ' . $tag . ' ' . $close_tag,
1233
+			$open_tag.$tag.$close_tag,
1234
+			$open_tag.' '.$tag.' '.$close_tag,
1235 1235
 		);
1236 1236
 
1237 1237
 		/**
@@ -1240,26 +1240,26 @@  discard block
 block discarded – undo
1240 1240
 		 * @param string $value The content to be shown instead of the {{tag}} placeholder
1241 1241
 		 * @param array $args Arguments passed to the function
1242 1242
 		 */
1243
-		$value = apply_filters( 'gravityview/field_output/context/' . $tag, $value, $args );
1243
+		$value = apply_filters('gravityview/field_output/context/'.$tag, $value, $args);
1244 1244
 
1245 1245
 		// Finally do the replace
1246
-		$html = str_replace( $search, $value, $html );
1246
+		$html = str_replace($search, $value, $html);
1247 1247
 	}
1248 1248
 
1249 1249
 	/**
1250 1250
 	 * @todo  Depricate `gravityview_field_output`
1251 1251
 	 */
1252
-	$html = apply_filters( 'gravityview_field_output', $html, $args );
1252
+	$html = apply_filters('gravityview_field_output', $html, $args);
1253 1253
 
1254 1254
 	/**
1255 1255
 	 * @filter `gravityview/field_output/html` Modify field HTML output
1256 1256
 	 * @param string $html Existing HTML output
1257 1257
 	 * @param array $args Arguments passed to the function
1258 1258
 	 */
1259
-	$html = apply_filters( 'gravityview/field_output/html', $html, $args );
1259
+	$html = apply_filters('gravityview/field_output/html', $html, $args);
1260 1260
 
1261 1261
 	// Just free up a tiny amount of memory
1262
-	unset( $value, $args, $passed_args, $entry, $context, $search, $open_tag, $tag, $close_tag );
1262
+	unset($value, $args, $passed_args, $entry, $context, $search, $open_tag, $tag, $close_tag);
1263 1263
 
1264 1264
 	return $html;
1265 1265
 }
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-is-fulfilled.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
 	var $is_numeric = false;
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
 
@@ -34,9 +34,9 @@  discard block
 block discarded – undo
34 34
 	 * GravityView_Field_Is_Fulfilled constructor.
35 35
 	 */
36 36
 	public function __construct() {
37
-		$this->label = esc_html__( 'Is Fulfilled', 'gravityview' );
37
+		$this->label = esc_html__('Is Fulfilled', 'gravityview');
38 38
 
39
-		add_filter( 'gravityview_field_entry_value_' . $this->name . '_pre_link', array( $this, 'get_content' ), 10, 4 );
39
+		add_filter('gravityview_field_entry_value_'.$this->name.'_pre_link', array($this, 'get_content'), 10, 4);
40 40
 
41 41
 		parent::__construct();
42 42
 	}
@@ -55,12 +55,12 @@  discard block
 block discarded – undo
55 55
 	 *
56 56
 	 * @return String values for this field based on the numeric values used by Gravity Forms
57 57
 	 */
58
-	public function get_content( $output, $entry, $field_settings, $field ) {
58
+	public function get_content($output, $entry, $field_settings, $field) {
59 59
 
60 60
 		/** Overridden by a template. */
61
-		if( ! empty( $field['field_path'] ) ) { return $output; }
61
+		if (!empty($field['field_path'])) { return $output; }
62 62
 
63
-		return $this->get_string_from_value( $output );
63
+		return $this->get_string_from_value($output);
64 64
 	}
65 65
 
66 66
 	/**
@@ -72,9 +72,9 @@  discard block
 block discarded – undo
72 72
 	 *
73 73
 	 * @return string
74 74
 	 */
75
-	private function get_string_from_value( $value ) {
75
+	private function get_string_from_value($value) {
76 76
 
77
-		switch ( intval( $value ) ) {
77
+		switch (intval($value)) {
78 78
 			case self::NOT_FULFILLED:
79 79
 			default:
80 80
 				$return = __('Not Fulfilled', 'gravityview');
@@ -101,22 +101,22 @@  discard block
 block discarded – undo
101 101
 	 *
102 102
 	 * @return string Original text if {is_fulfilled} isn't found. Otherwise, "Not Fulfilled" or "Fulfilled"
103 103
 	 */
104
-	public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false  ) {
104
+	public function replace_merge_tag($matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false) {
105 105
 
106 106
 		$return = $text;
107 107
 
108
-		foreach ( $matches as $match ) {
108
+		foreach ($matches as $match) {
109 109
 
110 110
 			$full_tag = $match[0];
111 111
 
112
-			$fulfilled = rgar( $entry, 'is_fulfilled' );
112
+			$fulfilled = rgar($entry, 'is_fulfilled');
113 113
 
114
-			$value = $this->get_string_from_value( $fulfilled );
114
+			$value = $this->get_string_from_value($fulfilled);
115 115
 
116
-			$return = str_replace( $full_tag, $value, $return );
116
+			$return = str_replace($full_tag, $value, $return);
117 117
 		}
118 118
 
119
-		unset( $formatted_amount, $value, $amount, $full_tag, $matches );
119
+		unset($formatted_amount, $value, $amount, $full_tag, $matches);
120 120
 
121 121
 		return $return;
122 122
 	}
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-transaction-type.php 1 patch
Spacing   +9 added lines, -9 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', 'in', 'not in' );
17
+	var $search_operators = array('is', 'isnot', 'in', 'not in');
18 18
 
19 19
 	var $group = 'pricing';
20 20
 
@@ -34,10 +34,10 @@  discard block
 block discarded – undo
34 34
 	 * GravityView_Field_Transaction_Type constructor.
35 35
 	 */
36 36
 	public function __construct() {
37
-		$this->label = esc_html__( 'Transaction Type', 'gravityview' );
38
-		$this->description = esc_html__( 'The type of the order: one-time payment or subscription', 'gravityview' );
37
+		$this->label = esc_html__('Transaction Type', 'gravityview');
38
+		$this->description = esc_html__('The type of the order: one-time payment or subscription', 'gravityview');
39 39
 
40
-		add_filter( 'gravityview_field_entry_value_' . $this->name . '_pre_link', array( $this, 'get_content' ), 10, 4 );
40
+		add_filter('gravityview_field_entry_value_'.$this->name.'_pre_link', array($this, 'get_content'), 10, 4);
41 41
 
42 42
 		parent::__construct();
43 43
 	}
@@ -56,12 +56,12 @@  discard block
 block discarded – undo
56 56
 	 *
57 57
 	 * @return String values for this field based on the numeric values used by Gravity Forms
58 58
 	 */
59
-	public function get_content( $output, $entry, $field_settings, $field ) {
59
+	public function get_content($output, $entry, $field_settings, $field) {
60 60
 
61 61
 		/** Overridden by a template. */
62
-		if( ! empty( $field['field_path'] ) ) { return $output; }
62
+		if (!empty($field['field_path'])) { return $output; }
63 63
 
64
-		return $this->get_string_from_value( $output );
64
+		return $this->get_string_from_value($output);
65 65
 	}
66 66
 
67 67
 	/**
@@ -73,9 +73,9 @@  discard block
 block discarded – undo
73 73
 	 *
74 74
 	 * @return string Based on $value; `1`: "One-Time Payment"; `2`: "Subscription"
75 75
 	 */
76
-	private function get_string_from_value( $value ) {
76
+	private function get_string_from_value($value) {
77 77
 
78
-		switch ( intval( $value ) ) {
78
+		switch (intval($value)) {
79 79
 			case self::ONE_TIME_PAYMENT:
80 80
 			default:
81 81
 				$return = __('One-Time Payment', 'gravityview');
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-payment-method.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
 	var $is_numeric = false;
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,8 +24,8 @@  discard block
 block discarded – undo
24 24
 	 * GravityView_Field_Date_Created constructor.
25 25
 	 */
26 26
 	public function __construct() {
27
-		$this->label = esc_attr__( 'Payment Method', 'gravityview' );
28
-		$this->description = esc_html( 'The way the entry was paid for (ie "Credit Card", "PayPal", etc.)', 'gravityview' );
27
+		$this->label = esc_attr__('Payment Method', 'gravityview');
28
+		$this->description = esc_html('The way the entry was paid for (ie "Credit Card", "PayPal", etc.)', 'gravityview');
29 29
 		parent::__construct();
30 30
 	}
31 31
 }
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-payment-amount.php 1 patch
Spacing   +14 added lines, -14 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', 'greater_than', 'less_than', 'contains' );
17
+	var $search_operators = array('is', 'isnot', 'greater_than', 'less_than', 'contains');
18 18
 
19 19
 	var $group = 'pricing';
20 20
 
@@ -24,9 +24,9 @@  discard block
 block discarded – undo
24 24
 	 * GravityView_Field_Payment_Amount constructor.
25 25
 	 */
26 26
 	public function __construct() {
27
-		$this->label = esc_attr__( 'Payment Amount', 'gravityview' );
27
+		$this->label = esc_attr__('Payment Amount', 'gravityview');
28 28
 
29
-		add_filter( 'gravityview_field_entry_value_' . $this->name . '_pre_link', array( $this, 'get_content' ), 10, 4 );
29
+		add_filter('gravityview_field_entry_value_'.$this->name.'_pre_link', array($this, 'get_content'), 10, 4);
30 30
 
31 31
 		parent::__construct();
32 32
 	}
@@ -45,13 +45,13 @@  discard block
 block discarded – undo
45 45
 	 *
46 46
 	 * @return String values for this field based on the numeric values used by Gravity Forms
47 47
 	 */
48
-	public function get_content( $output = '', $entry = array(), $field_settings = array(), $field = array() ) {
48
+	public function get_content($output = '', $entry = array(), $field_settings = array(), $field = array()) {
49 49
 
50 50
 		/** Overridden by a template. */
51
-		if( ! empty( $field['field_path'] ) ) { return $output; }
51
+		if (!empty($field['field_path'])) { return $output; }
52 52
 
53
-		$amount = rgar( $entry, 'payment_amount' );
54
-		$return = GFCommon::to_money( $amount, rgar( $entry, 'currency' ) );
53
+		$amount = rgar($entry, 'payment_amount');
54
+		$return = GFCommon::to_money($amount, rgar($entry, 'currency'));
55 55
 
56 56
 		return $return;
57 57
 	}
@@ -69,23 +69,23 @@  discard block
 block discarded – undo
69 69
 	 *
70 70
 	 * @return string Original text if {date_created} isn't found. Otherwise, replaced text.
71 71
 	 */
72
-	public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false  ) {
72
+	public function replace_merge_tag($matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false) {
73 73
 
74 74
 		$return = $text;
75 75
 
76
-		foreach ( $matches as $match ) {
76
+		foreach ($matches as $match) {
77 77
 
78 78
 			$full_tag = $match[0];
79
-			$modifier = isset( $match[1] ) ? $match[1] : false;
79
+			$modifier = isset($match[1]) ? $match[1] : false;
80 80
 
81
-			$amount = rgar( $entry, 'payment_amount' );
81
+			$amount = rgar($entry, 'payment_amount');
82 82
 
83
-			$formatted_amount = ( 'raw' === $modifier ) ? $amount : GFCommon::to_money( $amount, rgar( $entry, 'currency' ) );
83
+			$formatted_amount = ('raw' === $modifier) ? $amount : GFCommon::to_money($amount, rgar($entry, 'currency'));
84 84
 
85
-			$return = str_replace( $full_tag, $formatted_amount, $return );
85
+			$return = str_replace($full_tag, $formatted_amount, $return);
86 86
 		}
87 87
 
88
-		unset( $formatted_amount, $amount, $full_tag, $matches );
88
+		unset($formatted_amount, $amount, $full_tag, $matches);
89 89
 
90 90
 		return $return;
91 91
 	}
Please login to merge, or discard this patch.