Completed
Push — develop ( df82b0...205b5c )
by
unknown
20:16
created
future/includes/class-gv-template-legacy-override.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -98,15 +98,15 @@  discard block
 block discarded – undo
98 98
 		$additional = array();
99 99
 
100 100
 		// form-19-table-body.php
101
-		$additional[] = sprintf( 'form-%d-%s-%s.php', $this->view->form ? $this->view->form->ID : 0, $slug, $name );
101
+		$additional[ ] = sprintf( 'form-%d-%s-%s.php', $this->view->form ? $this->view->form->ID : 0, $slug, $name );
102 102
 
103 103
 		// view-3-table-body.php
104
-		$additional[] = sprintf( 'view-%d-%s-%s.php', $this->view->ID, $slug, $name );
104
+		$additional[ ] = sprintf( 'view-%d-%s-%s.php', $this->view->ID, $slug, $name );
105 105
 
106 106
 		global $post;
107 107
 		if ( $post ) {
108 108
 			// page-19-table-body.php
109
-			$additional[] = sprintf( 'page-%d-%s-%s.php', $post->ID, $slug, $name );
109
+			$additional[ ] = sprintf( 'page-%d-%s-%s.php', $post->ID, $slug, $name );
110 110
 		}
111 111
 
112 112
 		// Combine with existing table-body.php and table.php
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 		ob_start();
131 131
 
132 132
 		$request = new Mock_Request();
133
-		$request->returns['is_view'] = $this->view;
133
+		$request->returns[ 'is_view' ] = $this->view;
134 134
 
135 135
 		/**
136 136
 		 * You got one shot. One opportunity. To render all the widgets you have ever wanted.
@@ -142,9 +142,9 @@  discard block
 block discarded – undo
142 142
 		 */
143 143
 		global $wp_filter;
144 144
 		foreach ( array( 'gravityview_before', 'gravityview_after' ) as $hook ) {
145
-			foreach ( $wp_filter[ $hook ]->callbacks[10] as $function_key => $callback ) {
145
+			foreach ( $wp_filter[ $hook ]->callbacks[ 10 ] as $function_key => $callback ) {
146 146
 				if ( strpos( $function_key, 'render_widget_hooks' ) ) {
147
-					unset( $wp_filter[ $hook ]->callbacks[10][ $function_key ] );
147
+					unset( $wp_filter[ $hook ]->callbacks[ 10 ][ $function_key ] );
148 148
 				}
149 149
 			}
150 150
 		}
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 		 */
155 155
 		if ( $this->entry ) {
156 156
 
157
-			$request->returns['is_entry'] = $this->entry;
157
+			$request->returns[ 'is_entry' ] = $this->entry;
158 158
 
159 159
 			global $post;
160 160
 
@@ -188,11 +188,11 @@  discard block
 block discarded – undo
188 188
 			 * This allows us to fake it till we make it.
189 189
 			 */
190 190
 			$parameters = $this->view->settings->as_atts();
191
-			if ( ! empty( $parameters['sort_field'] ) && is_array( $parameters['sort_field'] ) ) {
191
+			if ( ! empty( $parameters[ 'sort_field' ] ) && is_array( $parameters[ 'sort_field' ] ) ) {
192 192
 				$has_multisort = true;
193
-				$parameters['sort_field'] = reset( $parameters['sort_field'] );
194
-				if ( ! empty( $parameters['sort_direction'] ) && is_array( $parameters['sort_direction'] ) ) {
195
-					$parameters['sort_direction'] = reset( $parameters['sort_direction'] );
193
+				$parameters[ 'sort_field' ] = reset( $parameters[ 'sort_field' ] );
194
+				if ( ! empty( $parameters[ 'sort_direction' ] ) && is_array( $parameters[ 'sort_direction' ] ) ) {
195
+					$parameters[ 'sort_direction' ] = reset( $parameters[ 'sort_direction' ] );
196 196
 				}
197 197
 			}
198 198
 
@@ -211,8 +211,8 @@  discard block
 block discarded – undo
211 211
 					'fields' => $this->view->fields->by_visible( $this->view ),
212 212
 					'in_the_loop' => true,
213 213
 				), empty( $parameters ) ? array() : array(
214
-					'paging' => $parameters['paging'],
215
-					'sorting' => $parameters['sorting'],
214
+					'paging' => $parameters[ 'paging' ],
215
+					'sorting' => $parameters[ 'sorting' ],
216 216
 				), $post ? array(
217 217
 					'post' => $post,
218 218
 				) : array() ) );
Please login to merge, or discard this patch.
includes/helper-functions.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -32,19 +32,19 @@  discard block
 block discarded – undo
32 32
 	// If there's an overriding CSS file in the current template folder, use it.
33 33
 	$template_css_path = trailingslashit( get_stylesheet_directory() ) . 'gravityview/css/' . $css_file;
34 34
 
35
-	if( file_exists( $template_css_path ) ) {
35
+	if ( file_exists( $template_css_path ) ) {
36 36
 		$path = trailingslashit( get_stylesheet_directory_uri() ) . 'gravityview/css/' . $css_file;
37 37
 		gravityview()->log->debug( 'Stylesheet override ({css_file})', array( 'css_file' => esc_attr( $css_file ) ) );
38 38
 	} else {
39 39
 		// Default: use GravityView CSS file
40 40
 
41 41
 		// If no path is provided, assume default plugin templates CSS folder
42
-		if( '' === $dir_path ) {
42
+		if ( '' === $dir_path ) {
43 43
 			$dir_path = GRAVITYVIEW_DIR . 'templates/css/';
44 44
 		}
45 45
 
46 46
 		// plugins_url() expects a path to a file, not directory. We append a file to be stripped.
47
-		$path = plugins_url( $css_file, trailingslashit( $dir_path )  . 'stripped-by-plugin_basename.php' );
47
+		$path = plugins_url( $css_file, trailingslashit( $dir_path ) . 'stripped-by-plugin_basename.php' );
48 48
 	}
49 49
 
50 50
 	return $path;
@@ -82,9 +82,9 @@  discard block
 block discarded – undo
82 82
 
83 83
 	$parsed_permalink = parse_url( get_permalink( $id ) );
84 84
 
85
-	$permalink_args =  isset( $parsed_permalink['query'] ) ? $parsed_permalink['query'] : false;
85
+	$permalink_args = isset( $parsed_permalink[ 'query' ] ) ? $parsed_permalink[ 'query' ] : false;
86 86
 
87
-	if( empty( $permalink_args ) ) {
87
+	if ( empty( $permalink_args ) ) {
88 88
 		return array();
89 89
 	}
90 90
 
@@ -109,15 +109,15 @@  discard block
 block discarded – undo
109 109
 function gv_selected( $value, $current, $echo = true, $type = 'selected' ) {
110 110
 
111 111
 	$output = '';
112
-	if( is_array( $current ) ) {
113
-		if( in_array( $value, $current ) ) {
112
+	if ( is_array( $current ) ) {
113
+		if ( in_array( $value, $current ) ) {
114 114
 			$output = __checked_selected_helper( true, true, false, $type );
115 115
 		}
116 116
 	} else {
117 117
 		$output = __checked_selected_helper( $value, $current, false, $type );
118 118
 	}
119 119
 
120
-	if( $echo ) {
120
+	if ( $echo ) {
121 121
 		echo $output;
122 122
 	}
123 123
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 }
126 126
 
127 127
 
128
-if( ! function_exists( 'gravityview_sanitize_html_class' ) ) {
128
+if ( ! function_exists( 'gravityview_sanitize_html_class' ) ) {
129 129
 
130 130
 	/**
131 131
 	 * sanitize_html_class doesn't handle spaces (multiple classes). We remedy that.
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
  */
172 172
 function gravityview_strip_whitespace( $string ) {
173 173
 	$string = normalize_whitespace( $string );
174
-	return preg_replace('/[\r\n\t ]+/', ' ', $string );
174
+	return preg_replace( '/[\r\n\t ]+/', ' ', $string );
175 175
 }
176 176
 
177 177
 /**
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
  * @return string Included file contents
186 186
  */
187 187
 function gravityview_ob_include( $file_path, $object = NULL ) {
188
-	if( ! file_exists( $file_path ) ) {
188
+	if ( ! file_exists( $file_path ) ) {
189 189
 		gravityview()->log->error( 'File path does not exist. {path}', array( 'path' => $file_path ) );
190 190
 		return '';
191 191
 	}
@@ -209,15 +209,15 @@  discard block
 block discarded – undo
209 209
 
210 210
 	$width = $height * 0.7586206897;
211 211
 
212
-	if( function_exists('is_rtl') && is_rtl() ) {
213
-		$style = 'margin:10px 10px 10px 0; height='. $height .'px; width: '. $width .'px;';
212
+	if ( function_exists( 'is_rtl' ) && is_rtl() ) {
213
+		$style = 'margin:10px 10px 10px 0; height=' . $height . 'px; width: ' . $width . 'px;';
214 214
 		$css_class = is_string( $css_class ) ? $css_class : 'alignright';
215 215
 	} else {
216
-		$style = 'margin:10px 10px 10px 0; height='. $height .'px; width: '. $width .'px;';
216
+		$style = 'margin:10px 10px 10px 0; height=' . $height . 'px; width: ' . $width . 'px;';
217 217
 		$css_class = is_string( $css_class ) ? $css_class : 'alignleft';
218 218
 	}
219 219
 
220
-	return '<img src="'. esc_url( plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ) ) .'" class="'. gravityview_sanitize_html_class( $css_class ).'" height="'.intval( $height ).'" width="'.round( $width, 2 ).'" alt="The GravityView Astronaut Says:" style="'.$style.'" />';
220
+	return '<img src="' . esc_url( plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ) ) . '" class="' . gravityview_sanitize_html_class( $css_class ) . '" height="' . intval( $height ) . '" width="' . round( $width, 2 ) . '" alt="The GravityView Astronaut Says:" style="' . $style . '" />';
221 221
 }
222 222
 
223 223
 /**
@@ -241,9 +241,9 @@  discard block
 block discarded – undo
241 241
 function gravityview_number_format( $number, $decimals = '', $separator = true ) {
242 242
 	global $wp_locale;
243 243
 
244
-	if( '' === $decimals ) {
244
+	if ( '' === $decimals ) {
245 245
 
246
-		$decimal_point = isset( $wp_locale ) ? $wp_locale->number_format['decimal_point'] : '.';
246
+		$decimal_point = isset( $wp_locale ) ? $wp_locale->number_format[ 'decimal_point' ] : '.';
247 247
 
248 248
 		/**
249 249
 		 * Calculate the position of the decimal point in the number
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 	$parts = parse_url( $value );
277 277
 
278 278
 	// No domain? Strange...show the original text.
279
-	if( empty( $parts['host'] ) ) {
279
+	if ( empty( $parts[ 'host' ] ) ) {
280 280
 		return $value;
281 281
 	}
282 282
 
@@ -289,16 +289,16 @@  discard block
 block discarded – undo
289 289
 	 * @param boolean $enable Whether to strip the scheme. Return false to show scheme. (default: true)\n
290 290
 	 * If true: `http://example.com => example.com`
291 291
 	 */
292
-	if( false === apply_filters('gravityview_anchor_text_striphttp', true) ) {
292
+	if ( false === apply_filters( 'gravityview_anchor_text_striphttp', true ) ) {
293 293
 
294
-		if( isset( $parts['scheme'] ) ) {
295
-			$return .= $parts['scheme'];
294
+		if ( isset( $parts[ 'scheme' ] ) ) {
295
+			$return .= $parts[ 'scheme' ];
296 296
 		}
297 297
 
298 298
 	}
299 299
 
300 300
 	// The domain, which may contain a subdomain
301
-	$domain = $parts['host'];
301
+	$domain = $parts[ 'host' ];
302 302
 
303 303
 	/**
304 304
 	 * @filter `gravityview_anchor_text_stripwww` Strip www from the domain?
@@ -306,10 +306,10 @@  discard block
 block discarded – undo
306 306
 	 * @param boolean $enable Whether to strip www. Return false to show www. (default: true)\n
307 307
 	 * If true: `www.example.com => example.com`
308 308
 	 */
309
-	$strip_www = apply_filters('gravityview_anchor_text_stripwww', true );
309
+	$strip_www = apply_filters( 'gravityview_anchor_text_stripwww', true );
310 310
 
311
-	if( $strip_www ) {
312
-		$domain = str_replace('www.', '', $domain );
311
+	if ( $strip_www ) {
312
+		$domain = str_replace( 'www.', '', $domain );
313 313
 	}
314 314
 
315 315
 	/**
@@ -319,11 +319,11 @@  discard block
 block discarded – undo
319 319
 	 * If true: `http://demo.example.com => example.com` \n
320 320
 	 * If false: `http://demo.example.com => demo.example.com`
321 321
 	 */
322
-	$strip_subdomains = apply_filters('gravityview_anchor_text_nosubdomain', true);
322
+	$strip_subdomains = apply_filters( 'gravityview_anchor_text_nosubdomain', true );
323 323
 
324
-	if( $strip_subdomains ) {
324
+	if ( $strip_subdomains ) {
325 325
 
326
-		$domain = _gravityview_strip_subdomain( $parts['host'] );
326
+		$domain = _gravityview_strip_subdomain( $parts[ 'host' ] );
327 327
 
328 328
 	}
329 329
 
@@ -337,12 +337,12 @@  discard block
 block discarded – undo
337 337
 	 * If true: `http://example.com/sub/directory/page.html => example.com`  \n
338 338
 	 * If false: `http://example.com/sub/directory/page.html => example.com/sub/directory/page.html`
339 339
 	 */
340
-	$root_only = apply_filters('gravityview_anchor_text_rootonly', true);
340
+	$root_only = apply_filters( 'gravityview_anchor_text_rootonly', true );
341 341
 
342
-	if( empty( $root_only ) ) {
342
+	if ( empty( $root_only ) ) {
343 343
 
344
-		if( isset( $parts['path'] ) ) {
345
-			$return .= $parts['path'];
344
+		if ( isset( $parts[ 'path' ] ) ) {
345
+			$return .= $parts[ 'path' ];
346 346
 		}
347 347
 	}
348 348
 
@@ -352,12 +352,12 @@  discard block
 block discarded – undo
352 352
 	 * @param boolean $enable Whether to enable "root only". Return false to show full path. (default: true)\n
353 353
 	 * If true: `http://example.com/?query=example => example.com`
354 354
 	 */
355
-	$strip_query_string = apply_filters('gravityview_anchor_text_noquerystring', true );
355
+	$strip_query_string = apply_filters( 'gravityview_anchor_text_noquerystring', true );
356 356
 
357
-	if( empty( $strip_query_string ) ) {
357
+	if ( empty( $strip_query_string ) ) {
358 358
 
359
-		if( isset( $parts['query'] ) ) {
360
-			$return .= '?'.$parts['query'];
359
+		if ( isset( $parts[ 'query' ] ) ) {
360
+			$return .= '?' . $parts[ 'query' ];
361 361
 		}
362 362
 
363 363
 	}
@@ -374,8 +374,8 @@  discard block
 block discarded – undo
374 374
  */
375 375
 function _gravityview_strip_subdomain( $string_maybe_has_subdomain ) {
376 376
 
377
-	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 ) ) {
378
-		return $matches['domain'];
377
+	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 ) ) {
378
+		return $matches[ 'domain' ];
379 379
 	} else {
380 380
 		return $string_maybe_has_subdomain;
381 381
 	}
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
 
445 445
 		if ( in_array( $value, array( 'yes', 'true' ), true ) ) {
446 446
 			$value = true;
447
-		} else if( in_array( $value, array( 'no', 'false' ), true ) ) {
447
+		} else if ( in_array( $value, array( 'no', 'false' ), true ) ) {
448 448
 			$value = false;
449 449
 		}
450 450
 	}
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
  */
474 474
 function gv_maybe_json_decode( $value, $assoc = false, $depth = 512, $options = 0 ) {
475 475
 
476
-	if( ! is_string( $value ) ) {
476
+	if ( ! is_string( $value ) ) {
477 477
 		return $value;
478 478
 	}
479 479
 
@@ -484,12 +484,12 @@  discard block
 block discarded – undo
484 484
 	}
485 485
 
486 486
 	// There was a JSON error (PHP 5.3+)
487
-	if( function_exists('json_last_error') && JSON_ERROR_NONE !== json_last_error() ) {
487
+	if ( function_exists( 'json_last_error' ) && JSON_ERROR_NONE !== json_last_error() ) {
488 488
 		return $value;
489 489
 	}
490 490
 
491 491
 	// It wasn't JSON (PHP < 5.3 fallback)
492
-	if( is_null( $decoded ) ) {
492
+	if ( is_null( $decoded ) ) {
493 493
 		return $value;
494 494
 	}
495 495
 
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
 
557 557
 	$exploded = explode( '.', "{$field_id}" );
558 558
 
559
-	return isset( $exploded[1] ) ? intval( $exploded[1] ) : false;
559
+	return isset( $exploded[ 1 ] ) ? intval( $exploded[ 1 ] ) : false;
560 560
 }
561 561
 
562 562
 /**
@@ -597,13 +597,13 @@  discard block
 block discarded – undo
597 597
 	 */
598 598
 	$args = apply_filters( 'gravityview_get_terms_choices_args', $args );
599 599
 
600
-	$terms = get_terms( $args['taxonomy'], $args );
600
+	$terms = get_terms( $args[ 'taxonomy' ], $args );
601 601
 
602 602
 	$choices = array();
603 603
 
604 604
 	if ( is_array( $terms ) ) {
605 605
 		foreach ( $terms as $term_id => $term_name ) {
606
-			$choices[] = array(
606
+			$choices[ ] = array(
607 607
 				'text'  => $term_name,
608 608
 				'value' => $term_id
609 609
 			);
@@ -627,21 +627,21 @@  discard block
 block discarded – undo
627 627
 function _gravityview_process_posted_fields() {
628 628
 	$fields = array();
629 629
 
630
-	if( !empty( $_POST['gv_fields'] ) ) {
631
-		if ( ! is_array( $_POST['gv_fields'] ) ) {
630
+	if ( ! empty( $_POST[ 'gv_fields' ] ) ) {
631
+		if ( ! is_array( $_POST[ 'gv_fields' ] ) ) {
632 632
 
633 633
 			// We are not using parse_str() due to max_input_vars limitation with large View configurations
634 634
 			$fields_holder = array();
635
-			GVCommon::gv_parse_str( stripslashes( $_POST['gv_fields'] ), $fields_holder );
635
+			GVCommon::gv_parse_str( stripslashes( $_POST[ 'gv_fields' ] ), $fields_holder );
636 636
 
637
-			if ( isset( $fields_holder['fields'] ) ) {
638
-				$fields = $fields_holder['fields'];
637
+			if ( isset( $fields_holder[ 'fields' ] ) ) {
638
+				$fields = $fields_holder[ 'fields' ];
639 639
 			} else {
640 640
 				gravityview()->log->error( 'No `fields` key was found after parsing $fields string', array( 'data' => $fields_holder ) );
641 641
 			}
642 642
 
643 643
 		} else {
644
-			$fields = $_POST['gv_fields'];
644
+			$fields = $_POST[ 'gv_fields' ];
645 645
 		}
646 646
 	}
647 647
 
Please login to merge, or discard this patch.
includes/class-gravityview-admin-notices.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -60,21 +60,21 @@  discard block
 block discarded – undo
60 60
 	public function dismiss_notice() {
61 61
 
62 62
 		// No dismiss sent
63
-		if( empty( $_GET['gv-dismiss'] ) || empty( $_GET['notice'] ) ) {
63
+		if ( empty( $_GET[ 'gv-dismiss' ] ) || empty( $_GET[ 'notice' ] ) ) {
64 64
 			return;
65 65
 		}
66 66
 
67 67
 		// Invalid nonce
68
-		if( !wp_verify_nonce( $_GET['gv-dismiss'], 'dismiss' ) ) {
68
+		if ( ! wp_verify_nonce( $_GET[ 'gv-dismiss' ], 'dismiss' ) ) {
69 69
 			return;
70 70
 		}
71 71
 
72
-		$notice_id = esc_attr( $_GET['notice'] );
72
+		$notice_id = esc_attr( $_GET[ 'notice' ] );
73 73
 
74 74
 		//don't display a message if use has dismissed the message for this version
75 75
 		$dismissed_notices = (array)get_transient( 'gravityview_dismissed_notices' );
76 76
 
77
-		$dismissed_notices[] = $notice_id;
77
+		$dismissed_notices[ ] = $notice_id;
78 78
 
79 79
 		$dismissed_notices = array_unique( $dismissed_notices );
80 80
 
@@ -97,12 +97,12 @@  discard block
 block discarded – undo
97 97
 	private function is_notice_dismissed( $notice ) {
98 98
 
99 99
 		// There are no dismissed notices.
100
-		if( empty( self::$dismissed_notices ) ) {
100
+		if ( empty( self::$dismissed_notices ) ) {
101 101
 			return false;
102 102
 		}
103 103
 
104 104
 		// Has the
105
-		$is_dismissed = !empty( $notice['dismiss'] ) && in_array( $notice['dismiss'], self::$dismissed_notices );
105
+		$is_dismissed = ! empty( $notice[ 'dismiss' ] ) && in_array( $notice[ 'dismiss' ], self::$dismissed_notices );
106 106
 
107 107
 		return $is_dismissed ? true : false;
108 108
 	}
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	 */
128 128
 	private function check_show_multisite_notices() {
129 129
 
130
-		if( ! is_multisite() ) {
130
+		if ( ! is_multisite() ) {
131 131
 			return true;
132 132
 		}
133 133
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 		}
138 138
 
139 139
 		// or they don't have admin capabilities
140
-		if( ! is_super_admin() ) {
140
+		if ( ! is_super_admin() ) {
141 141
 			return false;
142 142
 		}
143 143
 
@@ -160,48 +160,48 @@  discard block
 block discarded – undo
160 160
 		 */
161 161
 		$notices = apply_filters( 'gravityview/admin/notices', self::$admin_notices );
162 162
 
163
-		if( empty( $notices ) || ! $this->check_show_multisite_notices() ) {
163
+		if ( empty( $notices ) || ! $this->check_show_multisite_notices() ) {
164 164
 			return;
165 165
 		}
166 166
 
167 167
 		//don't display a message if use has dismissed the message for this version
168 168
 		// TODO: Use get_user_meta instead of get_transient
169
-		self::$dismissed_notices = isset( $_GET['show-dismissed-notices'] ) ? array() : (array)get_transient( 'gravityview_dismissed_notices' );
169
+		self::$dismissed_notices = isset( $_GET[ 'show-dismissed-notices' ] ) ? array() : (array)get_transient( 'gravityview_dismissed_notices' );
170 170
 
171 171
 		$output = '';
172 172
 
173
-		foreach( $notices as $notice ) {
173
+		foreach ( $notices as $notice ) {
174 174
 
175 175
 			// If the user doesn't have the capability to see the warning
176
-			if( isset( $notice['cap'] ) && false === GVCommon::has_cap( $notice['cap'] ) ) {
176
+			if ( isset( $notice[ 'cap' ] ) && false === GVCommon::has_cap( $notice[ 'cap' ] ) ) {
177 177
 				gravityview()->log->debug( 'Notice not shown because user does not have the capability to view it.', array( 'data' => $notice ) );
178 178
 				continue;
179 179
 			}
180 180
 
181
-			if( true === $this->is_notice_dismissed( $notice ) ) {
181
+			if ( true === $this->is_notice_dismissed( $notice ) ) {
182 182
 				gravityview()->log->debug( 'Notice not shown because the notice has already been dismissed.', array( 'data' => $notice ) );
183 183
 				continue;
184 184
 			}
185 185
 
186
-			$output .= '<div id="message" style="position:relative" class="notice '. gravityview_sanitize_html_class( $notice['class'] ).'">';
186
+			$output .= '<div id="message" style="position:relative" class="notice ' . gravityview_sanitize_html_class( $notice[ 'class' ] ) . '">';
187 187
 
188 188
 			// Too cute to leave out.
189 189
 			$output .= gravityview_get_floaty();
190 190
 
191
-			if( !empty( $notice['title'] ) ) {
192
-				$output .= '<h3>'.esc_html( $notice['title'] ) .'</h3>';
191
+			if ( ! empty( $notice[ 'title' ] ) ) {
192
+				$output .= '<h3>' . esc_html( $notice[ 'title' ] ) . '</h3>';
193 193
 			}
194 194
 
195
-			$message = isset( $notice['message'] ) ? $notice['message'] : '';
195
+			$message = isset( $notice[ 'message' ] ) ? $notice[ 'message' ] : '';
196 196
 
197
-			if( !empty( $notice['dismiss'] ) ) {
197
+			if ( ! empty( $notice[ 'dismiss' ] ) ) {
198 198
 
199
-				$dismiss = esc_attr($notice['dismiss']);
199
+				$dismiss = esc_attr( $notice[ 'dismiss' ] );
200 200
 
201 201
 				$url = esc_url( add_query_arg( array( 'gv-dismiss' => wp_create_nonce( 'dismiss' ), 'notice' => $dismiss ) ) );
202 202
 
203 203
 				$align = is_rtl() ? 'alignleft' : 'alignright';
204
-				$message .= '<a href="'.$url.'" data-notice="'.$dismiss.'" class="' . $align . ' button button-link">'.esc_html__('Dismiss', 'gravityview' ).'</a></p>';
204
+				$message .= '<a href="' . $url . '" data-notice="' . $dismiss . '" class="' . $align . ' button button-link">' . esc_html__( 'Dismiss', 'gravityview' ) . '</a></p>';
205 205
 			}
206 206
 
207 207
 			$output .= wpautop( $message );
@@ -233,14 +233,14 @@  discard block
 block discarded – undo
233 233
 	 */
234 234
 	public static function add_notice( $notice = array() ) {
235 235
 
236
-		if( !isset( $notice['message'] ) ) {
236
+		if ( ! isset( $notice[ 'message' ] ) ) {
237 237
 			gravityview()->log->error( 'Notice not set', array( 'data' => $notice ) );
238 238
 			return;
239 239
 		}
240 240
 
241
-		$notice['class'] = empty( $notice['class'] ) ? 'error' : $notice['class'];
241
+		$notice[ 'class' ] = empty( $notice[ 'class' ] ) ? 'error' : $notice[ 'class' ];
242 242
 
243
-		self::$admin_notices[] = $notice;
243
+		self::$admin_notices[ ] = $notice;
244 244
 	}
245 245
 }
246 246
 
Please login to merge, or discard this patch.
future/includes/class-gv-renderer.php 1 patch
Spacing   +5 added lines, -6 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 		$current_user  = wp_get_current_user();
82 82
 		$user_meta_key = '_gv_dismissed_entry_approval_notice' . $gravityview->view->ID;
83 83
 
84
-		if ( isset( $_GET['gv-dismiss'] ) && wp_verify_nonce( $_GET['gv-dismiss'], 'dismiss' ) ) {
84
+		if ( isset( $_GET[ 'gv-dismiss' ] ) && wp_verify_nonce( $_GET[ 'gv-dismiss' ], 'dismiss' ) ) {
85 85
 			add_user_meta( $current_user->ID, $user_meta_key, 1 ); // Prevent user from seeing this again for this View
86 86
 			return;
87 87
 		}
@@ -150,8 +150,7 @@  discard block
 block discarded – undo
150 150
 				$tab = __( 'Edit Entry', 'gravityview' );
151 151
 				$context = 'edit';
152 152
 				break;
153
-			case ( $gravityview->request->is_entry( $gravityview->view->form ? $gravityview->view->form->ID : 0 ) ):
154
-				$tab = __( 'Single Entry', 'gravityview' );
153
+			case ( $gravityview->request->is_entry( $gravityview->view->form ? $gravityview->view->form->ID : 0 ) ) : $tab = __( 'Single Entry', 'gravityview' );
155 154
 				$context = 'single';
156 155
 				break;
157 156
 			default:
@@ -173,7 +172,7 @@  discard block
 block discarded – undo
173 172
 		$action_text = sprintf( esc_html__( 'Add fields to %s', 'gravityview' ), $tab );
174 173
 		$message = esc_html__( 'You can only see this message because you are able to edit this View.', 'gravityview' );
175 174
 
176
-		$image =  sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', $tab, esc_url( plugins_url( sprintf( 'assets/images/tab-%s.png', $context ), GRAVITYVIEW_FILE ) ) );
175
+		$image = sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', $tab, esc_url( plugins_url( sprintf( 'assets/images/tab-%s.png', $context ), GRAVITYVIEW_FILE ) ) );
177 176
 		$output = sprintf( '<h3>%s <strong><a href="%s">%s</a></strong></h3><p>%s</p>', $title, esc_url( $edit_link ), $action_text, $message );
178 177
 
179 178
 		echo \GVCommon::generate_notice( $output . $image, 'gv-warning warning', 'edit_gravityview', $gravityview->view->ID );
@@ -199,11 +198,11 @@  discard block
 block discarded – undo
199 198
 
200 199
 		$post_types = get_post_types();
201 200
 
202
-		foreach( $post_types as $post_type ) {
201
+		foreach ( $post_types as $post_type ) {
203 202
 			$post_type_rewrite = get_post_type_object( $post_type )->rewrite;
204 203
 
205 204
 			if ( $slug = \GV\Utils::get( $post_type_rewrite, 'slug' ) ) {
206
-				$reserved_slugs[] = $slug;
205
+				$reserved_slugs[ ] = $slug;
207 206
 			}
208 207
 		}
209 208
 
Please login to merge, or discard this patch.
includes/class-admin-views.php 1 patch
Spacing   +196 added lines, -196 removed lines patch added patch discarded remove patch
@@ -27,32 +27,32 @@  discard block
 block discarded – undo
27 27
 		add_filter( 'gravityview_blacklist_field_types', array( $this, 'default_field_blacklist' ), 10, 2 );
28 28
 
29 29
 		// Tooltips
30
-		add_filter( 'gform_tooltips', array( $this, 'tooltips') );
30
+		add_filter( 'gform_tooltips', array( $this, 'tooltips' ) );
31 31
 
32 32
 		// adding styles and scripts
33
-		add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles'), 999 );
34
-		add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict') );
35
-		add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict') );
36
-		add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict') );
37
-		add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict') );
38
-
39
-		add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas'), 10, 4 );
40
-		add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas'), 10, 3 );
41
-		add_action( 'gravityview_render_field_pickers', array( $this, 'render_field_pickers'), 10, 2 );
42
-		add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields'), 10, 2 );
43
-		add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets') );
44
-		add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas'), 10, 5 );
33
+		add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles' ), 999 );
34
+		add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict' ) );
35
+		add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict' ) );
36
+		add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict' ) );
37
+		add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) );
38
+
39
+		add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas' ), 10, 4 );
40
+		add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas' ), 10, 3 );
41
+		add_action( 'gravityview_render_field_pickers', array( $this, 'render_field_pickers' ), 10, 2 );
42
+		add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields' ), 10, 2 );
43
+		add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets' ) );
44
+		add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas' ), 10, 5 );
45 45
 
46 46
 		// @todo check if this hook is needed..
47 47
 		//add_action( 'gravityview_render_field_options', array( $this, 'render_field_options'), 10, 9 );
48 48
 
49 49
 		// Add Connected Form column
50
-		add_filter('manage_gravityview_posts_columns' , array( $this, 'add_post_type_columns' ) );
50
+		add_filter( 'manage_gravityview_posts_columns', array( $this, 'add_post_type_columns' ) );
51 51
 
52 52
 		add_filter( 'gform_toolbar_menu', array( 'GravityView_Admin_Views', 'gform_toolbar_menu' ), 10, 2 );
53 53
 		add_action( 'gform_form_actions', array( 'GravityView_Admin_Views', 'gform_toolbar_menu' ), 10, 2 );
54 54
 
55
-		add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content'), 10, 2 );
55
+		add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content' ), 10, 2 );
56 56
 
57 57
 		add_action( 'restrict_manage_posts', array( $this, 'add_view_dropdown' ) );
58 58
 
@@ -70,11 +70,11 @@  discard block
 block discarded – undo
70 70
 	 */
71 71
 	function suggest_support_articles( $localization_data = array() ) {
72 72
 
73
-	    if( ! gravityview()->request->is_view() ) {
73
+	    if ( ! gravityview()->request->is_view() ) {
74 74
 	        return $localization_data;
75 75
         }
76 76
 
77
-		$localization_data['suggest'] = array(
77
+		$localization_data[ 'suggest' ] = array(
78 78
             '57ef23539033602e61d4a560',
79 79
             '54c67bb9e4b0512429885513',
80 80
             '54c67bb9e4b0512429885512',
@@ -103,20 +103,20 @@  discard block
 block discarded – undo
103 103
 			return;
104 104
 		}
105 105
 
106
-		if ( ! isset( $query->query_vars['post_type'] ) ) {
106
+		if ( ! isset( $query->query_vars[ 'post_type' ] ) ) {
107 107
 			return;
108 108
 		}
109 109
 
110
-		if ( 'gravityview' !== $query->query_vars['post_type'] ) {
110
+		if ( 'gravityview' !== $query->query_vars[ 'post_type' ] ) {
111 111
 			return;
112 112
 		}
113 113
 
114
-		$form_id = (int) \GV\Utils::_GET( 'gravityview_form_id' );
114
+		$form_id = (int)\GV\Utils::_GET( 'gravityview_form_id' );
115 115
 
116 116
 		$meta_query = array();
117 117
 
118 118
 		if ( $form_id ) {
119
-			$meta_query[] = array(
119
+			$meta_query[ ] = array(
120 120
 					'key'   => '_gravityview_form_id',
121 121
 					'value' => $form_id,
122 122
 			);
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 		$layout_id = \GV\Utils::_GET( 'gravityview_layout' );
126 126
 
127 127
 		if ( $layout_id ) {
128
-			$meta_query[] = array(
128
+			$meta_query[ ] = array(
129 129
 					'key'   => '_gravityview_directory_template',
130 130
 					'value' => esc_attr( $layout_id ),
131 131
 			);
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	public function add_view_dropdown() {
143 143
 		$current_screen = get_current_screen();
144 144
 
145
-		if( 'gravityview' !== $current_screen->post_type ) {
145
+		if ( 'gravityview' !== $current_screen->post_type ) {
146 146
 			return;
147 147
 		}
148 148
 
@@ -150,12 +150,12 @@  discard block
 block discarded – undo
150 150
 		$current_form = \GV\Utils::_GET( 'gravityview_form_id' );
151 151
 
152 152
 		// If there are no forms to select, show no forms.
153
-		if( ! empty( $forms ) ) { ?>
153
+		if ( ! empty( $forms ) ) { ?>
154 154
 			<label for="gravityview_form_id" class="screen-reader-text"><?php esc_html_e( 'Filter Views by form', 'gravityview' ); ?></label>
155 155
 			<select name="gravityview_form_id" id="gravityview_form_id">
156 156
 				<option value="" <?php selected( '', $current_form, true ); ?>><?php esc_html_e( 'All forms', 'gravityview' ); ?></option>
157
-				<?php foreach( $forms as $form ) { ?>
158
-					<option value="<?php echo esc_attr( $form['id'] ); ?>" <?php selected( $form['id'], $current_form, true ); ?>><?php echo esc_html( $form['title'] ); ?></option>
157
+				<?php foreach ( $forms as $form ) { ?>
158
+					<option value="<?php echo esc_attr( $form[ 'id' ] ); ?>" <?php selected( $form[ 'id' ], $current_form, true ); ?>><?php echo esc_html( $form[ 'title' ] ); ?></option>
159 159
 				<?php } ?>
160 160
 			</select>
161 161
 		<?php }
@@ -164,26 +164,26 @@  discard block
 block discarded – undo
164 164
 		$current_layout = \GV\Utils::_GET( 'gravityview_layout' );
165 165
 
166 166
 		// If there are no forms to select, show no forms.
167
-		if( ! empty( $layouts ) ) { ?>
167
+		if ( ! empty( $layouts ) ) { ?>
168 168
 			<label for="gravityview_layout_name" class="screen-reader-text"><?php esc_html_e( 'Filter Views by layout', 'gravityview' ); ?></label>
169 169
 			<select name="gravityview_layout" id="gravityview_layout_name">
170 170
 				<option value="" <?php selected( '', $current_layout, true ); ?>><?php esc_html_e( 'All layouts', 'gravityview' ); ?></option>
171 171
 				<optgroup label="<?php esc_html_e( 'Layouts', 'gravityview' ); ?>">
172
-				<?php foreach( $layouts as $layout_id => $layout ) {
173
-					if ( in_array( $layout['type'], array( 'preset', 'internal' ), true ) ) {
172
+				<?php foreach ( $layouts as $layout_id => $layout ) {
173
+					if ( in_array( $layout[ 'type' ], array( 'preset', 'internal' ), true ) ) {
174 174
 						continue;
175 175
 					}
176 176
 					?>
177
-					<option value="<?php echo esc_attr( $layout_id ); ?>" <?php selected( $layout_id, $current_layout, true ); ?>><?php echo esc_html( $layout['label'] ); ?></option>
177
+					<option value="<?php echo esc_attr( $layout_id ); ?>" <?php selected( $layout_id, $current_layout, true ); ?>><?php echo esc_html( $layout[ 'label' ] ); ?></option>
178 178
 				<?php } ?>
179 179
 				</optgroup>
180 180
 				<optgroup label="<?php esc_html_e( 'Form Presets', 'gravityview' ); ?>">
181
-				<?php foreach( $layouts as $layout_id => $layout ) {
182
-					if ( ! in_array( $layout['type'], array( 'preset' ), true ) ) {
181
+				<?php foreach ( $layouts as $layout_id => $layout ) {
182
+					if ( ! in_array( $layout[ 'type' ], array( 'preset' ), true ) ) {
183 183
 						continue;
184 184
 					}
185 185
 					?>
186
-					<option value="<?php echo esc_attr( $layout_id ); ?>" <?php selected( $layout_id, $current_layout, true ); ?>><?php echo esc_html( $layout['label'] ); ?></option>
186
+					<option value="<?php echo esc_attr( $layout_id ); ?>" <?php selected( $layout_id, $current_layout, true ); ?>><?php echo esc_html( $layout[ 'label' ] ); ?></option>
187 187
 				<?php } ?>
188 188
 				</optgroup>
189 189
 			</select>
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	 */
198 198
 	public static function render_setting_row( $key = '', $current_settings = array(), $override_input = null, $name = 'template_settings[%s]', $id = 'gravityview_se_%s' ) {
199 199
 		_deprecated_function( 'GravityView_Admin_Views::render_setting_row', '1.1.7', 'GravityView_Render_Settings::render_setting_row' );
200
-		GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name , $id );
200
+		GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name, $id );
201 201
 	}
202 202
 
203 203
 	/**
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 	public static function gform_toolbar_menu( $menu_items = array(), $id = NULL ) {
220 220
 
221 221
 		// Don't show on Trashed forms
222
-		if( 'trash' === rgget( 'filter') ) {
222
+		if ( 'trash' === rgget( 'filter' ) ) {
223 223
 			return $menu_items;
224 224
 		}
225 225
 
@@ -227,13 +227,13 @@  discard block
 block discarded – undo
227 227
 
228 228
 		$priority = 0;
229 229
 
230
-		if( 'form_list' === GFForms::get_page() ) {
230
+		if ( 'form_list' === GFForms::get_page() ) {
231 231
 			$priority = 790;
232 232
         }
233 233
 
234
-		if( empty( $connected_views ) ) {
234
+		if ( empty( $connected_views ) ) {
235 235
 
236
-		    $menu_items['gravityview'] = array(
236
+		    $menu_items[ 'gravityview' ] = array(
237 237
 				'label'          => esc_attr__( 'Create a View', 'gravityview' ),
238 238
 				'icon'           => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>',
239 239
 				'title'          => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ),
@@ -249,22 +249,22 @@  discard block
 block discarded – undo
249 249
 		$sub_menu_items = array();
250 250
 		foreach ( (array)$connected_views as $view ) {
251 251
 
252
-			if( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) {
252
+			if ( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) {
253 253
 				continue;
254 254
 			}
255 255
 
256
-			$label = empty( $view->post_title ) ? sprintf( __('No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title;
256
+			$label = empty( $view->post_title ) ? sprintf( __( 'No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title;
257 257
 
258
-			$sub_menu_items[] = array(
258
+			$sub_menu_items[ ] = array(
259 259
 				'label' => esc_attr( $label ),
260
-				'url' => admin_url( 'post.php?action=edit&post='.$view->ID ),
260
+				'url' => admin_url( 'post.php?action=edit&post=' . $view->ID ),
261 261
 			);
262 262
 		}
263 263
 
264 264
 		// If there were no items added, then let's create the parent menu
265
-		if( $sub_menu_items ) {
265
+		if ( $sub_menu_items ) {
266 266
 
267
-		    $sub_menu_items[] = array(
267
+		    $sub_menu_items[ ] = array(
268 268
 			    'label' => esc_attr__( 'Create a View', 'gravityview' ),
269 269
                 'link_class' => 'gv-create-view',
270 270
 			    'icon' => '<i>&nbsp;+&nbsp;</i>',
@@ -280,14 +280,14 @@  discard block
 block discarded – undo
280 280
 			if ( ! ( 'gf_edit_forms' === rgget( 'page' ) && '' === rgget( 'view' ) ) || version_compare( '2.5-beta', GFForms::$version, '>' ) ) {
281 281
 
282 282
 				// Make sure Gravity Forms uses the submenu; if there's only one item, it uses a link instead of a dropdown
283
-				$sub_menu_items[] = array(
283
+				$sub_menu_items[ ] = array(
284 284
 					'url' => '#',
285 285
 					'label' => '',
286 286
 					'menu_class' => 'hidden',
287 287
 					'capabilities' => '',
288 288
 				);
289 289
 
290
-				$menu_items['gravityview'] = array(
290
+				$menu_items[ 'gravityview' ] = array(
291 291
 					'label'          => __( 'Connected Views', 'gravityview' ),
292 292
 					'icon'           => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>',
293 293
 					'title'          => __( 'GravityView Views using this form as a data source', 'gravityview' ),
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 
302 302
 			} else {
303 303
 
304
-				$menu_items[ 'gravityview'] = array(
304
+				$menu_items[ 'gravityview' ] = array(
305 305
 					'label' => __( 'Connected Views', 'gravityview' ),
306 306
 					'url'   => '#gravityview-group-heading',
307 307
 					'icon'  => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>',
@@ -337,8 +337,8 @@  discard block
 block discarded – undo
337 337
 		$add = array( 'captcha', 'page' );
338 338
 
339 339
 		// Don't allowing editing the following values:
340
-		if( $context === 'edit' ) {
341
-			$add[] = 'post_id';
340
+		if ( $context === 'edit' ) {
341
+			$add[ ] = 'post_id';
342 342
 		}
343 343
 
344 344
 		$return = array_merge( $array, $add );
@@ -361,27 +361,27 @@  discard block
 block discarded – undo
361 361
 		foreach ( $default_args as $key => $arg ) {
362 362
 
363 363
 			// If an arg has `tooltip` defined, but it's false, don't display a tooltip
364
-			if( isset( $arg['tooltip'] ) && empty( $arg['tooltip'] ) ) { continue; }
364
+			if ( isset( $arg[ 'tooltip' ] ) && empty( $arg[ 'tooltip' ] ) ) { continue; }
365 365
 
366 366
 			// By default, use `tooltip` if defined.
367
-			$tooltip = empty( $arg['tooltip'] ) ? NULL : $arg['tooltip'];
367
+			$tooltip = empty( $arg[ 'tooltip' ] ) ? NULL : $arg[ 'tooltip' ];
368 368
 
369 369
 			// If there's no tooltip set, continue
370
-			if( empty( $tooltip ) ) {
370
+			if ( empty( $tooltip ) ) {
371 371
 				continue;
372 372
 			}
373 373
 
374 374
 			// Add the tooltip
375
-			$gv_tooltips[ 'gv_'.$key ] = array(
376
-				'title'	=> $arg['label'],
375
+			$gv_tooltips[ 'gv_' . $key ] = array(
376
+				'title'	=> $arg[ 'label' ],
377 377
 				'value'	=> $tooltip,
378 378
 			);
379 379
 
380 380
 		}
381 381
 
382
-		$gv_tooltips['gv_css_merge_tags'] = array(
383
-			'title' => __('CSS Merge Tags', 'gravityview'),
384
-			'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview'), '<code>', '</code>' )
382
+		$gv_tooltips[ 'gv_css_merge_tags' ] = array(
383
+			'title' => __( 'CSS Merge Tags', 'gravityview' ),
384
+			'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview' ), '<code>', '</code>' )
385 385
 		);
386 386
 
387 387
 		/**
@@ -399,9 +399,9 @@  discard block
 block discarded – undo
399 399
 
400 400
 		foreach ( $gv_tooltips as $key => $tooltip ) {
401 401
 
402
-			$title = empty( $tooltip['title'] ) ? '' : '<h6>'.esc_html( $tooltip['title'] ) .'</h6>';
402
+			$title = empty( $tooltip[ 'title' ] ) ? '' : '<h6>' . esc_html( $tooltip[ 'title' ] ) . '</h6>';
403 403
 
404
-			$tooltips[ $key ] = $title . wpautop( esc_html( $tooltip['value'] ) );
404
+			$tooltips[ $key ] = $title . wpautop( esc_html( $tooltip[ 'value' ] ) );
405 405
 		}
406 406
 
407 407
 		return $tooltips;
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 	 *
416 416
 	 * @return void
417 417
 	 */
418
-	public function add_custom_column_content( $column_name = NULL, $post_id )	{
418
+	public function add_custom_column_content( $column_name = NULL, $post_id ) {
419 419
 
420 420
 		$output = '';
421 421
 
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 				// Generate backup if label doesn't exist: `example_name` => `Example Name`
438 438
 				$template_id_pretty = ucwords( implode( ' ', explode( '_', $template_id ) ) );
439 439
 
440
-				$output = $template ? $template['label'] : $template_id_pretty;
440
+				$output = $template ? $template[ 'label' ] : $template_id_pretty;
441 441
 
442 442
 				break;
443 443
 
@@ -478,44 +478,44 @@  discard block
 block discarded – undo
478 478
 	static public function get_connected_form_links( $form, $include_form_link = true ) {
479 479
 
480 480
 		// Either the form is empty or the form ID is 0, not yet set.
481
-		if( empty( $form ) ) {
481
+		if ( empty( $form ) ) {
482 482
 			return '';
483 483
 		}
484 484
 
485 485
 		// The $form is passed as the form ID
486
-		if( !is_array( $form ) ) {
486
+		if ( ! is_array( $form ) ) {
487 487
 			$form = gravityview_get_form( $form );
488 488
 		}
489 489
 
490
-		$form_id = $form['id'];
490
+		$form_id = $form[ 'id' ];
491 491
 		$links = array();
492 492
 
493
-		if( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) {
493
+		if ( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) {
494 494
 			$form_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&amp;id=%d', $form_id ) );
495
-			$form_link = '<strong class="gv-form-title">'.gravityview_get_link( $form_url, $form['title'], 'class=row-title' ).'</strong>';
496
-			$links[] = '<span>'.gravityview_get_link( $form_url, __('Edit Form', 'gravityview') ).'</span>';
495
+			$form_link = '<strong class="gv-form-title">' . gravityview_get_link( $form_url, $form[ 'title' ], 'class=row-title' ) . '</strong>';
496
+			$links[ ] = '<span>' . gravityview_get_link( $form_url, __( 'Edit Form', 'gravityview' ) ) . '</span>';
497 497
 		} else {
498
-			$form_link = '<strong class="gv-form-title">'. esc_html( $form['title'] ). '</strong>';
498
+			$form_link = '<strong class="gv-form-title">' . esc_html( $form[ 'title' ] ) . '</strong>';
499 499
 		}
500 500
 
501
-		if( GVCommon::has_cap( 'gravityforms_view_entries' ) ) {
501
+		if ( GVCommon::has_cap( 'gravityforms_view_entries' ) ) {
502 502
 			$entries_url = admin_url( sprintf( 'admin.php?page=gf_entries&amp;id=%d', $form_id ) );
503
-			$links[] = '<span>'.gravityview_get_link( $entries_url, __('Entries', 'gravityview') ).'</span>';
503
+			$links[ ] = '<span>' . gravityview_get_link( $entries_url, __( 'Entries', 'gravityview' ) ) . '</span>';
504 504
 		}
505 505
 
506
-		if( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) {
506
+		if ( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) {
507 507
 			$settings_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&amp;view=settings&amp;id=%d', $form_id ) );
508
-			$links[] = '<span>'.gravityview_get_link( $settings_url, __('Settings', 'gravityview'), 'title='.__('Edit settings for this form', 'gravityview') ).'</span>';
508
+			$links[ ] = '<span>' . gravityview_get_link( $settings_url, __( 'Settings', 'gravityview' ), 'title=' . __( 'Edit settings for this form', 'gravityview' ) ) . '</span>';
509 509
 		}
510 510
 
511
-		if( GVCommon::has_cap( array("gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms") ) ) {
511
+		if ( GVCommon::has_cap( array( "gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms" ) ) ) {
512 512
 			$preview_url = site_url( sprintf( '?gf_page=preview&amp;id=%d', $form_id ) );
513
-			$links[] = '<span>'.gravityview_get_link( $preview_url, __('Preview Form', 'gravityview'), 'title='.__('Preview this form', 'gravityview') ).'</span>';
513
+			$links[ ] = '<span>' . gravityview_get_link( $preview_url, __( 'Preview Form', 'gravityview' ), 'title=' . __( 'Preview this form', 'gravityview' ) ) . '</span>';
514 514
 		}
515 515
 
516 516
 		$output = '';
517 517
 
518
-		if( !empty( $include_form_link ) ) {
518
+		if ( ! empty( $include_form_link ) ) {
519 519
 			$output .= $form_link;
520 520
 		}
521 521
 
@@ -530,11 +530,11 @@  discard block
 block discarded – undo
530 530
 		$css_class = 'row-actions';
531 531
 
532 532
 		// Is Screen Options > View mode set to "Extended view"? If so, keep actions visible.
533
-		if( 'excerpt' === get_user_setting( 'posts_list_mode', 'list' ) ) {
533
+		if ( 'excerpt' === get_user_setting( 'posts_list_mode', 'list' ) ) {
534 534
 			$css_class = 'row-actions visible';
535 535
 		}
536 536
 
537
-		$output .= '<div class="' . $css_class . '">'. implode( ' | ', $links ) .'</div>';
537
+		$output .= '<div class="' . $css_class . '">' . implode( ' | ', $links ) . '</div>';
538 538
 
539 539
 		return $output;
540 540
 	}
@@ -548,8 +548,8 @@  discard block
 block discarded – undo
548 548
 		// Get the date column and save it for later to add back in.
549 549
 		// This adds it after the Data Source column.
550 550
 		// This way, we don't need to do array_slice, array_merge, etc.
551
-		$date = $columns['date'];
552
-		unset( $columns['date'] );
551
+		$date = $columns[ 'date' ];
552
+		unset( $columns[ 'date' ] );
553 553
 
554 554
 		$data_source_required_caps = array(
555 555
 			'gravityforms_edit_forms',
@@ -560,14 +560,14 @@  discard block
 block discarded – undo
560 560
 			'gravityforms_preview_forms',
561 561
 		);
562 562
 
563
-		if( GVCommon::has_cap( $data_source_required_caps ) ) {
564
-			$columns['gv_connected_form'] = __( 'Data Source', 'gravityview' );
563
+		if ( GVCommon::has_cap( $data_source_required_caps ) ) {
564
+			$columns[ 'gv_connected_form' ] = __( 'Data Source', 'gravityview' );
565 565
 		}
566 566
 
567
-		$columns['gv_template'] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' );
567
+		$columns[ 'gv_template' ] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' );
568 568
 
569 569
 		// Add the date back in.
570
-		$columns['date'] = $date;
570
+		$columns[ 'date' ] = $date;
571 571
 
572 572
 		return $columns;
573 573
 	}
@@ -580,12 +580,12 @@  discard block
 block discarded – undo
580 580
 	 */
581 581
 	function save_postdata( $post_id ) {
582 582
 
583
-		if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ){
583
+		if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
584 584
 			return;
585 585
 		}
586 586
 
587 587
 		// validate post_type
588
-		if ( ! isset( $_POST['post_type'] ) || 'gravityview' != $_POST['post_type'] ) {
588
+		if ( ! isset( $_POST[ 'post_type' ] ) || 'gravityview' != $_POST[ 'post_type' ] ) {
589 589
 			return;
590 590
 		}
591 591
 
@@ -600,63 +600,63 @@  discard block
 block discarded – undo
600 600
 		$statii = array();
601 601
 
602 602
 		// check if this is a start fresh View
603
-		if ( isset( $_POST['gravityview_select_form_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_form_nonce'], 'gravityview_select_form' ) ) {
603
+		if ( isset( $_POST[ 'gravityview_select_form_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_form_nonce' ], 'gravityview_select_form' ) ) {
604 604
 
605
-			$form_id = !empty( $_POST['gravityview_form_id'] ) ? $_POST['gravityview_form_id'] : '';
605
+			$form_id = ! empty( $_POST[ 'gravityview_form_id' ] ) ? $_POST[ 'gravityview_form_id' ] : '';
606 606
 			// save form id
607
-			$statii['form_id'] = update_post_meta( $post_id, '_gravityview_form_id', $form_id );
607
+			$statii[ 'form_id' ] = update_post_meta( $post_id, '_gravityview_form_id', $form_id );
608 608
 
609 609
 		}
610 610
 
611
-		if( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii['form_id'] ) ) {
611
+		if ( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii[ 'form_id' ] ) ) {
612 612
 			gravityview()->log->error( 'Current user does not have the capability to create a new Form.', array( 'data' => wp_get_current_user() ) );
613 613
 			return;
614 614
 		}
615 615
 
616 616
 		// Was this a start fresh?
617
-		if ( ! empty( $_POST['gravityview_form_id_start_fresh'] ) ) {
618
-			$statii['start_fresh'] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 );
617
+		if ( ! empty( $_POST[ 'gravityview_form_id_start_fresh' ] ) ) {
618
+			$statii[ 'start_fresh' ] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 );
619 619
 		} else {
620
-			$statii['start_fresh'] = delete_post_meta( $post_id, '_gravityview_start_fresh' );
620
+			$statii[ 'start_fresh' ] = delete_post_meta( $post_id, '_gravityview_start_fresh' );
621 621
 		}
622 622
 
623 623
 		// Check if we have a template id
624
-		if ( isset( $_POST['gravityview_select_template_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_template_nonce'], 'gravityview_select_template' ) ) {
624
+		if ( isset( $_POST[ 'gravityview_select_template_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_template_nonce' ], 'gravityview_select_template' ) ) {
625 625
 
626
-			$template_id = !empty( $_POST['gravityview_directory_template'] ) ? $_POST['gravityview_directory_template'] : '';
626
+			$template_id = ! empty( $_POST[ 'gravityview_directory_template' ] ) ? $_POST[ 'gravityview_directory_template' ] : '';
627 627
 
628 628
 			// now save template id
629
-			$statii['directory_template'] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id );
629
+			$statii[ 'directory_template' ] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id );
630 630
 		}
631 631
 
632 632
 
633 633
 		// save View Configuration metabox
634
-		if ( isset( $_POST['gravityview_view_configuration_nonce'] ) && wp_verify_nonce( $_POST['gravityview_view_configuration_nonce'], 'gravityview_view_configuration' ) ) {
634
+		if ( isset( $_POST[ 'gravityview_view_configuration_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_view_configuration_nonce' ], 'gravityview_view_configuration' ) ) {
635 635
 
636 636
 			// template settings
637
-			if( empty( $_POST['template_settings'] ) ) {
638
-				$_POST['template_settings'] = array();
637
+			if ( empty( $_POST[ 'template_settings' ] ) ) {
638
+				$_POST[ 'template_settings' ] = array();
639 639
 			}
640
-			$statii['template_settings'] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST['template_settings'] );
640
+			$statii[ 'template_settings' ] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST[ 'template_settings' ] );
641 641
 
642 642
 			// guard against unloaded View configuration page
643
-			if ( isset( $_POST['gv_fields'] ) && isset( $_POST['gv_fields_done'] ) ) {
643
+			if ( isset( $_POST[ 'gv_fields' ] ) && isset( $_POST[ 'gv_fields_done' ] ) ) {
644 644
 				$fields = array();
645 645
 
646
-				if ( ! empty( $_POST['gv_fields'] ) ) {
646
+				if ( ! empty( $_POST[ 'gv_fields' ] ) ) {
647 647
 					$fields = _gravityview_process_posted_fields();
648 648
 				}
649 649
 
650 650
 				$fields = wp_slash( $fields );
651 651
 
652
-				$statii['directory_fields'] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields );
652
+				$statii[ 'directory_fields' ] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields );
653 653
 			}
654 654
 
655 655
 			// Directory Visible Widgets
656
-			if( empty( $_POST['widgets'] ) ) {
657
-				$_POST['widgets'] = array();
656
+			if ( empty( $_POST[ 'widgets' ] ) ) {
657
+				$_POST[ 'widgets' ] = array();
658 658
 			}
659
-			$statii['directory_widgets'] = gravityview_set_directory_widgets( $post_id, $_POST['widgets'] );
659
+			$statii[ 'directory_widgets' ] = gravityview_set_directory_widgets( $post_id, $_POST[ 'widgets' ] );
660 660
 
661 661
 		} // end save view configuration
662 662
 
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
 		 * @param array $statii Array of statuses of the post meta saving processes. If saving worked, each key should be mapped to a value of the post ID (`directory_widgets` => `124`). If failed (or didn't change), the value will be false.
667 667
 		 * @since 1.17.2
668 668
 		 */
669
-		do_action('gravityview_view_saved', $post_id, $statii );
669
+		do_action( 'gravityview_view_saved', $post_id, $statii );
670 670
 
671 671
 		gravityview()->log->debug( '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array( 'data' => array_map( 'intval', $statii ) ) );
672 672
 	}
@@ -711,20 +711,20 @@  discard block
 block discarded – undo
711 711
 
712 712
 		$output = '';
713 713
 
714
-		if( !empty( $fields ) ) {
714
+		if ( ! empty( $fields ) ) {
715 715
 
716
-			foreach( $fields as $id => $details ) {
716
+			foreach ( $fields as $id => $details ) {
717 717
 
718
-				if( in_array( $details['type'], (array) $blacklist_field_types ) ) {
718
+				if ( in_array( $details[ 'type' ], (array)$blacklist_field_types ) ) {
719 719
 					continue;
720 720
 				}
721 721
 
722 722
 				// Edit mode only allows editing the parent fields, not single inputs.
723
-				if( $context === 'edit' && ! empty( $details['parent'] ) ) {
723
+				if ( $context === 'edit' && ! empty( $details[ 'parent' ] ) ) {
724 724
 					continue;
725 725
 				}
726 726
 
727
-				$output .= new GravityView_Admin_View_Field( $details['label'], $id, $details, array(), $form );
727
+				$output .= new GravityView_Admin_View_Field( $details[ 'label' ], $id, $details, array(), $form );
728 728
 
729 729
 			} // End foreach
730 730
 		}
@@ -732,7 +732,7 @@  discard block
 block discarded – undo
732 732
 		echo $output;
733 733
 
734 734
 		// For the EDIT view we only want to allow the form fields.
735
-		if( $context === 'edit' ) {
735
+		if ( $context === 'edit' ) {
736 736
 			return;
737 737
 		}
738 738
 
@@ -751,7 +751,7 @@  discard block
 block discarded – undo
751 751
 		$additional_fields = array(
752 752
 			array(
753 753
 				'label_text' => '+ ' . __( 'Add All Form Fields', 'gravityview' ),
754
-				'desc' => __('Insert all the form fields at once.', 'gravityview'),
754
+				'desc' => __( 'Insert all the form fields at once.', 'gravityview' ),
755 755
 				'field_id' => 'all-fields',
756 756
 				'label_type' => 'field',
757 757
 				'input_type' => null,
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
 		 */
768 768
 		$additional_fields = apply_filters( 'gravityview_additional_fields', $additional_fields );
769 769
 
770
-		foreach ( (array) $additional_fields as $item ) {
770
+		foreach ( (array)$additional_fields as $item ) {
771 771
 
772 772
 			// Prevent items from not having index set
773 773
 			$item = wp_parse_args( $item, array(
@@ -778,16 +778,16 @@  discard block
 block discarded – undo
778 778
 				'field_options' => null,
779 779
 				'settings_html'	=> null,
780 780
 				'icon' => null,
781
-			));
781
+			) );
782 782
 
783 783
 			// Backward compat.
784
-			if( !empty( $item['field_options'] ) ) {
784
+			if ( ! empty( $item[ 'field_options' ] ) ) {
785 785
 				// Use settings_html from now on.
786
-				$item['settings_html'] = $item['field_options'];
786
+				$item[ 'settings_html' ] = $item[ 'field_options' ];
787 787
 			}
788 788
 
789 789
 			// Render a label for each of them
790
-			echo new GravityView_Admin_View_Field( $item['label_text'], $item['field_id'], $item, $settings = array(), $form );
790
+			echo new GravityView_Admin_View_Field( $item[ 'label_text' ], $item[ 'field_id' ], $item, $settings = array(), $form );
791 791
 
792 792
 		}
793 793
 
@@ -799,59 +799,59 @@  discard block
 block discarded – undo
799 799
 	 * @param  string $zone   Either 'single', 'directory', 'header', 'footer'
800 800
 	 * @return array
801 801
 	 */
802
-	function get_entry_default_fields($form, $zone) {
802
+	function get_entry_default_fields( $form, $zone ) {
803 803
 
804 804
 		$entry_default_fields = array();
805 805
 
806
-		if( in_array( $zone, array( 'directory', 'single' ) ) ) {
806
+		if ( in_array( $zone, array( 'directory', 'single' ) ) ) {
807 807
 
808 808
 			$entry_default_fields = array(
809 809
 				'id' => array(
810
-					'label' => __('Entry ID', 'gravityview'),
810
+					'label' => __( 'Entry ID', 'gravityview' ),
811 811
 					'type' => 'id',
812
-					'desc'	=> __('The unique ID of the entry.', 'gravityview'),
812
+					'desc'	=> __( 'The unique ID of the entry.', 'gravityview' ),
813 813
 				),
814 814
 				'date_created' => array(
815
-					'label' => __('Entry Date', 'gravityview'),
816
-					'desc'	=> __('The date the entry was created.', 'gravityview'),
815
+					'label' => __( 'Entry Date', 'gravityview' ),
816
+					'desc'	=> __( 'The date the entry was created.', 'gravityview' ),
817 817
 					'type' => 'date_created',
818 818
 				),
819 819
 				'date_updated' => array(
820
-						'label' => __( 'Date Updated', 'gravityview'),
821
-						'desc'	=> __('The date the entry was last updated.', 'gravityview'),
820
+						'label' => __( 'Date Updated', 'gravityview' ),
821
+						'desc'	=> __( 'The date the entry was last updated.', 'gravityview' ),
822 822
 						'type' => 'date_updated',
823 823
 				),
824 824
 				'source_url' => array(
825
-					'label' => __('Source URL', 'gravityview'),
825
+					'label' => __( 'Source URL', 'gravityview' ),
826 826
 					'type' => 'source_url',
827
-					'desc'	=> __('The URL of the page where the form was submitted.', 'gravityview'),
827
+					'desc'	=> __( 'The URL of the page where the form was submitted.', 'gravityview' ),
828 828
 				),
829 829
 				'ip' => array(
830
-					'label' => __('User IP', 'gravityview'),
830
+					'label' => __( 'User IP', 'gravityview' ),
831 831
 					'type' => 'ip',
832
-					'desc'	=> __('The IP Address of the user who created the entry.', 'gravityview'),
832
+					'desc'	=> __( 'The IP Address of the user who created the entry.', 'gravityview' ),
833 833
 				),
834 834
 				'created_by' => array(
835
-					'label' => __('User', 'gravityview'),
835
+					'label' => __( 'User', 'gravityview' ),
836 836
 					'type' => 'created_by',
837
-					'desc'	=> __('Details of the logged-in user who created the entry (if any).', 'gravityview'),
837
+					'desc'	=> __( 'Details of the logged-in user who created the entry (if any).', 'gravityview' ),
838 838
 				),
839 839
 
840 840
 				/**
841 841
 				 * @since 1.7.2
842 842
 				 */
843 843
 			    'other_entries' => array(
844
-				    'label'	=> __('Other Entries', 'gravityview'),
844
+				    'label'	=> __( 'Other Entries', 'gravityview' ),
845 845
 				    'type'	=> 'other_entries',
846
-				    'desc'	=> __('Display other entries created by the entry creator.', 'gravityview'),
846
+				    'desc'	=> __( 'Display other entries created by the entry creator.', 'gravityview' ),
847 847
 			    ),
848 848
 	        );
849 849
 
850
-			if( 'single' !== $zone) {
850
+			if ( 'single' !== $zone ) {
851 851
 
852
-				$entry_default_fields['entry_link'] = array(
853
-					'label' => __('Link to Entry', 'gravityview'),
854
-					'desc'	=> __('A dedicated link to the single entry with customizable text.', 'gravityview'),
852
+				$entry_default_fields[ 'entry_link' ] = array(
853
+					'label' => __( 'Link to Entry', 'gravityview' ),
854
+					'desc'	=> __( 'A dedicated link to the single entry with customizable text.', 'gravityview' ),
855 855
 					'type' => 'entry_link',
856 856
 				);
857 857
 			}
@@ -861,19 +861,19 @@  discard block
 block discarded – undo
861 861
 		/**
862 862
 		 * @since  1.2
863 863
 		 */
864
-		$entry_default_fields['custom']	= array(
865
-			'label'	=> __('Custom Content', 'gravityview'),
864
+		$entry_default_fields[ 'custom' ] = array(
865
+			'label'	=> __( 'Custom Content', 'gravityview' ),
866 866
 			'type'	=> 'custom',
867
-			'desc'	=> __('Insert custom text or HTML.', 'gravityview'),
867
+			'desc'	=> __( 'Insert custom text or HTML.', 'gravityview' ),
868 868
 		);
869 869
 
870 870
 		/**
871 871
 		 * @since develop
872 872
 		 */
873
-		$entry_default_fields['sequence'] = array(
874
-			'label'	=> __('Result Number', 'gravityview'),
873
+		$entry_default_fields[ 'sequence' ] = array(
874
+			'label'	=> __( 'Result Number', 'gravityview' ),
875 875
 			'type'	=> 'sequence',
876
-			'desc'	=> __('Display a sequential result number for each entry.', 'gravityview'),
876
+			'desc'	=> __( 'Display a sequential result number for each entry.', 'gravityview' ),
877 877
 		);
878 878
 
879 879
 		/**
@@ -882,7 +882,7 @@  discard block
 block discarded – undo
882 882
 		 * @param  string|array $form form_ID or form object
883 883
 		 * @param  string $zone   Either 'single', 'directory', 'header', 'footer'
884 884
 		 */
885
-		return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone);
885
+		return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone );
886 886
 	}
887 887
 
888 888
 	/**
@@ -893,7 +893,7 @@  discard block
 block discarded – undo
893 893
 	 */
894 894
 	function get_available_fields( $form = '', $zone = NULL ) {
895 895
 
896
-		if( empty( $form ) ) {
896
+		if ( empty( $form ) ) {
897 897
 			gravityview()->log->error( '$form is empty' );
898 898
 			return array();
899 899
 		}
@@ -902,7 +902,7 @@  discard block
 block discarded – undo
902 902
 		$fields = gravityview_get_form_fields( $form, true );
903 903
 
904 904
 		// get meta fields ( only if form was already created )
905
-		if( !is_array( $form ) ) {
905
+		if ( ! is_array( $form ) ) {
906 906
 			$meta_fields = gravityview_get_entry_meta( $form );
907 907
 		} else {
908 908
 			$meta_fields = array();
@@ -915,14 +915,14 @@  discard block
 block discarded – undo
915 915
 		$fields = $fields + $meta_fields + $default_fields;
916 916
 
917 917
 		// Move Custom Content to top
918
-		$fields = array( 'custom' => $fields['custom'] ) + $fields;
918
+		$fields = array( 'custom' => $fields[ 'custom' ] ) + $fields;
919 919
 
920 920
 		$gv_fields = GravityView_Fields::get_all();
921 921
 
922 922
 		foreach ( $fields as &$field ) {
923 923
 			foreach ( $gv_fields as $gv_field ) {
924
-				if ( $field['type'] === $gv_field->name ) {
925
-					$field['icon'] = $gv_field->icon;
924
+				if ( $field[ 'type' ] === $gv_field->name ) {
925
+					$field[ 'icon' ] = $gv_field->icon;
926 926
 				}
927 927
 			}
928 928
 		}
@@ -945,11 +945,11 @@  discard block
 block discarded – undo
945 945
 
946 946
 		$widgets = $this->get_registered_widgets();
947 947
 
948
-		if( !empty( $widgets ) ) {
948
+		if ( ! empty( $widgets ) ) {
949 949
 
950
-			foreach( $widgets as $id => $details ) {
950
+			foreach ( $widgets as $id => $details ) {
951 951
 
952
-				echo new GravityView_Admin_View_Widget( $details['label'], $id, $details );
952
+				echo new GravityView_Admin_View_Widget( $details[ 'label' ], $id, $details );
953 953
 
954 954
 			}
955 955
 		}
@@ -978,7 +978,7 @@  discard block
 block discarded – undo
978 978
 	function render_active_areas( $template_id, $type, $zone, $rows, $values ) {
979 979
 		global $post;
980 980
 
981
-		if( $type === 'widget' ) {
981
+		if ( $type === 'widget' ) {
982 982
 			$button_label = __( 'Add Widget', 'gravityview' );
983 983
 		} else {
984 984
 			$button_label = __( 'Add Field', 'gravityview' );
@@ -1004,10 +1004,10 @@  discard block
 block discarded – undo
1004 1004
 		$form_id = null;
1005 1005
 
1006 1006
 		// if saved values, get available fields to label everyone
1007
-		if( !empty( $values ) && ( !empty( $post->ID ) || !empty( $_POST['template_id'] ) ) ) {
1007
+		if ( ! empty( $values ) && ( ! empty( $post->ID ) || ! empty( $_POST[ 'template_id' ] ) ) ) {
1008 1008
 
1009
-			if( !empty( $_POST['template_id'] ) ) {
1010
-				$form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] );
1009
+			if ( ! empty( $_POST[ 'template_id' ] ) ) {
1010
+				$form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] );
1011 1011
 			} else {
1012 1012
 				$form_id = $form = gravityview_get_form_id( $post->ID );
1013 1013
 			}
@@ -1025,42 +1025,42 @@  discard block
 block discarded – undo
1025 1025
 			}
1026 1026
 		}
1027 1027
 
1028
-		foreach( $rows as $row ) :
1029
-			foreach( $row as $col => $areas ) :
1030
-				$column = ($col == '2-2') ? '1-2' : $col; ?>
1028
+		foreach ( $rows as $row ) :
1029
+			foreach ( $row as $col => $areas ) :
1030
+				$column = ( $col == '2-2' ) ? '1-2' : $col; ?>
1031 1031
 
1032 1032
 				<div class="gv-grid-col-<?php echo esc_attr( $column ); ?>">
1033 1033
 
1034
-					<?php foreach( $areas as $area ) : 	?>
1034
+					<?php foreach ( $areas as $area ) : 	?>
1035 1035
 
1036
-						<div class="gv-droppable-area" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>">
1037
-							<div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>">
1036
+						<div class="gv-droppable-area" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>">
1037
+							<div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>">
1038 1038
 								<?php // render saved fields
1039
-								if( ! empty( $values[ $zone .'_'. $area['areaid'] ] ) ) {
1039
+								if ( ! empty( $values[ $zone . '_' . $area[ 'areaid' ] ] ) ) {
1040 1040
 
1041
-									foreach( $values[ $zone .'_'. $area['areaid'] ] as $uniqid => $field ) {
1041
+									foreach ( $values[ $zone . '_' . $area[ 'areaid' ] ] as $uniqid => $field ) {
1042 1042
 
1043 1043
 										// Maybe has a form ID
1044
-										$form_id = empty( $field['form_id'] ) ? $form_id : $field['form_id'];
1044
+										$form_id = empty( $field[ 'form_id' ] ) ? $form_id : $field[ 'form_id' ];
1045 1045
 
1046 1046
 										$input_type = NULL;
1047 1047
 
1048 1048
 										if ( $form_id ) {
1049
-											$original_item = isset( $available_items[ $form_id ] [ $field['id'] ] ) ? $available_items[ $form_id ] [ $field['id'] ] : false ;
1049
+											$original_item = isset( $available_items[ $form_id ] [ $field[ 'id' ] ] ) ? $available_items[ $form_id ] [ $field[ 'id' ] ] : false;
1050 1050
                                         } else {
1051
-											$original_item = isset( $available_items[ $field['id'] ] ) ? $available_items[ $field['id'] ] : false ;
1051
+											$original_item = isset( $available_items[ $field[ 'id' ] ] ) ? $available_items[ $field[ 'id' ] ] : false;
1052 1052
                                         }
1053 1053
 
1054
-										if ( !$original_item ) {
1055
-											gravityview()->log->error( 'An item was not available when rendering the output; maybe it was added by a plugin that is now de-activated.', array(' data' => array('available_items' => $available_items, 'field' => $field ) ) );
1054
+										if ( ! $original_item ) {
1055
+											gravityview()->log->error( 'An item was not available when rendering the output; maybe it was added by a plugin that is now de-activated.', array( ' data' => array( 'available_items' => $available_items, 'field' => $field ) ) );
1056 1056
 
1057 1057
 											$original_item = $field;
1058 1058
 										} else {
1059
-											$input_type = isset( $original_item['type'] ) ? $original_item['type'] : NULL;
1059
+											$input_type = isset( $original_item[ 'type' ] ) ? $original_item[ 'type' ] : NULL;
1060 1060
 										}
1061 1061
 
1062 1062
 										// Field options dialog box
1063
-										$field_options = GravityView_Render_Settings::render_field_options( $form_id, $type, $template_id, $field['id'], $original_item['label'], $zone .'_'. $area['areaid'], $input_type, $uniqid, $field, $zone, $original_item );
1063
+										$field_options = GravityView_Render_Settings::render_field_options( $form_id, $type, $template_id, $field[ 'id' ], $original_item[ 'label' ], $zone . '_' . $area[ 'areaid' ], $input_type, $uniqid, $field, $zone, $original_item );
1064 1064
 
1065 1065
 										$item = array(
1066 1066
 											'input_type' => $input_type,
@@ -1073,22 +1073,22 @@  discard block
 block discarded – undo
1073 1073
 											$item = wp_parse_args( $item, $original_item );
1074 1074
 										}
1075 1075
 
1076
-										switch( $type ) {
1076
+										switch ( $type ) {
1077 1077
 											case 'widget':
1078
-												echo new GravityView_Admin_View_Widget( $item['label'], $field['id'], $item, $field );
1078
+												echo new GravityView_Admin_View_Widget( $item[ 'label' ], $field[ 'id' ], $item, $field );
1079 1079
 												break;
1080 1080
 											default:
1081
-												echo new GravityView_Admin_View_Field( $field['label'], $field['id'], $item, $field, $form_id );
1081
+												echo new GravityView_Admin_View_Field( $field[ 'label' ], $field[ 'id' ], $item, $field, $form_id );
1082 1082
 										}
1083 1083
 									}
1084 1084
 
1085 1085
 								} // End if zone is not empty ?>
1086 1086
 
1087
-								<span class="drop-message"><?php echo sprintf( esc_html__('"+ %s" or drag existing %ss here.', 'gravityview'), esc_html( $button_label ), esc_html( $type ) ); ?></span>
1087
+								<span class="drop-message"><?php echo sprintf( esc_html__( '"+ %s" or drag existing %ss here.', 'gravityview' ), esc_html( $button_label ), esc_html( $type ) ); ?></span>
1088 1088
 							</div>
1089 1089
 							<div class="gv-droppable-area-action">
1090
-								<button class="gv-add-field button-secondary" title="" data-objecttype="<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>" data-formid="<?php echo $view ? esc_attr( $view->form ? $view->form->ID : '' ) : ''; ?>"><?php echo '+ '.esc_html( $button_label ); ?></button>
1091
-								<p class="gv-droppable-area-title"><strong><?php echo esc_html( $area['title'] ); ?></strong><?php if( !empty( $area['subtitle'] ) ) { ?><span class="gv-droppable-area-subtitle"> &ndash; <?php echo esc_html( $area['subtitle'] ); ?></span><?php } ?></p>
1090
+								<button class="gv-add-field button-secondary" title="" data-objecttype="<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>" data-formid="<?php echo $view ? esc_attr( $view->form ? $view->form->ID : '' ) : ''; ?>"><?php echo '+ ' . esc_html( $button_label ); ?></button>
1091
+								<p class="gv-droppable-area-title"><strong><?php echo esc_html( $area[ 'title' ] ); ?></strong><?php if ( ! empty( $area[ 'subtitle' ] ) ) { ?><span class="gv-droppable-area-subtitle"> &ndash; <?php echo esc_html( $area[ 'subtitle' ] ); ?></span><?php } ?></p>
1092 1092
 							</div>
1093 1093
 						</div>
1094 1094
 
@@ -1116,7 +1116,7 @@  discard block
 block discarded – undo
1116 1116
 				// This is a new View, prefill the widgets
1117 1117
 				$widgets = array(
1118 1118
 					'header_top' => array(
1119
-						substr( md5( microtime( true ) ), 0, 13 ) => array (
1119
+						substr( md5( microtime( true ) ), 0, 13 ) => array(
1120 1120
 							'id' => 'search_bar',
1121 1121
 							'label' => __( 'Search Bar', 'gravityview' ),
1122 1122
 							'search_layout' => 'horizontal',
@@ -1191,12 +1191,12 @@  discard block
 block discarded – undo
1191 1191
 		if ( $post ) {
1192 1192
 			$source_form_id = gravityview_get_form_id( $post->ID );
1193 1193
 			if ( $source_form_id ) {
1194
-				$form_ids[] = $source_form_id;
1194
+				$form_ids[ ] = $source_form_id;
1195 1195
 			}
1196 1196
 
1197 1197
 			$joined_forms = \GV\View::get_joined_forms( $post->ID );
1198 1198
 			foreach ( $joined_forms as $joined_form ) {
1199
-				$form_ids[] = $joined_form->ID;
1199
+				$form_ids[ ] = $joined_form->ID;
1200 1200
 			}
1201 1201
 		}
1202 1202
 		foreach ( array_unique( $form_ids ) as $form_id ) {
@@ -1230,7 +1230,7 @@  discard block
 block discarded – undo
1230 1230
 	 * @return string HTML of the active areas
1231 1231
 	 */
1232 1232
 	function render_directory_active_areas( $template_id = '', $context = 'single', $post_id = '', $echo = false ) {
1233
-		if( empty( $template_id ) ) {
1233
+		if ( empty( $template_id ) ) {
1234 1234
 			gravityview()->log->debug( '[render_directory_active_areas] {template_id} is empty', array( 'template_id' => $template_id ) );
1235 1235
 			return '';
1236 1236
 		}
@@ -1244,12 +1244,12 @@  discard block
 block discarded – undo
1244 1244
 		 */
1245 1245
 		$template_areas = apply_filters( 'gravityview_template_active_areas', array(), $template_id, $context );
1246 1246
 
1247
-		if( empty( $template_areas ) ) {
1247
+		if ( empty( $template_areas ) ) {
1248 1248
 
1249 1249
 			gravityview()->log->debug( '[render_directory_active_areas] No areas defined. Maybe template {template_id} is disabled.', array( 'data' => $template_id ) );
1250 1250
 			$output = '<div>';
1251
-			$output .= '<h2 class="description" style="font-size: 16px; margin:0">'. sprintf( esc_html__( 'This View is configured using the %s View type, which is disabled.', 'gravityview' ), '<em>'.$template_id.'</em>' ) .'</h2>';
1252
-			$output .= '<p class="description" style="font-size: 14px; margin:0 0 1em 0;padding:0">'.esc_html__('The data is not lost; re-activate the associated plugin and the configuration will re-appear.', 'gravityview').'</p>';
1251
+			$output .= '<h2 class="description" style="font-size: 16px; margin:0">' . sprintf( esc_html__( 'This View is configured using the %s View type, which is disabled.', 'gravityview' ), '<em>' . $template_id . '</em>' ) . '</h2>';
1252
+			$output .= '<p class="description" style="font-size: 14px; margin:0 0 1em 0;padding:0">' . esc_html__( 'The data is not lost; re-activate the associated plugin and the configuration will re-appear.', 'gravityview' ) . '</p>';
1253 1253
 			$output .= '</div>';
1254 1254
 		} else {
1255 1255
 
@@ -1264,7 +1264,7 @@  discard block
 block discarded – undo
1264 1264
 
1265 1265
 		}
1266 1266
 
1267
-		if( $echo ) {
1267
+		if ( $echo ) {
1268 1268
 			echo $output;
1269 1269
 		}
1270 1270
 
@@ -1292,30 +1292,30 @@  discard block
 block discarded – undo
1292 1292
 		}
1293 1293
 
1294 1294
 		// Add the GV font (with the Astronaut)
1295
-        wp_enqueue_style( 'gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), \GV\Plugin::$version );
1295
+        wp_enqueue_style( 'gravityview_global', plugins_url( 'assets/css/admin-global.css', GRAVITYVIEW_FILE ), array(), \GV\Plugin::$version );
1296 1296
 		wp_register_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons', 'wp-jquery-ui-dialog' ), \GV\Plugin::$version );
1297 1297
 
1298
-		wp_register_script( 'gravityview-jquery-cookie', plugins_url('assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE), array( 'jquery' ), \GV\Plugin::$version, true );
1298
+		wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), \GV\Plugin::$version, true );
1299 1299
 
1300
-		if( GFForms::get_page() === 'form_list' ) {
1300
+		if ( GFForms::get_page() === 'form_list' ) {
1301 1301
 			wp_enqueue_style( 'gravityview_views_styles' );
1302 1302
 			return;
1303 1303
         }
1304 1304
 
1305 1305
 		// Don't process any scripts below here if it's not a GravityView page.
1306
-		if( ! gravityview()->request->is_admin( $hook, 'single' ) && ! $is_widgets_page ) {
1306
+		if ( ! gravityview()->request->is_admin( $hook, 'single' ) && ! $is_widgets_page ) {
1307 1307
 		    return;
1308 1308
 		}
1309 1309
 
1310 1310
         wp_enqueue_script( 'jquery-ui-datepicker' );
1311
-        wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), \GV\Plugin::$version );
1311
+        wp_enqueue_style( 'gravityview_views_datepicker', plugins_url( 'assets/css/admin-datepicker.css', GRAVITYVIEW_FILE ), \GV\Plugin::$version );
1312 1312
 
1313 1313
         // Enqueue scripts
1314 1314
         wp_enqueue_script( 'gravityview_views_scripts', plugins_url( 'assets/js/admin-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'jquery-ui-dialog', 'gravityview-jquery-cookie', 'jquery-ui-datepicker', 'underscore' ), \GV\Plugin::$version );
1315 1315
 
1316
-        wp_localize_script('gravityview_views_scripts', 'gvGlobals', array(
1316
+        wp_localize_script( 'gravityview_views_scripts', 'gvGlobals', array(
1317 1317
             'cookiepath' => COOKIEPATH,
1318
-            'passed_form_id' => (bool) \GV\Utils::_GET( 'form_id' ),
1318
+            'passed_form_id' => (bool)\GV\Utils::_GET( 'form_id' ),
1319 1319
             'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ),
1320 1320
             'label_viewname' => __( 'Enter View name here', 'gravityview' ),
1321 1321
             'label_reorder_search_fields' => __( 'Reorder Search Fields', 'gravityview' ),
@@ -1330,7 +1330,7 @@  discard block
 block discarded – undo
1330 1330
             'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ),
1331 1331
             'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ),
1332 1332
             'remove_all_fields' => __( 'Would you like to remove all fields in this zone? (You are seeing this message because you were holding down the ALT key)', 'gravityview' ),
1333
-        ));
1333
+        ) );
1334 1334
 
1335 1335
 		wp_enqueue_style( 'gravityview_views_styles' );
1336 1336
 
@@ -1338,7 +1338,7 @@  discard block
 block discarded – undo
1338 1338
         self::enqueue_gravity_forms_scripts();
1339 1339
 
1340 1340
 		// 2.5 changed how Merge Tags are enqueued
1341
-		if ( is_callable( array( 'GFCommon', 'output_hooks_javascript') ) ) {
1341
+		if ( is_callable( array( 'GFCommon', 'output_hooks_javascript' ) ) ) {
1342 1342
 			GFCommon::output_hooks_javascript();
1343 1343
 		}
1344 1344
 	}
@@ -1362,7 +1362,7 @@  discard block
 block discarded – undo
1362 1362
 		);
1363 1363
 
1364 1364
 		if ( wp_is_mobile() ) {
1365
-		    $scripts[] = 'jquery-touch-punch';
1365
+		    $scripts[ ] = 'jquery-touch-punch';
1366 1366
 		}
1367 1367
 
1368 1368
 		wp_enqueue_script( $scripts );
Please login to merge, or discard this patch.
includes/extensions/delete-entry/class-delete-entry.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	 */
113 113
 	public function add_reserved_arg( $args ) {
114 114
 
115
-		$args[] = 'delete';
115
+		$args[ ] = 'delete';
116 116
 
117 117
 		return $args;
118 118
 	}
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 
183 183
 		// Index 100 is the default GravityView template path.
184 184
 		// Index 110 is Edit Entry link
185
-		$file_paths[115] = self::$file;
185
+		$file_paths[ 115 ] = self::$file;
186 186
 
187 187
 		return $file_paths;
188 188
 	}
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 
287 287
 		$attributes = array(
288 288
 			'class' => 'btn btn-sm button button-small alignright pull-right btn-danger gv-button-delete',
289
-			'tabindex' => ( GFCommon::$tab_index ++ ),
289
+			'tabindex' => ( GFCommon::$tab_index++ ),
290 290
 			'onclick' => self::get_confirm_dialog(),
291 291
 		);
292 292
 
@@ -322,12 +322,12 @@  discard block
 block discarded – undo
322 322
 		);
323 323
 
324 324
 		// If the form is not submitted, return early
325
-		if ( 'delete' !== $get_fields['action'] || empty( $get_fields['entry_id'] ) ) {
325
+		if ( 'delete' !== $get_fields[ 'action' ] || empty( $get_fields[ 'entry_id' ] ) ) {
326 326
 			return;
327 327
 		}
328 328
 
329 329
 		// Make sure it's a GravityView request
330
-		$valid_nonce_key = wp_verify_nonce( $get_fields['delete'], self::get_nonce_key( $get_fields['entry_id'] ) );
330
+		$valid_nonce_key = wp_verify_nonce( $get_fields[ 'delete' ], self::get_nonce_key( $get_fields[ 'entry_id' ] ) );
331 331
 
332 332
 		if ( ! $valid_nonce_key ) {
333 333
 			gravityview()->log->debug( 'Delete entry not processed: nonce validation failed.' );
@@ -336,10 +336,10 @@  discard block
 block discarded – undo
336 336
 		}
337 337
 
338 338
 		// Get the entry slug
339
-		$entry_slug = esc_attr( $get_fields['entry_id'] );
339
+		$entry_slug = esc_attr( $get_fields[ 'entry_id' ] );
340 340
 
341 341
 		// Redirect after deleting the entry.
342
-		$view = \GV\View::by_id( $get_fields['view_id'] );
342
+		$view = \GV\View::by_id( $get_fields[ 'view_id' ] );
343 343
 
344 344
 		// See if there's an entry there
345 345
 		$entry = gravityview_get_entry( $entry_slug, true, false, $view );
@@ -366,9 +366,9 @@  discard block
 block discarded – undo
366 366
 			$this->_redirect_and_exit( $delete_redirect_base, $delete_response->get_error_message(), 'error' );
367 367
 		}
368 368
 
369
-		if ( (int) $view->settings->get( 'delete_redirect' ) === self::REDIRECT_TO_URL_VALUE ) {
369
+		if ( (int)$view->settings->get( 'delete_redirect' ) === self::REDIRECT_TO_URL_VALUE ) {
370 370
 
371
-			$form                 = GFAPI::get_form( $entry['form_id'] );
371
+			$form                 = GFAPI::get_form( $entry[ 'form_id' ] );
372 372
 			$redirect_url_setting = $view->settings->get( 'delete_redirect_url' );
373 373
 			$redirect_url         = GFCommon::replace_variables( $redirect_url_setting, $form, $entry, false, false, false, 'text' );
374 374
 
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
 	 */
445 445
 	private function delete_or_trash_entry( $entry ) {
446 446
 
447
-		$entry_id = $entry['id'];
447
+		$entry_id = $entry[ 'id' ];
448 448
 
449 449
 		$mode = $this->get_delete_mode();
450 450
 
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 	public function process_connected_posts( $entry_id = 0, $entry = array() ) {
509 509
 
510 510
 		// The entry had no connected post
511
-		if ( empty( $entry['post_id'] ) ) {
511
+		if ( empty( $entry[ 'post_id' ] ) ) {
512 512
 			return;
513 513
 		}
514 514
 
@@ -526,9 +526,9 @@  discard block
 block discarded – undo
526 526
 		$action = current_action();
527 527
 
528 528
 		if ( 'gravityview/delete-entry/deleted' === $action ) {
529
-			$result = wp_delete_post( $entry['post_id'], true );
529
+			$result = wp_delete_post( $entry[ 'post_id' ], true );
530 530
 		} else {
531
-			$result = wp_trash_post( $entry['post_id'] );
531
+			$result = wp_trash_post( $entry[ 'post_id' ] );
532 532
 		}
533 533
 
534 534
 		if ( false === $result ) {
@@ -559,13 +559,13 @@  discard block
 block discarded – undo
559 559
 	public function verify_nonce() {
560 560
 
561 561
 		// No delete entry request was made
562
-		if ( empty( $_GET['entry_id'] ) || empty( $_GET['delete'] ) ) {
562
+		if ( empty( $_GET[ 'entry_id' ] ) || empty( $_GET[ 'delete' ] ) ) {
563 563
 			return false;
564 564
 		}
565 565
 
566
-		$nonce_key = self::get_nonce_key( $_GET['entry_id'] );
566
+		$nonce_key = self::get_nonce_key( $_GET[ 'entry_id' ] );
567 567
 
568
-		$valid = wp_verify_nonce( $_GET['delete'], $nonce_key );
568
+		$valid = wp_verify_nonce( $_GET[ 'delete' ], $nonce_key );
569 569
 
570 570
 		/**
571 571
 		 * @filter `gravityview/delete-entry/verify_nonce` Override Delete Entry nonce validation. Return true to declare nonce valid.
@@ -621,7 +621,7 @@  discard block
 block discarded – undo
621 621
 			$error = __( 'You do not have permission to delete this entry.', 'gravityview' );
622 622
 		}
623 623
 
624
-		if ( $entry['status'] === 'trash' ) {
624
+		if ( $entry[ 'status' ] === 'trash' ) {
625 625
 			if ( 'trash' === $this->get_delete_mode() ) {
626 626
 				$error = __( 'The entry is already in the trash.', 'gravityview' );
627 627
 			} else {
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
 
666 666
 		$current_user = wp_get_current_user();
667 667
 
668
-		$entry_id = isset( $entry['id'] ) ? $entry['id'] : null;
668
+		$entry_id = isset( $entry[ 'id' ] ) ? $entry[ 'id' ] : null;
669 669
 
670 670
 		// Or if they can delete any entries (as defined in Gravity Forms), we're good.
671 671
 		if ( GVCommon::has_cap( array( 'gravityforms_delete_entries', 'gravityview_delete_others_entries' ), $entry_id ) ) {
@@ -679,17 +679,17 @@  discard block
 block discarded – undo
679 679
 		if ( ! empty( $field ) ) {
680 680
 
681 681
 			// If capability is not defined, something is not right!
682
-			if ( empty( $field['allow_edit_cap'] ) ) {
682
+			if ( empty( $field[ 'allow_edit_cap' ] ) ) {
683 683
 
684 684
 				gravityview()->log->error( 'Cannot read delete entry field caps', array( 'data' => $field ) );
685 685
 
686 686
 				return false;
687 687
 			}
688 688
 
689
-			if ( GVCommon::has_cap( $field['allow_edit_cap'] ) ) {
689
+			if ( GVCommon::has_cap( $field[ 'allow_edit_cap' ] ) ) {
690 690
 
691 691
 				// Do not return true if cap is read, as we need to check if the current user created the entry
692
-				if ( $field['allow_edit_cap'] !== 'read' ) {
692
+				if ( $field[ 'allow_edit_cap' ] !== 'read' ) {
693 693
 					return true;
694 694
 				}
695 695
 			} else {
@@ -700,7 +700,7 @@  discard block
 block discarded – undo
700 700
 			}
701 701
 		}
702 702
 
703
-		if ( ! isset( $entry['created_by'] ) ) {
703
+		if ( ! isset( $entry[ 'created_by' ] ) ) {
704 704
 
705 705
 			gravityview()->log->error( 'Entry `created_by` doesn\'t exist.' );
706 706
 
@@ -716,7 +716,7 @@  discard block
 block discarded – undo
716 716
 		}
717 717
 
718 718
 		// If the logged-in user is the same as the user who created the entry, we're good.
719
-		if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) {
719
+		if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry[ 'created_by' ] ) ) {
720 720
 
721 721
 			gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id' => $current_user->ID ) );
722 722
 
@@ -741,12 +741,12 @@  discard block
 block discarded – undo
741 741
 	 */
742 742
 	public function maybe_display_message( $current_view_id = 0 ) {
743 743
 
744
-		if ( empty( $_GET['status'] ) || ! self::verify_nonce() ) {
744
+		if ( empty( $_GET[ 'status' ] ) || ! self::verify_nonce() ) {
745 745
 			return;
746 746
 		}
747 747
 
748 748
 		// Entry wasn't deleted from current View
749
-		if ( isset( $_GET['view_id'] ) && intval( $_GET['view_id'] ) !== intval( $current_view_id ) ) {
749
+		if ( isset( $_GET[ 'view_id' ] ) && intval( $_GET[ 'view_id' ] ) !== intval( $current_view_id ) ) {
750 750
 			return;
751 751
 		}
752 752
 
@@ -755,11 +755,11 @@  discard block
 block discarded – undo
755 755
 
756 756
 	public function display_message() {
757 757
 
758
-		if ( empty( $_GET['status'] ) || empty( $_GET['delete'] ) ) {
758
+		if ( empty( $_GET[ 'status' ] ) || empty( $_GET[ 'delete' ] ) ) {
759 759
 			return;
760 760
 		}
761 761
 
762
-		$status = esc_attr( $_GET['status'] );
762
+		$status = esc_attr( $_GET[ 'status' ] );
763 763
 		$message_from_url = \GV\Utils::_GET( 'message' );
764 764
 		$message_from_url = rawurldecode( stripslashes_deep( $message_from_url ) );
765 765
 		$class = '';
Please login to merge, or discard this patch.
includes/extensions/edit-entry/class-edit-entry.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
         self::$file = plugin_dir_path( __FILE__ );
38 38
 
39
-        if( is_admin() ) {
39
+        if ( is_admin() ) {
40 40
             $this->load_components( 'admin' );
41 41
         }
42 42
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 
57 57
     static function getInstance() {
58 58
 
59
-        if( empty( self::$instance ) ) {
59
+        if ( empty( self::$instance ) ) {
60 60
             self::$instance = new GravityView_Edit_Entry;
61 61
         }
62 62
 
@@ -82,10 +82,10 @@  discard block
 block discarded – undo
82 82
     private function add_hooks() {
83 83
 
84 84
         // Add front-end access to Gravity Forms delete file action
85
-        add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'GFForms', 'delete_file') );
85
+        add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'GFForms', 'delete_file' ) );
86 86
 
87 87
         // Make sure this hook is run for non-admins
88
-        add_action( 'wp_ajax_rg_delete_file', array( 'GFForms', 'delete_file') );
88
+        add_action( 'wp_ajax_rg_delete_file', array( 'GFForms', 'delete_file' ) );
89 89
 
90 90
         add_filter( 'gravityview_blacklist_field_types', array( $this, 'modify_field_blacklist' ), 10, 2 );
91 91
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	public function add_reserved_arg( $args ) {
110 110
 
111
-		$args[] = 'edit';
111
+		$args[ ] = 'edit';
112 112
 
113 113
 		return $args;
114 114
 	}
@@ -119,8 +119,8 @@  discard block
 block discarded – undo
119 119
 	 */
120 120
 	private function addon_specific_hooks() {
121 121
 
122
-		if( class_exists( 'GFSignature' ) && is_callable( array( 'GFSignature', 'get_instance' ) ) ) {
123
-			add_filter('gform_admin_pre_render', array( GFSignature::get_instance(), 'edit_lead_script'));
122
+		if ( class_exists( 'GFSignature' ) && is_callable( array( 'GFSignature', 'get_instance' ) ) ) {
123
+			add_filter( 'gform_admin_pre_render', array( GFSignature::get_instance(), 'edit_lead_script' ) );
124 124
 		}
125 125
 
126 126
 	}
@@ -207,15 +207,15 @@  discard block
 block discarded – undo
207 207
      */
208 208
     public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) {
209 209
 
210
-        $nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id']  );
210
+        $nonce_key = self::get_nonce_key( $view_id, $entry[ 'form_id' ], $entry[ 'id' ] );
211 211
 
212
-        $base = gv_entry_link( $entry, $post_id ? : $view_id  );
212
+        $base = gv_entry_link( $entry, $post_id ?: $view_id );
213 213
 
214 214
         $url = add_query_arg( array(
215 215
             'edit' => wp_create_nonce( $nonce_key )
216 216
         ), $base );
217 217
 
218
-        if( $post_id ) {
218
+        if ( $post_id ) {
219 219
 	        $url = add_query_arg( array( 'gvid' => $view_id ), $url );
220 220
         }
221 221
 
@@ -223,9 +223,9 @@  discard block
 block discarded – undo
223 223
 	     * Allow passing params to dynamically populate entry with values
224 224
 	     * @since 1.9.2
225 225
 	     */
226
-	    if( !empty( $field_values ) ) {
226
+	    if ( ! empty( $field_values ) ) {
227 227
 
228
-		    if( is_array( $field_values ) ) {
228
+		    if ( is_array( $field_values ) ) {
229 229
 			    // If already an array, no parse_str() needed
230 230
 			    $params = $field_values;
231 231
 		    } else {
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 		 * @param array $entry The entry.
242 242
 		 * @param \GV\View $view The View.
243 243
 		 */
244
-		return apply_filters( 'gravityview/edit/link', $url, $entry, \GV\View::by_id( $view_id  ) );
244
+		return apply_filters( 'gravityview/edit/link', $url, $entry, \GV\View::by_id( $view_id ) );
245 245
     }
246 246
 
247 247
 	/**
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 	 */
253 253
 	public function modify_field_blacklist( $fields = array(), $context = NULL ) {
254 254
 
255
-		if( empty( $context ) || $context !== 'edit' ) {
255
+		if ( empty( $context ) || $context !== 'edit' ) {
256 256
 			return $fields;
257 257
 		}
258 258
 
@@ -330,15 +330,15 @@  discard block
 block discarded – undo
330 330
         // If they can edit any entries (as defined in Gravity Forms)
331 331
         // Or if they can edit other people's entries
332 332
         // Then we're good.
333
-        if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) {
333
+        if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry[ 'id' ] ) ) {
334 334
 
335 335
             gravityview()->log->debug( 'User has ability to edit all entries.' );
336 336
 
337 337
             $user_can_edit = true;
338 338
 
339
-        } else if( !isset( $entry['created_by'] ) ) {
339
+        } else if ( ! isset( $entry[ 'created_by' ] ) ) {
340 340
 
341
-            gravityview()->log->error( 'Entry `created_by` doesn\'t exist.');
341
+            gravityview()->log->error( 'Entry `created_by` doesn\'t exist.' );
342 342
 
343 343
             $user_can_edit = false;
344 344
 
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
             $current_user = wp_get_current_user();
348 348
 
349 349
             // User edit is disabled
350
-            if( empty( $user_edit ) ) {
350
+            if ( empty( $user_edit ) ) {
351 351
 
352 352
                 gravityview()->log->debug( 'User Edit is disabled. Returning false.' );
353 353
 
@@ -355,13 +355,13 @@  discard block
 block discarded – undo
355 355
             }
356 356
 
357 357
             // User edit is enabled and the logged-in user is the same as the user who created the entry. We're good.
358
-            else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) {
358
+            else if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry[ 'created_by' ] ) ) {
359 359
 
360 360
                 gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id', $current_user->ID ) );
361 361
 
362 362
                 $user_can_edit = true;
363 363
 
364
-            } else if( ! is_user_logged_in() ) {
364
+            } else if ( ! is_user_logged_in() ) {
365 365
 
366 366
                 gravityview()->log->debug( 'No user defined; edit entry requires logged in user' );
367 367
 
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
          */
380 380
         $user_can_edit = apply_filters( 'gravityview/edit_entry/user_can_edit_entry', $user_can_edit, $entry, $view_id );
381 381
 
382
-        return (bool) $user_can_edit;
382
+        return (bool)$user_can_edit;
383 383
     }
384 384
 
385 385
 
Please login to merge, or discard this patch.
includes/extensions/duplicate-entry/class-duplicate-entry.php 1 patch
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 */
84 84
 	public function add_reserved_arg( $args ) {
85 85
 
86
-		$args[] = 'duplicate';
86
+		$args[ ] = 'duplicate';
87 87
 
88 88
 		return $args;
89 89
 	}
@@ -155,9 +155,9 @@  discard block
 block discarded – undo
155 155
 	 */
156 156
 	public function _filter_sortable_fields( $fields ) {
157 157
 
158
-		$fields = (array) $fields;
158
+		$fields = (array)$fields;
159 159
 
160
-		$fields[] = 'duplicate_link';
160
+		$fields[ ] = 'duplicate_link';
161 161
 
162 162
 		return $fields;
163 163
 	}
@@ -196,12 +196,12 @@  discard block
 block discarded – undo
196 196
 	public function duplicate_link_field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
197 197
 
198 198
 		// Always a link, never a filter, always same window
199
-		unset( $field_options['show_as_link'], $field_options['search_filter'], $field_options['new_window'] );
199
+		unset( $field_options[ 'show_as_link' ], $field_options[ 'search_filter' ], $field_options[ 'new_window' ] );
200 200
 
201 201
 		// Duplicate Entry link should only appear to visitors capable of editing entries
202
-		unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] );
202
+		unset( $field_options[ 'only_loggedin' ], $field_options[ 'only_loggedin_cap' ] );
203 203
 
204
-		$add_option['duplicate_link'] = array(
204
+		$add_option[ 'duplicate_link' ] = array(
205 205
 			'type' => 'text',
206 206
 			'label' => __( 'Duplicate Link Text', 'gravityview' ),
207 207
 			'desc' => NULL,
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 			'merge_tags' => true,
210 210
 		);
211 211
 
212
-		$field_options['allow_duplicate_cap'] = array(
212
+		$field_options[ 'allow_duplicate_cap' ] = array(
213 213
 			'type' => 'select',
214 214
 			'label' => __( 'Allow the following users to duplicate the entry:', 'gravityview' ),
215 215
 			'choices' => GravityView_Render_Settings::get_cap_choices( $template_id, $field_id, $context, $input_type ),
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 	public function add_default_field( $entry_default_fields, $form = array(), $zone = '' ) {
237 237
 
238 238
 		if ( 'edit' !== $zone ) {
239
-			$entry_default_fields['duplicate_link'] = array(
239
+			$entry_default_fields[ 'duplicate_link' ] = array(
240 240
 				'label' => __( 'Duplicate Entry', 'gravityview' ),
241 241
 				'type'  => 'duplicate_link',
242 242
 				'desc'  => __( 'A link to duplicate the entry. Respects the Duplicate Entry permissions.', 'gravityview' ),
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 	 */
259 259
 	public function add_available_field( $available_fields = array() ) {
260 260
 
261
-		$available_fields['duplicate_link'] = array(
261
+		$available_fields[ 'duplicate_link' ] = array(
262 262
 			'label_text' => __( 'Duplicate Entry', 'gravityview' ),
263 263
 			'field_id' => 'duplicate_link',
264 264
 			'label_type' => 'field',
@@ -291,9 +291,9 @@  discard block
 block discarded – undo
291 291
 		if ( 'duplicate_link' === $field_id ) {
292 292
 
293 293
 			// Remove other built-in caps.
294
-			unset( $caps['publish_posts'], $caps['gravityforms_view_entries'], $caps['duplicate_others_posts'] );
294
+			unset( $caps[ 'publish_posts' ], $caps[ 'gravityforms_view_entries' ], $caps[ 'duplicate_others_posts' ] );
295 295
 
296
-			$caps['read'] = _x( 'Entry Creator', 'User capability', 'gravityview' );
296
+			$caps[ 'read' ] = _x( 'Entry Creator', 'User capability', 'gravityview' );
297 297
 		}
298 298
 
299 299
 		return $caps;
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 	 */
329 329
 	public static function get_duplicate_link( $entry, $view_id, $post_id = null ) {
330 330
 
331
-        $base = GravityView_API::directory_link( $post_id ? : $view_id, true );
331
+        $base = GravityView_API::directory_link( $post_id ?: $view_id, true );
332 332
 
333 333
 		if ( empty( $base ) ) {
334 334
 			gravityview()->log->error( 'Post ID does not exist: {post_id}', array( 'post_id' => $post_id ) );
@@ -337,12 +337,12 @@  discard block
 block discarded – undo
337 337
 
338 338
 		$actionurl = add_query_arg( array(
339 339
 			'action'	=> 'duplicate',
340
-			'entry_id'	=> $entry['id'],
340
+			'entry_id'	=> $entry[ 'id' ],
341 341
 			'gvid' => $view_id,
342 342
             'view_id' => $view_id,
343 343
 		), $base );
344 344
 
345
-		return add_query_arg( 'duplicate', wp_create_nonce( self::get_nonce_key( $entry['id'] ) ), $actionurl );
345
+		return add_query_arg( 'duplicate', wp_create_nonce( self::get_nonce_key( $entry[ 'id' ] ) ), $actionurl );
346 346
 	}
347 347
 
348 348
 	/**
@@ -363,12 +363,12 @@  discard block
 block discarded – undo
363 363
 	public function process_duplicate() {
364 364
 
365 365
 		// If the form is submitted
366
-		if ( ( ! isset( $_GET['action'] ) ) || 'duplicate' !== $_GET['action'] || ( ! isset( $_GET['entry_id'] ) ) ) {
366
+		if ( ( ! isset( $_GET[ 'action' ] ) ) || 'duplicate' !== $_GET[ 'action' ] || ( ! isset( $_GET[ 'entry_id' ] ) ) ) {
367 367
 			return;
368 368
 		}
369 369
 
370 370
 		// Make sure it's a GravityView request
371
-		$valid_nonce_key = wp_verify_nonce( \GV\Utils::_GET( 'duplicate' ), self::get_nonce_key( $_GET['entry_id'] ) );
371
+		$valid_nonce_key = wp_verify_nonce( \GV\Utils::_GET( 'duplicate' ), self::get_nonce_key( $_GET[ 'entry_id' ] ) );
372 372
 
373 373
 		if ( ! $valid_nonce_key ) {
374 374
 			gravityview()->log->debug( 'Duplicate entry not processed: nonce validation failed.' );
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 		}
377 377
 
378 378
 		// Get the entry slug
379
-		$entry_slug = esc_attr( $_GET['entry_id'] );
379
+		$entry_slug = esc_attr( $_GET[ 'entry_id' ] );
380 380
 
381 381
 		// See if there's an entry there
382 382
 		$entry = gravityview_get_entry( $entry_slug, true, false );
@@ -470,17 +470,17 @@  discard block
 block discarded – undo
470 470
 			return new WP_Error( 'gravityview-duplicate-entry-missing', __( 'The entry does not exist.', 'gravityview' ) );
471 471
 		}
472 472
 
473
-		$form = GFAPI::get_form( $entry['form_id'] );
473
+		$form = GFAPI::get_form( $entry[ 'form_id' ] );
474 474
 
475
-		$row['id'] = null;
476
-		$row['date_created'] = date( 'Y-m-d H:i:s', time() );
477
-		$row['date_updated'] = $row['date_created'];
478
-		$row['is_starred'] = false;
479
-		$row['is_read'] = false;
480
-		$row['ip'] = rgars( $form, 'personalData/preventIP' ) ? '' : GFFormsModel::get_ip();
481
-		$row['source_url'] = esc_url_raw( remove_query_arg( array( 'action', 'gvid', 'result', 'duplicate', 'entry_id' ) ) );
482
-		$row['user_agent'] = \GV\Utils::_SERVER( 'HTTP_USER_AGENT' );
483
-		$row['created_by'] = wp_get_current_user()->ID;
475
+		$row[ 'id' ] = null;
476
+		$row[ 'date_created' ] = date( 'Y-m-d H:i:s', time() );
477
+		$row[ 'date_updated' ] = $row[ 'date_created' ];
478
+		$row[ 'is_starred' ] = false;
479
+		$row[ 'is_read' ] = false;
480
+		$row[ 'ip' ] = rgars( $form, 'personalData/preventIP' ) ? '' : GFFormsModel::get_ip();
481
+		$row[ 'source_url' ] = esc_url_raw( remove_query_arg( array( 'action', 'gvid', 'result', 'duplicate', 'entry_id' ) ) );
482
+		$row[ 'user_agent' ] = \GV\Utils::_SERVER( 'HTTP_USER_AGENT' );
483
+		$row[ 'created_by' ] = wp_get_current_user()->ID;
484 484
 
485 485
 		/**
486 486
 		 * @filter `gravityview/entry/duplicate/details` Modify the new entry details before it's created.
@@ -508,15 +508,15 @@  discard block
 block discarded – undo
508 508
 
509 509
 		$save_this_meta = array();
510 510
 		foreach ( $duplicate_meta->get_output() as $m ) {
511
-			$save_this_meta[] = array(
512
-				'meta_key' => $m['meta_key'],
513
-				'meta_value' => $m['meta_value'],
514
-				'item_index' => $m['item_index'],
511
+			$save_this_meta[ ] = array(
512
+				'meta_key' => $m[ 'meta_key' ],
513
+				'meta_value' => $m[ 'meta_value' ],
514
+				'item_index' => $m[ 'item_index' ],
515 515
 			);
516 516
 		}
517 517
 
518 518
 		// Update the row ID for later usage
519
-		$row['id'] = $duplicated_id;
519
+		$row[ 'id' ] = $duplicated_id;
520 520
 
521 521
 		/**
522 522
 		 * @filter `gravityview/entry/duplicate/meta` Modify the new entry meta details.
@@ -527,8 +527,8 @@  discard block
 block discarded – undo
527 527
 		$save_this_meta = apply_filters( 'gravityview/entry/duplicate/meta', $save_this_meta, $row, $entry );
528 528
 
529 529
 		foreach ( $save_this_meta as $data ) {
530
-			$data['form_id'] = $entry['form_id'];
531
-			$data['entry_id'] = $duplicated_id;
530
+			$data[ 'form_id' ] = $entry[ 'form_id' ];
531
+			$data[ 'entry_id' ] = $duplicated_id;
532 532
 
533 533
 			if ( ! $wpdb->insert( $entry_meta_table, $data ) ) {
534 534
 				return new WP_Error( 'gravityview-duplicate-entry-db-meta', __( 'There was an error duplicating the entry.', 'gravityview' ) );
@@ -562,13 +562,13 @@  discard block
 block discarded – undo
562 562
 	public function verify_nonce() {
563 563
 
564 564
 		// No duplicate entry request was made
565
-		if ( empty( $_GET['entry_id'] ) || empty( $_GET['duplicate'] ) ) {
565
+		if ( empty( $_GET[ 'entry_id' ] ) || empty( $_GET[ 'duplicate' ] ) ) {
566 566
 			return false;
567 567
 		}
568 568
 
569
-		$nonce_key = self::get_nonce_key( $_GET['entry_id'] );
569
+		$nonce_key = self::get_nonce_key( $_GET[ 'entry_id' ] );
570 570
 
571
-		$valid = wp_verify_nonce( $_GET['duplicate'], $nonce_key );
571
+		$valid = wp_verify_nonce( $_GET[ 'duplicate' ], $nonce_key );
572 572
 
573 573
 		/**
574 574
 		 * @filter `gravityview/duplicate-entry/verify_nonce` Override Duplicate Entry nonce validation. Return true to declare nonce valid.
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
 			return '';
605 605
 		}
606 606
 
607
-		return 'return window.confirm(\''. esc_js( $confirm ) .'\');';
607
+		return 'return window.confirm(\'' . esc_js( $confirm ) . '\');';
608 608
 	}
609 609
 
610 610
 	/**
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
 	public static function check_user_cap_duplicate_entry( $entry, $field = array(), $view_id = 0 ) {
659 659
 		$current_user = wp_get_current_user();
660 660
 
661
-		$entry_id = isset( $entry['id'] ) ? $entry['id'] : null;
661
+		$entry_id = isset( $entry[ 'id' ] ) ? $entry[ 'id' ] : null;
662 662
 
663 663
 		// Or if they can duplicate any entries (as defined in Gravity Forms), we're good.
664 664
 		if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gform_full_access', 'gravityview_full_access' ), $entry_id ) ) {
@@ -673,17 +673,17 @@  discard block
 block discarded – undo
673 673
 		if ( ! empty( $field ) ) {
674 674
 
675 675
 			// If capability is not defined, something is not right!
676
-			if ( empty( $field['allow_duplicate_cap'] ) ) {
676
+			if ( empty( $field[ 'allow_duplicate_cap' ] ) ) {
677 677
 
678 678
 				gravityview()->log->error( 'Cannot read duplicate entry field caps', array( 'data' => $field ) );
679 679
 
680 680
 				return false;
681 681
 			}
682 682
 
683
-			if ( GVCommon::has_cap( $field['allow_duplicate_cap'] ) ) {
683
+			if ( GVCommon::has_cap( $field[ 'allow_duplicate_cap' ] ) ) {
684 684
 
685 685
 				// Do not return true if cap is read, as we need to check if the current user created the entry
686
-				if ( 'read' !== $field['allow_duplicate_cap'] ) {
686
+				if ( 'read' !== $field[ 'allow_duplicate_cap' ] ) {
687 687
 					return true;
688 688
 				}
689 689
 
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
 
697 697
 		}
698 698
 
699
-		if ( ! isset( $entry['created_by'] ) ) {
699
+		if ( ! isset( $entry[ 'created_by' ] ) ) {
700 700
 
701 701
 			gravityview()->log->error( 'Cannot duplicate entry; entry `created_by` doesn\'t exist.' );
702 702
 
@@ -721,7 +721,7 @@  discard block
 block discarded – undo
721 721
 		}
722 722
 
723 723
 		// If the logged-in user is the same as the user who created the entry, we're good.
724
-		if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) {
724
+		if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry[ 'created_by' ] ) ) {
725 725
 
726 726
 			gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id' => $current_user->ID ) );
727 727
 
@@ -745,12 +745,12 @@  discard block
 block discarded – undo
745 745
 	 * @return void
746 746
 	 */
747 747
 	public function maybe_display_message( $current_view_id = 0 ) {
748
-		if ( empty( $_GET['status'] ) || ! self::verify_nonce() ) {
748
+		if ( empty( $_GET[ 'status' ] ) || ! self::verify_nonce() ) {
749 749
 			return;
750 750
 		}
751 751
 
752 752
 		// Entry wasn't duplicated from current View
753
-		if ( isset( $_GET['view_id'] ) && ( intval( $_GET['view_id'] ) !== intval( $current_view_id ) ) ) {
753
+		if ( isset( $_GET[ 'view_id' ] ) && ( intval( $_GET[ 'view_id' ] ) !== intval( $current_view_id ) ) ) {
754 754
 			return;
755 755
 		}
756 756
 
@@ -758,11 +758,11 @@  discard block
 block discarded – undo
758 758
 	}
759 759
 
760 760
 	public function display_message() {
761
-		if ( empty( $_GET['status'] ) || empty( $_GET['duplicate'] ) ) {
761
+		if ( empty( $_GET[ 'status' ] ) || empty( $_GET[ 'duplicate' ] ) ) {
762 762
 			return;
763 763
 		}
764 764
 
765
-		$status = esc_attr( $_GET['status'] );
765
+		$status = esc_attr( $_GET[ 'status' ] );
766 766
 		$message_from_url = \GV\Utils::_GET( 'message' );
767 767
 		$message_from_url = rawurldecode( stripslashes_deep( $message_from_url ) );
768 768
 		$class = '';
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
 		$message = apply_filters( 'gravityview/duplicate-entry/message', esc_attr( $message ), $status, $message_from_url );
789 789
 
790 790
 		// DISPLAY ERROR/SUCCESS MESSAGE
791
-		echo '<div class="gv-notice' . esc_attr( $class ) .'">'. $message .'</div>';
791
+		echo '<div class="gv-notice' . esc_attr( $class ) . '">' . $message . '</div>';
792 792
 	}
793 793
 
794 794
 	/**
@@ -818,7 +818,7 @@  discard block
 block discarded – undo
818 818
 		?>
819 819
 		<span class="gv-duplicate">
820 820
 			|
821
-			<a href="<?php echo wp_nonce_url( add_query_arg( 'entry_id', $entry['id'] ), self::get_nonce_key( $entry['id'] ), 'duplicate' ); ?>"><?php esc_html_e( 'Duplicate', 'gravityview' ); ?></a>
821
+			<a href="<?php echo wp_nonce_url( add_query_arg( 'entry_id', $entry[ 'id' ] ), self::get_nonce_key( $entry[ 'id' ] ), 'duplicate' ); ?>"><?php esc_html_e( 'Duplicate', 'gravityview' ); ?></a>
822 822
 		</span>
823 823
 		<?php
824 824
 	}
@@ -840,9 +840,9 @@  discard block
 block discarded – undo
840 840
 
841 841
 		if ( 'success' === \GV\Utils::_GET( 'result' ) ) {
842 842
 			add_filter( 'gform_admin_messages', function( $messages ) {
843
-				$messages = (array) $messages;
843
+				$messages = (array)$messages;
844 844
 
845
-				$messages[] = esc_html__( 'Entry duplicated.', 'gravityview' );
845
+				$messages[ ] = esc_html__( 'Entry duplicated.', 'gravityview' );
846 846
 				return $messages;
847 847
 			} );
848 848
 		}
@@ -853,7 +853,7 @@  discard block
 block discarded – undo
853 853
 
854 854
 			$check_logs_message = '';
855 855
 
856
-			if( $is_logging_active ) {
856
+			if ( $is_logging_active ) {
857 857
 				$check_logs_message = sprintf( ' <a href="%s">%s</a>',
858 858
 					esc_url( admin_url( 'admin.php?page=gf_settings&subview=gravityformslogging' ) ),
859 859
 					esc_html_x( 'Check the GravityView logs for more information.', 'Error message links to logging page', 'gravityview' )
@@ -861,9 +861,9 @@  discard block
 block discarded – undo
861 861
 			}
862 862
 
863 863
 			add_filter( 'gform_admin_error_messages', function( $messages ) use ( $check_logs_message ) {
864
-				$messages = (array) $messages;
864
+				$messages = (array)$messages;
865 865
 
866
-				$messages[] = esc_html__( 'There was an error duplicating the entry.', 'gravityview' ) . $check_logs_message;
866
+				$messages[ ] = esc_html__( 'There was an error duplicating the entry.', 'gravityview' ) . $check_logs_message;
867 867
 
868 868
 				return $messages;
869 869
 			} );
Please login to merge, or discard this patch.
includes/widgets/search-widget/class-search-widget.php 1 patch
Spacing   +183 added lines, -183 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 				'type' => 'radio',
65 65
 				'full_width' => true,
66 66
 				'label' => esc_html__( 'Search Mode', 'gravityview' ),
67
-				'desc' => __('Should search results match all search fields, or any?', 'gravityview'),
67
+				'desc' => __( 'Should search results match all search fields, or any?', 'gravityview' ),
68 68
 				'value' => 'any',
69 69
 				'class' => 'hide-if-js',
70 70
 				'options' => array(
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 
84 84
 			// admin - add scripts - run at 1100 to make sure GravityView_Admin_Views::add_scripts_and_styles() runs first at 999
85 85
 			add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 1100 );
86
-			add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts') );
86
+			add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) );
87 87
 			add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) );
88 88
 
89 89
 			// ajax - get the searchable fields
@@ -119,19 +119,19 @@  discard block
 block discarded – undo
119 119
 	 */
120 120
 	public function add_reserved_args( $args ) {
121 121
 
122
-		$args[] = 'gv_search';
123
-		$args[] = 'gv_start';
124
-		$args[] = 'gv_end';
125
-		$args[] = 'gv_id';
126
-		$args[] = 'gv_by';
127
-		$args[] = 'mode';
122
+		$args[ ] = 'gv_search';
123
+		$args[ ] = 'gv_start';
124
+		$args[ ] = 'gv_end';
125
+		$args[ ] = 'gv_id';
126
+		$args[ ] = 'gv_by';
127
+		$args[ ] = 'mode';
128 128
 
129
-		$get = (array) $_GET;
129
+		$get = (array)$_GET;
130 130
 
131 131
 		// If the fields being searched as reserved; not to be considered user-passed variables
132 132
 		foreach ( $get as $key => $value ) {
133 133
 			if ( $key !== $this->convert_request_key_to_filter_key( $key ) ) {
134
-				$args[] = $key;
134
+				$args[ ] = $key;
135 135
 			}
136 136
 		}
137 137
 
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 		$script_min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
256 256
 		$script_source = empty( $script_min ) ? '/source' : '';
257 257
 
258
-		wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js'.$script_source.'/admin-search-widget'.$script_min.'.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), \GV\Plugin::$version );
258
+		wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js' . $script_source . '/admin-search-widget' . $script_min . '.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), \GV\Plugin::$version );
259 259
 
260 260
 		wp_localize_script( 'gravityview_searchwidget_admin', 'gvSearchVar', array(
261 261
 			'nonce' => wp_create_nonce( 'gravityview_ajaxsearchwidget' ),
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 	 * @return array Scripts allowed in no-conflict mode, plus the search widget script
278 278
 	 */
279 279
 	public function register_no_conflict( $allowed ) {
280
-		$allowed[] = 'gravityview_searchwidget_admin';
280
+		$allowed[ ] = 'gravityview_searchwidget_admin';
281 281
 		return $allowed;
282 282
 	}
283 283
 
@@ -289,24 +289,24 @@  discard block
 block discarded – undo
289 289
 	 */
290 290
 	public static function get_searchable_fields() {
291 291
 
292
-		if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxsearchwidget' ) ) {
292
+		if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxsearchwidget' ) ) {
293 293
 			exit( '0' );
294 294
 		}
295 295
 
296 296
 		$form = '';
297 297
 
298 298
 		// Fetch the form for the current View
299
-		if ( ! empty( $_POST['view_id'] ) ) {
299
+		if ( ! empty( $_POST[ 'view_id' ] ) ) {
300 300
 
301
-			$form = gravityview_get_form_id( $_POST['view_id'] );
301
+			$form = gravityview_get_form_id( $_POST[ 'view_id' ] );
302 302
 
303
-		} elseif ( ! empty( $_POST['formid'] ) ) {
303
+		} elseif ( ! empty( $_POST[ 'formid' ] ) ) {
304 304
 
305
-			$form = (int) $_POST['formid'];
305
+			$form = (int)$_POST[ 'formid' ];
306 306
 
307
-		} elseif ( ! empty( $_POST['template_id'] ) && class_exists( 'GravityView_Ajax' ) ) {
307
+		} elseif ( ! empty( $_POST[ 'template_id' ] ) && class_exists( 'GravityView_Ajax' ) ) {
308 308
 
309
-			$form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] );
309
+			$form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] );
310 310
 
311 311
 		}
312 312
 
@@ -356,14 +356,14 @@  discard block
 block discarded – undo
356 356
 		);
357 357
 
358 358
 		if ( gravityview()->plugin->supports( \GV\Plugin::FEATURE_GFQUERY ) ) {
359
-			$custom_fields['is_approved'] = array(
359
+			$custom_fields[ 'is_approved' ] = array(
360 360
 				'text' => esc_html__( 'Approval Status', 'gravityview' ),
361 361
 				'type' => 'multi',
362 362
 			);
363 363
 		}
364 364
 
365
-		foreach( $custom_fields as $custom_field_key => $custom_field ) {
366
-			$output .= sprintf( '<option value="%s" %s data-inputtypes="%s" data-placeholder="%s">%s</option>', $custom_field_key, selected( $custom_field_key, $current, false ), $custom_field['type'], self::get_field_label( array('field' => $custom_field_key ) ), $custom_field['text'] );
365
+		foreach ( $custom_fields as $custom_field_key => $custom_field ) {
366
+			$output .= sprintf( '<option value="%s" %s data-inputtypes="%s" data-placeholder="%s">%s</option>', $custom_field_key, selected( $custom_field_key, $current, false ), $custom_field[ 'type' ], self::get_field_label( array( 'field' => $custom_field_key ) ), $custom_field[ 'text' ] );
367 367
 		}
368 368
 
369 369
 		// Get fields with sub-inputs and no parent
@@ -385,13 +385,13 @@  discard block
 block discarded – undo
385 385
 
386 386
 			foreach ( $fields as $id => $field ) {
387 387
 
388
-				if ( in_array( $field['type'], $blacklist_field_types ) ) {
388
+				if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
389 389
 					continue;
390 390
 				}
391 391
 
392
-				$types = self::get_search_input_types( $id, $field['type'] );
392
+				$types = self::get_search_input_types( $id, $field[ 'type' ] );
393 393
 
394
-				$output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'data-inputtypes="'. esc_attr( $types ) .'">'. esc_html( $field['label'] ) .'</option>';
394
+				$output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . 'data-inputtypes="' . esc_attr( $types ) . '">' . esc_html( $field[ 'label' ] ) . '</option>';
395 395
 			}
396 396
 		}
397 397
 
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
 	public static function get_search_input_types( $field_id = '', $field_type = null ) {
415 415
 
416 416
 		// @todo - This needs to be improved - many fields have . including products and addresses
417
-		if ( false !== strpos( (string) $field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) {
417
+		if ( false !== strpos( (string)$field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) {
418 418
 			$input_type = 'boolean'; // on/off checkbox
419 419
 		} elseif ( in_array( $field_type, array( 'checkbox', 'post_category', 'multiselect' ) ) ) {
420 420
 			$input_type = 'multi'; //multiselect
@@ -460,19 +460,19 @@  discard block
 block discarded – undo
460 460
 			$post_id = 0;
461 461
 
462 462
 			// We're in the WordPress Widget context, and an overriding post ID has been set.
463
-			if ( ! empty( $widget_args['post_id'] ) ) {
464
-				$post_id = absint( $widget_args['post_id'] );
463
+			if ( ! empty( $widget_args[ 'post_id' ] ) ) {
464
+				$post_id = absint( $widget_args[ 'post_id' ] );
465 465
 			}
466 466
 			// We're in the WordPress Widget context, and the base View ID should be used
467
-			else if ( ! empty( $widget_args['view_id'] ) ) {
468
-				$post_id = absint( $widget_args['view_id'] );
467
+			else if ( ! empty( $widget_args[ 'view_id' ] ) ) {
468
+				$post_id = absint( $widget_args[ 'view_id' ] );
469 469
 			}
470 470
 
471 471
 			$args = gravityview_get_permalink_query_args( $post_id );
472 472
 
473 473
 			// Add hidden fields to the search form
474 474
 			foreach ( $args as $key => $value ) {
475
-				$search_fields[] = array(
475
+				$search_fields[ ] = array(
476 476
 					'name'  => $key,
477 477
 					'input' => 'hidden',
478 478
 					'value' => $value,
@@ -511,28 +511,28 @@  discard block
 block discarded – undo
511 511
 		/**
512 512
 		 * Include the sidebar Widgets.
513 513
 		 */
514
-		$widgets = (array) get_option( 'widget_gravityview_search', array() );
514
+		$widgets = (array)get_option( 'widget_gravityview_search', array() );
515 515
 
516 516
 		foreach ( $widgets as $widget ) {
517
-			if ( ! empty( $widget['view_id'] ) && $widget['view_id'] == $view->ID ) {
518
-				if( $_fields = json_decode( $widget['search_fields'], true ) ) {
517
+			if ( ! empty( $widget[ 'view_id' ] ) && $widget[ 'view_id' ] == $view->ID ) {
518
+				if ( $_fields = json_decode( $widget[ 'search_fields' ], true ) ) {
519 519
 					foreach ( $_fields as $field ) {
520
-						if ( empty( $field['form_id'] ) ) {
521
-							$field['form_id'] = $view->form ? $view->form->ID : 0;
520
+						if ( empty( $field[ 'form_id' ] ) ) {
521
+							$field[ 'form_id' ] = $view->form ? $view->form->ID : 0;
522 522
 						}
523
-						$searchable_fields[] = $with_full_field ? $field : $field['field'];
523
+						$searchable_fields[ ] = $with_full_field ? $field : $field[ 'field' ];
524 524
 					}
525 525
 				}
526 526
 			}
527 527
 		}
528 528
 
529 529
 		foreach ( $view->widgets->by_id( $this->get_widget_id() )->all() as $widget ) {
530
-			if( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) {
530
+			if ( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) {
531 531
 				foreach ( $_fields as $field ) {
532
-					if ( empty( $field['form_id'] ) ) {
533
-						$field['form_id'] = $view->form ? $view->form->ID : 0;
532
+					if ( empty( $field[ 'form_id' ] ) ) {
533
+						$field[ 'form_id' ] = $view->form ? $view->form->ID : 0;
534 534
 					}
535
-					$searchable_fields[] = $with_full_field ? $field : $field['field'];
535
+					$searchable_fields[ ] = $with_full_field ? $field : $field[ 'field' ];
536 536
 				}
537 537
 			}
538 538
 		}
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
 			return $search_criteria; // Return the original criteria, GF_Query modification kicks in later
571 571
 		}
572 572
 
573
-		if( 'post' === $this->search_method ) {
573
+		if ( 'post' === $this->search_method ) {
574 574
 			$get = $_POST;
575 575
 		} else {
576 576
 			$get = $_GET;
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
 		$get = gv_map_deep( $get, 'rawurldecode' );
590 590
 
591 591
 		// Make sure array key is set up
592
-		$search_criteria['field_filters'] = \GV\Utils::get( $search_criteria, 'field_filters', array() );
592
+		$search_criteria[ 'field_filters' ] = \GV\Utils::get( $search_criteria, 'field_filters', array() );
593 593
 
594 594
 		$searchable_fields = $this->get_view_searchable_fields( $view );
595 595
 		$searchable_field_objects = $this->get_view_searchable_fields( $view, true );
@@ -609,9 +609,9 @@  discard block
 block discarded – undo
609 609
 		$trim_search_value = apply_filters( 'gravityview/search-trim-input', true );
610 610
 
611 611
 		// add free search
612
-		if ( isset( $get['gv_search'] ) && '' !== $get['gv_search'] && in_array( 'search_all', $searchable_fields ) ) {
612
+		if ( isset( $get[ 'gv_search' ] ) && '' !== $get[ 'gv_search' ] && in_array( 'search_all', $searchable_fields ) ) {
613 613
 
614
-			$search_all_value = $trim_search_value ? trim( $get['gv_search'] ) : $get['gv_search'];
614
+			$search_all_value = $trim_search_value ? trim( $get[ 'gv_search' ] ) : $get[ 'gv_search' ];
615 615
 
616 616
 			if ( $split_words ) {
617 617
 				// Search for a piece
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
 			}
628 628
 
629 629
 			foreach ( $words as $word ) {
630
-				$search_criteria['field_filters'][] = array(
630
+				$search_criteria[ 'field_filters' ][ ] = array(
631 631
 					'key' => null, // The field ID to search
632 632
 					'value' => $word, // The value to search
633 633
 					'operator' => 'contains', // What to search in. Options: `is` or `contains`
@@ -640,14 +640,14 @@  discard block
 block discarded – undo
640 640
 			/**
641 641
 			 * Get and normalize the dates according to the input format.
642 642
 			 */
643
-			if ( $curr_start = ! empty( $get['gv_start'] ) ? $get['gv_start'] : '' ) {
644
-				if( $curr_start_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_start ) ) {
643
+			if ( $curr_start = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_start' ] : '' ) {
644
+				if ( $curr_start_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_start ) ) {
645 645
 					$curr_start = $curr_start_date->format( 'Y-m-d' );
646 646
 				}
647 647
 			}
648 648
 
649
-			if ( $curr_end = ! empty( $get['gv_start'] ) ? ( ! empty( $get['gv_end'] ) ? $get['gv_end'] : '' ) : '' ) {
650
-				if( $curr_end_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_end ) ) {
649
+			if ( $curr_end = ! empty( $get[ 'gv_start' ] ) ? ( ! empty( $get[ 'gv_end' ] ) ? $get[ 'gv_end' ] : '' ) : '' ) {
650
+				if ( $curr_end_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_end ) ) {
651 651
 					$curr_end = $curr_end_date->format( 'Y-m-d' );
652 652
 				}
653 653
 			}
@@ -683,22 +683,22 @@  discard block
 block discarded – undo
683 683
 			 */
684 684
 			if ( ! empty( $curr_start ) ) {
685 685
 				$curr_start = date( 'Y-m-d H:i:s', strtotime( $curr_start ) );
686
-				$search_criteria['start_date'] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start;
686
+				$search_criteria[ 'start_date' ] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start;
687 687
 			}
688 688
 
689 689
 			if ( ! empty( $curr_end ) ) {
690 690
 				// Fast-forward 24 hour on the end time
691 691
 				$curr_end = date( 'Y-m-d H:i:s', strtotime( $curr_end ) + DAY_IN_SECONDS );
692
-				$search_criteria['end_date'] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end;
693
-				if ( strpos( $search_criteria['end_date'], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056
694
-					$search_criteria['end_date'] = date( 'Y-m-d H:i:s', strtotime( $search_criteria['end_date'] ) - 1 );
692
+				$search_criteria[ 'end_date' ] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end;
693
+				if ( strpos( $search_criteria[ 'end_date' ], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056
694
+					$search_criteria[ 'end_date' ] = date( 'Y-m-d H:i:s', strtotime( $search_criteria[ 'end_date' ] ) - 1 );
695 695
 				}
696 696
 			}
697 697
 		}
698 698
 
699 699
 		// search for a specific entry ID
700 700
 		if ( ! empty( $get[ 'gv_id' ] ) && in_array( 'entry_id', $searchable_fields ) ) {
701
-			$search_criteria['field_filters'][] = array(
701
+			$search_criteria[ 'field_filters' ][ ] = array(
702 702
 				'key' => 'id',
703 703
 				'value' => absint( $get[ 'gv_id' ] ),
704 704
 				'operator' => $this->get_operator( $get, 'gv_id', array( '=' ), '=' ),
@@ -707,15 +707,15 @@  discard block
 block discarded – undo
707 707
 
708 708
 		// search for a specific Created_by ID
709 709
 		if ( ! empty( $get[ 'gv_by' ] ) && in_array( 'created_by', $searchable_fields ) ) {
710
-			$search_criteria['field_filters'][] = array(
710
+			$search_criteria[ 'field_filters' ][ ] = array(
711 711
 				'key' => 'created_by',
712
-				'value' => $get['gv_by'],
712
+				'value' => $get[ 'gv_by' ],
713 713
 				'operator' => $this->get_operator( $get, 'gv_by', array( '=' ), '=' ),
714 714
 			);
715 715
 		}
716 716
 
717 717
 		// Get search mode passed in URL
718
-		$mode = isset( $get['mode'] ) && in_array( $get['mode'], array( 'any', 'all' ) ) ?  $get['mode'] : 'any';
718
+		$mode = isset( $get[ 'mode' ] ) && in_array( $get[ 'mode' ], array( 'any', 'all' ) ) ? $get[ 'mode' ] : 'any';
719 719
 
720 720
 		// get the other search filters
721 721
 		foreach ( $get as $key => $value ) {
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
 				$value = is_array( $value ) ? array_map( 'trim', $value ) : trim( $value );
725 725
 			}
726 726
 
727
-			if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[0], false, false ) ) ) {
727
+			if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[ 0 ], false, false ) ) ) {
728 728
 				continue; // Not a filter, or empty
729 729
 			}
730 730
 
@@ -738,21 +738,21 @@  discard block
 block discarded – undo
738 738
 				continue;
739 739
 			}
740 740
 
741
-			if ( ! isset( $filter['operator'] ) ) {
742
-				$filter['operator'] = $this->get_operator( $get, $key, array( 'contains' ), 'contains' );
741
+			if ( ! isset( $filter[ 'operator' ] ) ) {
742
+				$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'contains' ), 'contains' );
743 743
 			}
744 744
 
745
-			if ( isset( $filter[0]['value'] ) ) {
746
-				$filter[0]['value'] = $trim_search_value ? trim( $filter[0]['value'] ) : $filter[0]['value'];
745
+			if ( isset( $filter[ 0 ][ 'value' ] ) ) {
746
+				$filter[ 0 ][ 'value' ] = $trim_search_value ? trim( $filter[ 0 ][ 'value' ] ) : $filter[ 0 ][ 'value' ];
747 747
 
748
-				$search_criteria['field_filters'] = array_merge( $search_criteria['field_filters'], $filter );
748
+				$search_criteria[ 'field_filters' ] = array_merge( $search_criteria[ 'field_filters' ], $filter );
749 749
 
750 750
 				// if date range type, set search mode to ALL
751
-				if ( ! empty( $filter[0]['operator'] ) && in_array( $filter[0]['operator'], array( '>=', '<=', '>', '<' ) ) ) {
751
+				if ( ! empty( $filter[ 0 ][ 'operator' ] ) && in_array( $filter[ 0 ][ 'operator' ], array( '>=', '<=', '>', '<' ) ) ) {
752 752
 					$mode = 'all';
753 753
 				}
754
-			} elseif( !empty( $filter ) ) {
755
-				$search_criteria['field_filters'][] = $filter;
754
+			} elseif ( ! empty( $filter ) ) {
755
+				$search_criteria[ 'field_filters' ][ ] = $filter;
756 756
 			}
757 757
 		}
758 758
 
@@ -761,7 +761,7 @@  discard block
 block discarded – undo
761 761
 		 * @since 1.5.1
762 762
 		 * @param[out,in] string $mode Search mode (`any` vs `all`)
763 763
 		 */
764
-		$search_criteria['field_filters']['mode'] = apply_filters( 'gravityview/search/mode', $mode );
764
+		$search_criteria[ 'field_filters' ][ 'mode' ] = apply_filters( 'gravityview/search/mode', $mode );
765 765
 
766 766
 		gravityview()->log->debug( 'Returned Search Criteria: ', array( 'data' => $search_criteria ) );
767 767
 
@@ -795,19 +795,19 @@  discard block
 block discarded – undo
795 795
 
796 796
 		$query_class = $view->get_query_class();
797 797
 
798
-		if ( empty( $search_criteria['field_filters'] ) ) {
798
+		if ( empty( $search_criteria[ 'field_filters' ] ) ) {
799 799
 			return;
800 800
 		}
801 801
 
802 802
 		$widgets = $view->widgets->by_id( $this->widget_id );
803 803
 		if ( $widgets->count() ) {
804 804
 			$widgets = $widgets->all();
805
-			$widget  = $widgets[0];
805
+			$widget  = $widgets[ 0 ];
806 806
 
807 807
 			$search_fields = json_decode( $widget->configuration->get( 'search_fields' ), true );
808 808
 
809
-			foreach ( (array) $search_fields as $search_field ) {
810
-				if ( 'created_by' === $search_field['field'] && 'input_text' === $search_field['input'] ) {
809
+			foreach ( (array)$search_fields as $search_field ) {
810
+				if ( 'created_by' === $search_field[ 'field' ] && 'input_text' === $search_field[ 'input' ] ) {
811 811
 					$created_by_text_mode = true;
812 812
 				}
813 813
 			}
@@ -816,7 +816,7 @@  discard block
 block discarded – undo
816 816
 		$extra_conditions = array();
817 817
 		$mode = 'any';
818 818
 
819
-		foreach ( $search_criteria['field_filters'] as &$filter ) {
819
+		foreach ( $search_criteria[ 'field_filters' ] as &$filter ) {
820 820
 			if ( ! is_array( $filter ) ) {
821 821
 				if ( in_array( strtolower( $filter ), array( 'any', 'all' ) ) ) {
822 822
 					$mode = $filter;
@@ -825,13 +825,13 @@  discard block
 block discarded – undo
825 825
 			}
826 826
 
827 827
 			// Construct a manual query for unapproved statuses
828
-			if ( 'is_approved' === $filter['key'] && in_array( \GravityView_Entry_Approval_Status::UNAPPROVED, (array) $filter['value'] ) ) {
829
-				$_tmp_query       = new $query_class( $view->form->ID, array(
828
+			if ( 'is_approved' === $filter[ 'key' ] && in_array( \GravityView_Entry_Approval_Status::UNAPPROVED, (array)$filter[ 'value' ] ) ) {
829
+				$_tmp_query = new $query_class( $view->form->ID, array(
830 830
 					'field_filters' => array(
831 831
 						array(
832 832
 							'operator' => 'in',
833 833
 							'key'      => 'is_approved',
834
-							'value'    => (array) $filter['value'],
834
+							'value'    => (array)$filter[ 'value' ],
835 835
 						),
836 836
 						array(
837 837
 							'operator' => 'is',
@@ -843,30 +843,30 @@  discard block
 block discarded – undo
843 843
 				) );
844 844
 				$_tmp_query_parts = $_tmp_query->_introspect();
845 845
 
846
-				$extra_conditions[] = $_tmp_query_parts['where'];
846
+				$extra_conditions[ ] = $_tmp_query_parts[ 'where' ];
847 847
 
848 848
 				$filter = false;
849 849
 				continue;
850 850
 			}
851 851
 
852 852
 			// Construct manual query for text mode creator search
853
-			if ( 'created_by' === $filter['key'] && ! empty( $created_by_text_mode ) ) {
854
-				$extra_conditions[] = new GravityView_Widget_Search_Author_GF_Query_Condition( $filter, $view );
853
+			if ( 'created_by' === $filter[ 'key' ] && ! empty( $created_by_text_mode ) ) {
854
+				$extra_conditions[ ] = new GravityView_Widget_Search_Author_GF_Query_Condition( $filter, $view );
855 855
 				$filter = false;
856 856
 				continue;
857 857
 			}
858 858
 
859 859
 			// By default, we want searches to be wildcard for each field.
860
-			$filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator'];
860
+			$filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ];
861 861
 
862 862
 			// For multichoice, let's have an in (OR) search.
863
-			if ( is_array( $filter['value'] ) ) {
864
-				$filter['operator'] = 'in'; // @todo what about in contains (OR LIKE chains)?
863
+			if ( is_array( $filter[ 'value' ] ) ) {
864
+				$filter[ 'operator' ] = 'in'; // @todo what about in contains (OR LIKE chains)?
865 865
 			}
866 866
 
867 867
 			// Default form with joins functionality
868
-			if ( empty( $filter['form_id'] ) ) {
869
-				$filter['form_id'] = $view->form ? $view->form->ID : 0;
868
+			if ( empty( $filter[ 'form_id' ] ) ) {
869
+				$filter[ 'form_id' ] = $view->form ? $view->form->ID : 0;
870 870
 			}
871 871
 
872 872
 			/**
@@ -876,28 +876,28 @@  discard block
 block discarded – undo
876 876
 			 * @since develop
877 877
 			 * @param \GV\View $view The View we're operating on.
878 878
 			 */
879
-			$filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter, $view );
879
+			$filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter, $view );
880 880
 		}
881 881
 
882
-		if ( ! empty( $search_criteria['start_date'] ) || ! empty( $search_criteria['end_date'] ) ) {
882
+		if ( ! empty( $search_criteria[ 'start_date' ] ) || ! empty( $search_criteria[ 'end_date' ] ) ) {
883 883
 			$date_criteria = array();
884 884
 
885
-			if ( isset( $search_criteria['start_date'] ) ) {
886
-				$date_criteria['start_date'] = $search_criteria['start_date'];
885
+			if ( isset( $search_criteria[ 'start_date' ] ) ) {
886
+				$date_criteria[ 'start_date' ] = $search_criteria[ 'start_date' ];
887 887
 			}
888 888
 
889
-			if ( isset( $search_criteria['end_date'] ) ) {
890
-				$date_criteria['end_date'] = $search_criteria['end_date'];
889
+			if ( isset( $search_criteria[ 'end_date' ] ) ) {
890
+				$date_criteria[ 'end_date' ] = $search_criteria[ 'end_date' ];
891 891
 			}
892 892
 
893 893
 			$_tmp_query         = new $query_class( $view->form->ID, $date_criteria );
894 894
 			$_tmp_query_parts   = $_tmp_query->_introspect();
895
-			$extra_conditions[] = $_tmp_query_parts['where'];
895
+			$extra_conditions[ ] = $_tmp_query_parts[ 'where' ];
896 896
 		}
897 897
 
898 898
 		$search_conditions = array();
899 899
 
900
-		if ( $filters = array_filter( $search_criteria['field_filters'] ) ) {
900
+		if ( $filters = array_filter( $search_criteria[ 'field_filters' ] ) ) {
901 901
 			foreach ( $filters as &$filter ) {
902 902
 				if ( ! is_array( $filter ) ) {
903 903
 					continue;
@@ -909,12 +909,12 @@  discard block
 block discarded – undo
909 909
 				 * code by reusing what's inside GF_Query already as they
910 910
 				 * take care of many small things like forcing numeric, etc.
911 911
 				 */
912
-				$_tmp_query       = new $query_class( $filter['form_id'], array( 'mode' => 'any', 'field_filters' => array( $filter ) ) );
912
+				$_tmp_query       = new $query_class( $filter[ 'form_id' ], array( 'mode' => 'any', 'field_filters' => array( $filter ) ) );
913 913
 				$_tmp_query_parts = $_tmp_query->_introspect();
914
-				$search_condition = $_tmp_query_parts['where'];
914
+				$search_condition = $_tmp_query_parts[ 'where' ];
915 915
 
916
-				if ( empty( $filter['key'] ) && $search_condition->expressions ) {
917
-					$search_conditions[] = $search_condition;
916
+				if ( empty( $filter[ 'key' ] ) && $search_condition->expressions ) {
917
+					$search_conditions[ ] = $search_condition;
918 918
 				} else {
919 919
 					$left = $search_condition->left;
920 920
 					$alias = $query->_alias( $left->field_id, $left->source, $left->is_entry_column() ? 't' : 'm' );
@@ -924,7 +924,7 @@  discard block
 block discarded – undo
924 924
 							$on = $_join->join_on;
925 925
 							$join = $_join->join;
926 926
 
927
-							$search_conditions[] = GF_Query_Condition::_or(
927
+							$search_conditions[ ] = GF_Query_Condition::_or(
928 928
 								// Join
929 929
 								new GF_Query_Condition(
930 930
 									new GF_Query_Column( GF_Query_Column::META, $join->ID, $query->_alias( GF_Query_Column::META, $join->ID, 'm' ) ),
@@ -940,7 +940,7 @@  discard block
 block discarded – undo
940 940
 							);
941 941
 						}
942 942
 					} else {
943
-						$search_conditions[] = new GF_Query_Condition(
943
+						$search_conditions[ ] = new GF_Query_Condition(
944 944
 							new GF_Query_Column( $left->field_id, $left->source, $alias ),
945 945
 							$search_condition->operator,
946 946
 							$search_condition->right
@@ -962,7 +962,7 @@  discard block
 block discarded – undo
962 962
 		/**
963 963
 		 * Combine the parts as a new WHERE clause.
964 964
 		 */
965
-		$where = call_user_func_array( '\GF_Query_Condition::_and', array_merge( array( $query_parts['where'] ), $search_conditions, $extra_conditions ) );
965
+		$where = call_user_func_array( '\GF_Query_Condition::_and', array_merge( array( $query_parts[ 'where' ] ), $search_conditions, $extra_conditions ) );
966 966
 		$query->where( $where );
967 967
 	}
968 968
 
@@ -985,7 +985,7 @@  discard block
 block discarded – undo
985 985
 		$field_id = str_replace( 'filter_', '', $key );
986 986
 
987 987
 		// calculates field_id, removing 'filter_' and for '_' for advanced fields ( like name or checkbox )
988
-		if ( preg_match('/^[0-9_]+$/ism', $field_id ) ) {
988
+		if ( preg_match( '/^[0-9_]+$/ism', $field_id ) ) {
989 989
 			$field_id = str_replace( '_', '.', $field_id );
990 990
 		}
991 991
 
@@ -1042,7 +1042,7 @@  discard block
 block discarded – undo
1042 1042
 			// form is in searchable fields
1043 1043
 			$found = false;
1044 1044
 			foreach ( $searchable_fields as $field ) {
1045
-				if ( $field_id == $field['field'] && $form->ID == $field['form_id'] ) {
1045
+				if ( $field_id == $field[ 'field' ] && $form->ID == $field[ 'form_id' ] ) {
1046 1046
 					$found = true;
1047 1047
 					break;
1048 1048
 				}
@@ -1082,7 +1082,7 @@  discard block
 block discarded – undo
1082 1082
 
1083 1083
 			case 'select':
1084 1084
 			case 'radio':
1085
-				$filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1085
+				$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1086 1086
 				break;
1087 1087
 
1088 1088
 			case 'post_category':
@@ -1096,7 +1096,7 @@  discard block
 block discarded – undo
1096 1096
 
1097 1097
 				foreach ( $value as $val ) {
1098 1098
 					$cat = get_term( $val, 'category' );
1099
-					$filter[] = array(
1099
+					$filter[ ] = array(
1100 1100
 						'key'      => $field_id,
1101 1101
 						'value'    => esc_attr( $cat->name ) . ':' . $val,
1102 1102
 						'operator' => $this->get_operator( $get, $key, array( 'is' ), 'is' ),
@@ -1115,7 +1115,7 @@  discard block
 block discarded – undo
1115 1115
 				$filter = array();
1116 1116
 
1117 1117
 				foreach ( $value as $val ) {
1118
-					$filter[] = array( 'key' => $field_id, 'value' => $val );
1118
+					$filter[ ] = array( 'key' => $field_id, 'value' => $val );
1119 1119
 				}
1120 1120
 
1121 1121
 				break;
@@ -1124,9 +1124,9 @@  discard block
 block discarded – undo
1124 1124
 				// convert checkbox on/off into the correct search filter
1125 1125
 				if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field->inputs ) && ! empty( $form_field->choices ) ) {
1126 1126
 					foreach ( $form_field->inputs as $k => $input ) {
1127
-						if ( $input['id'] == $field_id ) {
1128
-							$filter['value'] = $form_field->choices[ $k ]['value'];
1129
-							$filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1127
+						if ( $input[ 'id' ] == $field_id ) {
1128
+							$filter[ 'value' ] = $form_field->choices[ $k ][ 'value' ];
1129
+							$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1130 1130
 							break;
1131 1131
 						}
1132 1132
 					}
@@ -1136,7 +1136,7 @@  discard block
 block discarded – undo
1136 1136
 					$filter = array();
1137 1137
 
1138 1138
 					foreach ( $value as $val ) {
1139
-						$filter[] = array(
1139
+						$filter[ ] = array(
1140 1140
 							'key'      => $field_id,
1141 1141
 							'value'    => $val,
1142 1142
 							'operator' => $this->get_operator( $get, $key, array( 'is' ), 'is' ),
@@ -1157,9 +1157,9 @@  discard block
 block discarded – undo
1157 1157
 					foreach ( $words as $word ) {
1158 1158
 						if ( ! empty( $word ) && strlen( $word ) > 1 ) {
1159 1159
 							// Keep the same key for each filter
1160
-							$filter['value'] = $word;
1160
+							$filter[ 'value' ] = $word;
1161 1161
 							// Add a search for the value
1162
-							$filters[] = $filter;
1162
+							$filters[ ] = $filter;
1163 1163
 						}
1164 1164
 					}
1165 1165
 
@@ -1173,19 +1173,19 @@  discard block
 block discarded – undo
1173 1173
 
1174 1174
 					foreach ( $searchable_fields as $searchable_field ) {
1175 1175
 
1176
-						if( $form_field->ID !== $searchable_field['field'] ) {
1176
+						if ( $form_field->ID !== $searchable_field[ 'field' ] ) {
1177 1177
 							continue;
1178 1178
 						}
1179 1179
 
1180 1180
 						// Only exact-match dropdowns, not text search
1181
-						if( in_array( $searchable_field['input'], array( 'text', 'search' ), true ) ) {
1181
+						if ( in_array( $searchable_field[ 'input' ], array( 'text', 'search' ), true ) ) {
1182 1182
 							continue;
1183 1183
 						}
1184 1184
 
1185 1185
 						$input_id = gravityview_get_input_id_from_id( $form_field->ID );
1186 1186
 
1187 1187
 						if ( 4 === $input_id ) {
1188
-							$filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1188
+							$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1189 1189
 						};
1190 1190
 					}
1191 1191
 				}
@@ -1213,12 +1213,12 @@  discard block
 block discarded – undo
1213 1213
 						 * @since 1.16.3
1214 1214
 						 * Safeguard until GF implements '<=' operator
1215 1215
 						 */
1216
-						if( !GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) {
1216
+						if ( ! GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) {
1217 1217
 							$operator = '<';
1218 1218
 							$date = date( 'Y-m-d', strtotime( self::get_formatted_date( $date, 'Y-m-d', $date_format ) . ' +1 day' ) );
1219 1219
 						}
1220 1220
 
1221
-						$filter[] = array(
1221
+						$filter[ ] = array(
1222 1222
 							'key'      => $field_id,
1223 1223
 							'value'    => self::get_formatted_date( $date, 'Y-m-d', $date_format ),
1224 1224
 							'operator' => $this->get_operator( $get, $key, array( $operator ), $operator ),
@@ -1226,12 +1226,12 @@  discard block
 block discarded – undo
1226 1226
 					}
1227 1227
 				} else {
1228 1228
 					$date = $value;
1229
-					$filter['value'] = self::get_formatted_date( $date, 'Y-m-d', $date_format );
1230
-					$filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1229
+					$filter[ 'value' ] = self::get_formatted_date( $date, 'Y-m-d', $date_format );
1230
+					$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1231 1231
 				}
1232 1232
 
1233
-				if ('payment_date' === $key) {
1234
-					$filter['operator'] = 'contains';
1233
+				if ( 'payment_date' === $key ) {
1234
+					$filter[ 'operator' ] = 'contains';
1235 1235
 				}
1236 1236
 
1237 1237
 				break;
@@ -1260,7 +1260,7 @@  discard block
 block discarded – undo
1260 1260
 			'ymd_dot' => 'Y.m.d',
1261 1261
 		);
1262 1262
 
1263
-		if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){
1263
+		if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) {
1264 1264
 			$format = $datepicker[ $field->dateFormat ];
1265 1265
 		}
1266 1266
 
@@ -1297,7 +1297,7 @@  discard block
 block discarded – undo
1297 1297
 	public function add_template_path( $file_paths ) {
1298 1298
 
1299 1299
 		// Index 100 is the default GravityView template path.
1300
-		$file_paths[102] = self::$file . 'templates/';
1300
+		$file_paths[ 102 ] = self::$file . 'templates/';
1301 1301
 
1302 1302
 		return $file_paths;
1303 1303
 	}
@@ -1316,7 +1316,7 @@  discard block
 block discarded – undo
1316 1316
 		$has_date = false;
1317 1317
 
1318 1318
 		foreach ( $search_fields as $k => $field ) {
1319
-			if ( in_array( $field['input'], array( 'date', 'date_range', 'entry_date' ) ) ) {
1319
+			if ( in_array( $field[ 'input' ], array( 'date', 'date_range', 'entry_date' ) ) ) {
1320 1320
 				$has_date = true;
1321 1321
 				break;
1322 1322
 			}
@@ -1345,7 +1345,7 @@  discard block
 block discarded – undo
1345 1345
 		$view = \GV\View::by_id( $gravityview_view->view_id );
1346 1346
 
1347 1347
 		// get configured search fields
1348
-		$search_fields = ! empty( $widget_args['search_fields'] ) ? json_decode( $widget_args['search_fields'], true ) : '';
1348
+		$search_fields = ! empty( $widget_args[ 'search_fields' ] ) ? json_decode( $widget_args[ 'search_fields' ], true ) : '';
1349 1349
 
1350 1350
 		if ( empty( $search_fields ) || ! is_array( $search_fields ) ) {
1351 1351
 			gravityview()->log->debug( 'No search fields configured for widget:', array( 'data' => $widget_args ) );
@@ -1359,40 +1359,40 @@  discard block
 block discarded – undo
1359 1359
 
1360 1360
 			$updated_field = $this->get_search_filter_details( $updated_field, $context );
1361 1361
 
1362
-			switch ( $field['field'] ) {
1362
+			switch ( $field[ 'field' ] ) {
1363 1363
 
1364 1364
 				case 'search_all':
1365
-					$updated_field['key'] = 'search_all';
1366
-					$updated_field['input'] = 'search_all';
1367
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_search' );
1365
+					$updated_field[ 'key' ] = 'search_all';
1366
+					$updated_field[ 'input' ] = 'search_all';
1367
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_search' );
1368 1368
 					break;
1369 1369
 
1370 1370
 				case 'entry_date':
1371
-					$updated_field['key'] = 'entry_date';
1372
-					$updated_field['input'] = 'entry_date';
1373
-					$updated_field['value'] = array(
1371
+					$updated_field[ 'key' ] = 'entry_date';
1372
+					$updated_field[ 'input' ] = 'entry_date';
1373
+					$updated_field[ 'value' ] = array(
1374 1374
 						'start' => $this->rgget_or_rgpost( 'gv_start' ),
1375 1375
 						'end' => $this->rgget_or_rgpost( 'gv_end' ),
1376 1376
 					);
1377 1377
 					break;
1378 1378
 
1379 1379
 				case 'entry_id':
1380
-					$updated_field['key'] = 'entry_id';
1381
-					$updated_field['input'] = 'entry_id';
1382
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_id' );
1380
+					$updated_field[ 'key' ] = 'entry_id';
1381
+					$updated_field[ 'input' ] = 'entry_id';
1382
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_id' );
1383 1383
 					break;
1384 1384
 
1385 1385
 				case 'created_by':
1386
-					$updated_field['key'] = 'created_by';
1387
-					$updated_field['name'] = 'gv_by';
1388
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_by' );
1389
-					$updated_field['choices'] = self::get_created_by_choices( $view );
1386
+					$updated_field[ 'key' ] = 'created_by';
1387
+					$updated_field[ 'name' ] = 'gv_by';
1388
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_by' );
1389
+					$updated_field[ 'choices' ] = self::get_created_by_choices( $view );
1390 1390
 					break;
1391 1391
 
1392 1392
 				case 'is_approved':
1393
-					$updated_field['key'] = 'is_approved';
1394
-					$updated_field['value'] = $this->rgget_or_rgpost( 'filter_is_approved' );
1395
-					$updated_field['choices'] = self::get_is_approved_choices();
1393
+					$updated_field[ 'key' ] = 'is_approved';
1394
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'filter_is_approved' );
1395
+					$updated_field[ 'choices' ] = self::get_is_approved_choices();
1396 1396
 					break;
1397 1397
 			}
1398 1398
 
@@ -1413,16 +1413,16 @@  discard block
 block discarded – undo
1413 1413
 
1414 1414
 		$gravityview_view->permalink_fields = $this->add_no_permalink_fields( array(), $this, $widget_args );
1415 1415
 
1416
-		$gravityview_view->search_layout = ! empty( $widget_args['search_layout'] ) ? $widget_args['search_layout'] : 'horizontal';
1416
+		$gravityview_view->search_layout = ! empty( $widget_args[ 'search_layout' ] ) ? $widget_args[ 'search_layout' ] : 'horizontal';
1417 1417
 
1418 1418
 		/** @since 1.14 */
1419
-		$gravityview_view->search_mode = ! empty( $widget_args['search_mode'] ) ? $widget_args['search_mode'] : 'any';
1419
+		$gravityview_view->search_mode = ! empty( $widget_args[ 'search_mode' ] ) ? $widget_args[ 'search_mode' ] : 'any';
1420 1420
 
1421
-		$custom_class = ! empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : '';
1421
+		$custom_class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : '';
1422 1422
 
1423 1423
 		$gravityview_view->search_class = self::get_search_class( $custom_class );
1424 1424
 
1425
-		$gravityview_view->search_clear = ! empty( $widget_args['search_clear'] ) ? $widget_args['search_clear'] : false;
1425
+		$gravityview_view->search_clear = ! empty( $widget_args[ 'search_clear' ] ) ? $widget_args[ 'search_clear' ] : false;
1426 1426
 
1427 1427
 		if ( $this->has_date_field( $search_fields ) ) {
1428 1428
 			// enqueue datepicker stuff only if needed!
@@ -1444,10 +1444,10 @@  discard block
 block discarded – undo
1444 1444
 	public static function get_search_class( $custom_class = '' ) {
1445 1445
 		$gravityview_view = GravityView_View::getInstance();
1446 1446
 
1447
-		$search_class = 'gv-search-'.$gravityview_view->search_layout;
1447
+		$search_class = 'gv-search-' . $gravityview_view->search_layout;
1448 1448
 
1449
-		if ( ! empty( $custom_class )  ) {
1450
-			$search_class .= ' '.$custom_class;
1449
+		if ( ! empty( $custom_class ) ) {
1450
+			$search_class .= ' ' . $custom_class;
1451 1451
 		}
1452 1452
 
1453 1453
 		/**
@@ -1498,9 +1498,9 @@  discard block
 block discarded – undo
1498 1498
 
1499 1499
 		if ( ! $label ) {
1500 1500
 
1501
-			$label = isset( $form_field['label'] ) ? $form_field['label'] : '';
1501
+			$label = isset( $form_field[ 'label' ] ) ? $form_field[ 'label' ] : '';
1502 1502
 
1503
-			switch( $field['field'] ) {
1503
+			switch ( $field[ 'field' ] ) {
1504 1504
 				case 'search_all':
1505 1505
 					$label = __( 'Search Entries:', 'gravityview' );
1506 1506
 					break;
@@ -1512,10 +1512,10 @@  discard block
 block discarded – undo
1512 1512
 					break;
1513 1513
 				default:
1514 1514
 					// If this is a field input, not a field
1515
-					if ( strpos( $field['field'], '.' ) > 0 && ! empty( $form_field['inputs'] ) ) {
1515
+					if ( strpos( $field[ 'field' ], '.' ) > 0 && ! empty( $form_field[ 'inputs' ] ) ) {
1516 1516
 
1517 1517
 						// Get the label for the field in question, which returns an array
1518
-						$items = wp_list_filter( $form_field['inputs'], array( 'id' => $field['field'] ) );
1518
+						$items = wp_list_filter( $form_field[ 'inputs' ], array( 'id' => $field[ 'field' ] ) );
1519 1519
 
1520 1520
 						// Get the item with the `label` key
1521 1521
 						$values = wp_list_pluck( $items, 'label' );
@@ -1556,13 +1556,13 @@  discard block
 block discarded – undo
1556 1556
 		$form = $gravityview_view->getForm();
1557 1557
 
1558 1558
 		// for advanced field ids (eg, first name / last name )
1559
-		$name = 'filter_' . str_replace( '.', '_', $field['field'] );
1559
+		$name = 'filter_' . str_replace( '.', '_', $field[ 'field' ] );
1560 1560
 
1561 1561
 		// get searched value from $_GET/$_POST (string or array)
1562 1562
 		$value = $this->rgget_or_rgpost( $name );
1563 1563
 
1564 1564
 		// get form field details
1565
-		$form_field = gravityview_get_field( $form, $field['field'] );
1565
+		$form_field = gravityview_get_field( $form, $field[ 'field' ] );
1566 1566
 
1567 1567
 		$form_field_type = \GV\Utils::get( $form_field, 'type' );
1568 1568
 
@@ -1576,17 +1576,17 @@  discard block
 block discarded – undo
1576 1576
 		);
1577 1577
 
1578 1578
 		// collect choices
1579
-		if ( 'post_category' === $form_field_type && ! empty( $form_field['displayAllCategories'] ) && empty( $form_field['choices'] ) ) {
1580
-			$filter['choices'] = gravityview_get_terms_choices();
1581
-		} elseif ( ! empty( $form_field['choices'] ) ) {
1582
-			$filter['choices'] = $form_field['choices'];
1579
+		if ( 'post_category' === $form_field_type && ! empty( $form_field[ 'displayAllCategories' ] ) && empty( $form_field[ 'choices' ] ) ) {
1580
+			$filter[ 'choices' ] = gravityview_get_terms_choices();
1581
+		} elseif ( ! empty( $form_field[ 'choices' ] ) ) {
1582
+			$filter[ 'choices' ] = $form_field[ 'choices' ];
1583 1583
 		}
1584 1584
 
1585
-		if ( 'date_range' === $field['input'] && empty( $value ) ) {
1586
-			$filter['value'] = array( 'start' => '', 'end' => '' );
1585
+		if ( 'date_range' === $field[ 'input' ] && empty( $value ) ) {
1586
+			$filter[ 'value' ] = array( 'start' => '', 'end' => '' );
1587 1587
 		}
1588 1588
 
1589
-		if ( ! empty( $filter['choices'] ) ) {
1589
+		if ( ! empty( $filter[ 'choices' ] ) ) {
1590 1590
 			/**
1591 1591
 			 * @filter `gravityview/search/sieve_choices` Only output used choices for this field.
1592 1592
 			 * @param[in,out] bool Yes or no.
@@ -1594,7 +1594,7 @@  discard block
 block discarded – undo
1594 1594
 			 * @param \GV\Context The context.
1595 1595
 			 */
1596 1596
 			if ( apply_filters( 'gravityview/search/sieve_choices', false, $field, $context ) ) {
1597
-				$filter['choices'] = $this->sieve_filter_choices( $filter, $context );
1597
+				$filter[ 'choices' ] = $this->sieve_filter_choices( $filter, $context );
1598 1598
 			}
1599 1599
 		}
1600 1600
 
@@ -1623,11 +1623,11 @@  discard block
 block discarded – undo
1623 1623
 	 * @return array The filter choices.
1624 1624
 	 */
1625 1625
 	private function sieve_filter_choices( $filter, $context ) {
1626
-		if ( empty( $filter['key'] ) || empty( $filter['choices'] ) ) {
1626
+		if ( empty( $filter[ 'key' ] ) || empty( $filter[ 'choices' ] ) ) {
1627 1627
 			return $filter; // @todo Populate plugins might give us empty choices
1628 1628
 		}
1629 1629
 
1630
-		if ( ! is_numeric( $filter['key'] ) ) {
1630
+		if ( ! is_numeric( $filter[ 'key' ] ) ) {
1631 1631
 			return $filter;
1632 1632
 		}
1633 1633
 
@@ -1637,29 +1637,29 @@  discard block
 block discarded – undo
1637 1637
 
1638 1638
 		$table = GFFormsModel::get_entry_meta_table_name();
1639 1639
 
1640
-		$key_like = $wpdb->esc_like( $filter['key'] ) . '.%';
1640
+		$key_like = $wpdb->esc_like( $filter[ 'key' ] ) . '.%';
1641 1641
 
1642 1642
 		switch ( \GV\Utils::get( $filter, 'type' ) ):
1643 1643
 			case 'post_category':
1644 1644
 				$choices = $wpdb->get_col( $wpdb->prepare(
1645 1645
 					"SELECT DISTINCT SUBSTRING_INDEX(meta_value, ':', 1) FROM $table WHERE (meta_key LIKE %s OR meta_key = %d) AND form_id = %d",
1646
-					$key_like, $filter['key'], $form_id
1646
+					$key_like, $filter[ 'key' ], $form_id
1647 1647
 				) );
1648 1648
 				break;
1649 1649
 			default:
1650 1650
 				$choices = $wpdb->get_col( $wpdb->prepare(
1651 1651
 					"SELECT DISTINCT meta_value FROM $table WHERE (meta_key LIKE %s OR meta_key = %d) AND form_id = %d",
1652
-					$key_like, $filter['key'], $form_id
1652
+					$key_like, $filter[ 'key' ], $form_id
1653 1653
 				) );
1654 1654
 
1655
-				if ( ( $field = gravityview_get_field( $form_id, $filter['key'] ) ) && 'json' === $field->storageType ) {
1655
+				if ( ( $field = gravityview_get_field( $form_id, $filter[ 'key' ] ) ) && 'json' === $field->storageType ) {
1656 1656
 					$choices = array_map( 'json_decode', $choices );
1657 1657
 					$_choices_array = array();
1658 1658
 					foreach ( $choices as $choice ) {
1659 1659
 						if ( is_array( $choice ) ) {
1660 1660
 							$_choices_array = array_merge( $_choices_array, $choice );
1661 1661
 						} else {
1662
-							$_choices_array []= $choice;
1662
+							$_choices_array [ ] = $choice;
1663 1663
 						}
1664 1664
 					}
1665 1665
 					$choices = array_unique( $_choices_array );
@@ -1669,9 +1669,9 @@  discard block
 block discarded – undo
1669 1669
 		endswitch;
1670 1670
 
1671 1671
 		$filter_choices = array();
1672
-		foreach ( $filter['choices'] as $choice ) {
1673
-			if ( in_array( $choice['text'], $choices, true ) || in_array( $choice['value'], $choices, true ) ) {
1674
-				$filter_choices[] = $choice;
1672
+		foreach ( $filter[ 'choices' ] as $choice ) {
1673
+			if ( in_array( $choice[ 'text' ], $choices, true ) || in_array( $choice[ 'value' ], $choices, true ) ) {
1674
+				$filter_choices[ ] = $choice;
1675 1675
 			}
1676 1676
 		}
1677 1677
 
@@ -1706,7 +1706,7 @@  discard block
 block discarded – undo
1706 1706
 			 * @param \GV\View $view The view.
1707 1707
 			 */
1708 1708
 			$text = apply_filters( 'gravityview/search/created_by/text', $user->display_name, $user, $view );
1709
-			$choices[] = array(
1709
+			$choices[ ] = array(
1710 1710
 				'value' => $user->ID,
1711 1711
 				'text' => $text,
1712 1712
 			);
@@ -1726,9 +1726,9 @@  discard block
 block discarded – undo
1726 1726
 
1727 1727
 		$choices = array();
1728 1728
 		foreach ( GravityView_Entry_Approval_Status::get_all() as $status ) {
1729
-			$choices[] = array(
1730
-				'value' => $status['value'],
1731
-				'text' => $status['label'],
1729
+			$choices[ ] = array(
1730
+				'value' => $status[ 'value' ],
1731
+				'text' => $status[ 'label' ],
1732 1732
 			);
1733 1733
 		}
1734 1734
 
@@ -1780,7 +1780,7 @@  discard block
 block discarded – undo
1780 1780
 	 */
1781 1781
 	public function add_datepicker_js_dependency( $js_dependencies ) {
1782 1782
 
1783
-		$js_dependencies[] = 'jquery-ui-datepicker';
1783
+		$js_dependencies[ ] = 'jquery-ui-datepicker';
1784 1784
 
1785 1785
 		return $js_dependencies;
1786 1786
 	}
@@ -1824,7 +1824,7 @@  discard block
 block discarded – undo
1824 1824
 			'isRTL'             => is_rtl(),
1825 1825
 		), $view_data );
1826 1826
 
1827
-		$localizations['datepicker'] = $datepicker_settings;
1827
+		$localizations[ 'datepicker' ] = $datepicker_settings;
1828 1828
 
1829 1829
 		return $localizations;
1830 1830
 
@@ -1851,7 +1851,7 @@  discard block
 block discarded – undo
1851 1851
 	 * @return void
1852 1852
 	 */
1853 1853
 	private function maybe_enqueue_flexibility() {
1854
-		if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/MSIE [8-9]/', $_SERVER['HTTP_USER_AGENT'] ) ) {
1854
+		if ( isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) && preg_match( '/MSIE [8-9]/', $_SERVER[ 'HTTP_USER_AGENT' ] ) ) {
1855 1855
 			wp_enqueue_script( 'gv-flexibility' );
1856 1856
 		}
1857 1857
 	}
@@ -1873,7 +1873,7 @@  discard block
 block discarded – undo
1873 1873
 		add_filter( 'gravityview_js_localization', array( $this, 'add_datepicker_localization' ), 10, 2 );
1874 1874
 
1875 1875
 		$scheme = is_ssl() ? 'https://' : 'http://';
1876
-		wp_enqueue_style( 'jquery-ui-datepicker', $scheme.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' );
1876
+		wp_enqueue_style( 'jquery-ui-datepicker', $scheme . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' );
1877 1877
 
1878 1878
 		/**
1879 1879
 		 * @filter `gravityview_search_datepicker_class`
@@ -1952,7 +1952,7 @@  discard block
 block discarded – undo
1952 1952
 	public function add_preview_inputs() {
1953 1953
 		global $wp;
1954 1954
 
1955
-		if ( ! is_preview() || ! current_user_can( 'publish_gravityviews') ) {
1955
+		if ( ! is_preview() || ! current_user_can( 'publish_gravityviews' ) ) {
1956 1956
 			return;
1957 1957
 		}
1958 1958
 
@@ -2004,7 +2004,7 @@  discard block
 block discarded – undo
2004 2004
  */
2005 2005
 class GravityView_Widget_Search_Author_GF_Query_Condition extends \GF_Query_Condition {
2006 2006
 	public function __construct( $filter, $view ) {
2007
-		$this->value = $filter['value'];
2007
+		$this->value = $filter[ 'value' ];
2008 2008
 		$this->view = $view;
2009 2009
 	}
2010 2010
 
@@ -2036,11 +2036,11 @@  discard block
 block discarded – undo
2036 2036
 		$conditions = array();
2037 2037
 
2038 2038
 		foreach ( $user_fields as $user_field ) {
2039
-			$conditions[] = $wpdb->prepare( "`u`.`$user_field` LIKE %s", '%' . $wpdb->esc_like( $this->value ) .  '%' );
2039
+			$conditions[ ] = $wpdb->prepare( "`u`.`$user_field` LIKE %s", '%' . $wpdb->esc_like( $this->value ) . '%' );
2040 2040
 		}
2041 2041
 
2042 2042
 		foreach ( $user_meta_fields as $meta_field ) {
2043
-			$conditions[] = $wpdb->prepare( "(`um`.`meta_key` = %s AND `um`.`meta_value` LIKE %s)", $meta_field, '%' . $wpdb->esc_like( $this->value ) .  '%' );
2043
+			$conditions[ ] = $wpdb->prepare( "(`um`.`meta_key` = %s AND `um`.`meta_value` LIKE %s)", $meta_field, '%' . $wpdb->esc_like( $this->value ) . '%' );
2044 2044
 		}
2045 2045
 
2046 2046
 		$conditions = '(' . implode( ' OR ', $conditions ) . ')';
Please login to merge, or discard this patch.