Completed
Push — develop ( 1d02d7...3ab570 )
by Zack
10:35
created
future/lib/class-gamajo-template-loader.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 		public function set_template_data( array $data, $var_name = 'data' ) {
118 118
 			global $wp_query;
119 119
 
120
-			$wp_query->query_vars[ $var_name ] = (object) $data;
120
+			$wp_query->query_vars[ $var_name ] = (object)$data;
121 121
 		}
122 122
 
123 123
 		/**
@@ -130,8 +130,8 @@  discard block
 block discarded – undo
130 130
 		public function unset_template_data() {
131 131
 			global $wp_query;
132 132
 
133
-			if ( isset( $wp_query->query_vars['data'] ) ) {
134
-				unset( $wp_query->query_vars['data'] );
133
+			if ( isset( $wp_query->query_vars[ 'data' ] ) ) {
134
+				unset( $wp_query->query_vars[ 'data' ] );
135 135
 			}
136 136
 		}
137 137
 
@@ -148,9 +148,9 @@  discard block
 block discarded – undo
148 148
 		protected function get_template_file_names( $slug, $name ) {
149 149
 			$templates = array();
150 150
 			if ( isset( $name ) ) {
151
-				$templates[] = $slug . '-' . $name . '.php';
151
+				$templates[ ] = $slug . '-' . $name . '.php';
152 152
 			}
153
-			$templates[] = $slug . '.php';
153
+			$templates[ ] = $slug . '.php';
154 154
 
155 155
 			/**
156 156
 			 * Allow template choices to be filtered.
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 			$located = false;
189 189
 
190 190
 			// Remove empty entries.
191
-			$template_names = array_filter( (array) $template_names );
191
+			$template_names = array_filter( (array)$template_names );
192 192
 			$template_paths = $this->get_template_paths();
193 193
 
194 194
 			// Try to find a template file.
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 
234 234
 			// Only add this conditionally, so non-child themes don't redundantly check active theme twice.
235 235
 			if ( is_child_theme() ) {
236
-				$file_paths[1] = trailingslashit( get_stylesheet_directory() ) . $theme_directory;
236
+				$file_paths[ 1 ] = trailingslashit( get_stylesheet_directory() ) . $theme_directory;
237 237
 			}
238 238
 
239 239
 			/**
Please login to merge, or discard this patch.
includes/class-cache.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 		/**
82 82
 		 * @see RGFormsModel::update_lead_property() Trigger when any entry property changes
83 83
 		 */
84
-		foreach( $this->lead_db_columns as $column ) {
84
+		foreach ( $this->lead_db_columns as $column ) {
85 85
 			add_action( 'gform_update_' . $column, array( $this, 'entry_status_changed' ), 10, 3 );
86 86
 		}
87 87
 
@@ -114,9 +114,9 @@  discard block
 block discarded – undo
114 114
 			return;
115 115
 		}
116 116
 
117
-		do_action( 'gravityview_log_debug', __METHOD__ . ' adding form ' . $entry['form_id'] . ' to blacklist because entry #' . $lead_id . ' was deleted', array( 'value' => $property_value, 'previous' => $previous_value ) );
117
+		do_action( 'gravityview_log_debug', __METHOD__ . ' adding form ' . $entry[ 'form_id' ] . ' to blacklist because entry #' . $lead_id . ' was deleted', array( 'value' => $property_value, 'previous' => $previous_value ) );
118 118
 
119
-		$this->blacklist_add( $entry['form_id'] );
119
+		$this->blacklist_add( $entry[ 'form_id' ] );
120 120
 	}
121 121
 
122 122
 	/**
@@ -129,9 +129,9 @@  discard block
 block discarded – undo
129 129
 	 */
130 130
 	public function entry_updated( $form, $lead_id ) {
131 131
 
132
-		do_action( 'gravityview_log_debug', 'GravityView_Cache[entry_updated] adding form ' . $form['id'] . ' to blacklist because entry #' . $lead_id . ' was updated' );
132
+		do_action( 'gravityview_log_debug', 'GravityView_Cache[entry_updated] adding form ' . $form[ 'id' ] . ' to blacklist because entry #' . $lead_id . ' was updated' );
133 133
 
134
-		$this->blacklist_add( $form['id'] );
134
+		$this->blacklist_add( $form[ 'id' ] );
135 135
 	}
136 136
 
137 137
 	/**
@@ -146,9 +146,9 @@  discard block
 block discarded – undo
146 146
 	 */
147 147
 	public function entry_created( $entry, $form ) {
148 148
 
149
-		do_action( 'gravityview_log_debug', 'GravityView_Cache[entry_created] adding form ' . $form['id'] . ' to blacklist because entry #' . $entry['id'] . ' was created' );
149
+		do_action( 'gravityview_log_debug', 'GravityView_Cache[entry_created] adding form ' . $form[ 'id' ] . ' to blacklist because entry #' . $entry[ 'id' ] . ' was created' );
150 150
 
151
-		$this->blacklist_add( $form['id'] );
151
+		$this->blacklist_add( $form[ 'id' ] );
152 152
 	}
153 153
 
154 154
 	/**
@@ -164,9 +164,9 @@  discard block
 block discarded – undo
164 164
 			return;
165 165
 		}
166 166
 
167
-		do_action( 'gravityview_log_debug', 'GravityView_Cache[entry_added] adding form ' . $form['id'] . ' to blacklist because entry #' . $entry['id'] . ' was added' );
167
+		do_action( 'gravityview_log_debug', 'GravityView_Cache[entry_added] adding form ' . $form[ 'id' ] . ' to blacklist because entry #' . $entry[ 'id' ] . ' was added' );
168 168
 
169
-		$this->blacklist_add( $form['id'] );
169
+		$this->blacklist_add( $form[ 'id' ] );
170 170
 	}
171 171
 
172 172
 	/**
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 		// Normally just one form, but supports multiple forms
186 186
 		//
187 187
 		// Array of IDs 12, 5, 14 would result in `f-12f-5f-14`
188
-		$forms = 'f:' . implode( '&f:', (array) $form_ids );
188
+		$forms = 'f:' . implode( '&f:', (array)$form_ids );
189 189
 
190 190
 		// Prefix for transient keys
191 191
 		// Now the prefix would be: `gv-cache-f-12f-5f-14`
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 		) );
243 243
 
244 244
 		// Add the passed form IDs
245
-		$blacklist = array_merge( (array) $blacklist, $form_ids );
245
+		$blacklist = array_merge( (array)$blacklist, $form_ids );
246 246
 
247 247
 		// Don't duplicate
248 248
 		$blacklist = array_unique( $blacklist );
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 
263 263
 		$blacklist = get_option( self::BLACKLIST_OPTION_NAME, array() );
264 264
 
265
-		$updated_list = array_diff( $blacklist, (array) $form_ids );
265
+		$updated_list = array_diff( $blacklist, (array)$form_ids );
266 266
 
267 267
 		do_action( 'gravityview_log_debug', 'GravityView_Cache[blacklist_remove] Removing form IDs from cache blacklist', array(
268 268
 			'$form_ids'     => $form_ids,
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 			return false;
296 296
 		}
297 297
 
298
-		foreach ( (array) $form_ids as $form_id ) {
298
+		foreach ( (array)$form_ids as $form_id ) {
299 299
 
300 300
 			if ( in_array( $form_id, $blacklist ) ) {
301 301
 
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
 			 * @filter `gravityview_cache_time_{$filter_name}` Modify the cache time for a type of cache
368 368
 			 * @param int $time_in_seconds Default: `DAY_IN_SECONDS`
369 369
 			 */
370
-			$cache_time = (int) apply_filters( 'gravityview_cache_time_' . $filter_name, DAY_IN_SECONDS );
370
+			$cache_time = (int)apply_filters( 'gravityview_cache_time_' . $filter_name, DAY_IN_SECONDS );
371 371
 
372 372
 			do_action( 'gravityview_log_debug', 'GravityView_Cache[set] Setting cache with transient key ' . $this->key . ' for ' . $cache_time . ' seconds' );
373 373
 
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 			return;
404 404
 		}
405 405
 
406
-		foreach ( (array) $form_ids as $form_id ) {
406
+		foreach ( (array)$form_ids as $form_id ) {
407 407
 
408 408
 			$key = $this->get_cache_key_prefix( $form_id );
409 409
 
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
 
518 518
 		if ( GVCommon::has_cap( 'edit_gravityviews' ) ) {
519 519
 
520
-			if ( isset( $_GET['cache'] ) || isset( $_GET['nocache'] ) ) {
520
+			if ( isset( $_GET[ 'cache' ] ) || isset( $_GET[ 'nocache' ] ) ) {
521 521
 
522 522
 				do_action( 'gravityview_log_debug', 'GravityView_Cache[use_cache] Not using cache: ?cache or ?nocache is in the URL' );
523 523
 
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
 		 */
547 547
 		$use_cache = apply_filters( 'gravityview_use_cache', $use_cache, $this );
548 548
 
549
-		return (boolean) $use_cache;
549
+		return (boolean)$use_cache;
550 550
 	}
551 551
 
552 552
 }
Please login to merge, or discard this patch.
includes/class-common.php 1 patch
Spacing   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 
127 127
 		$form = false;
128 128
 
129
-		if( $entry ) {
130
-			$form = GFAPI::get_form( $entry['form_id'] );
129
+		if ( $entry ) {
130
+			$form = GFAPI::get_form( $entry[ 'form_id' ] );
131 131
 		}
132 132
 
133 133
 		return $form;
@@ -193,12 +193,12 @@  discard block
 block discarded – undo
193 193
 
194 194
 			$has_transaction_data = rgar( $entry, $meta, false );
195 195
 
196
-			if( ! empty( $has_transaction_data ) ) {
196
+			if ( ! empty( $has_transaction_data ) ) {
197 197
 				break;
198 198
 			}
199 199
 		}
200 200
 
201
-		return (bool) $has_transaction_data;
201
+		return (bool)$has_transaction_data;
202 202
 	}
203 203
 
204 204
 	/**
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 
237 237
 		$results = GFAPI::get_entries( intval( $form_id ), $search_criteria, null, $paging );
238 238
 
239
-		$result = ( ! empty( $results ) && ! empty( $results[0]['id'] ) ) ? $results[0]['id'] : null;
239
+		$result = ( ! empty( $results ) && ! empty( $results[ 0 ][ 'id' ] ) ) ? $results[ 0 ][ 'id' ] : null;
240 240
 
241 241
 		return $result;
242 242
 	}
@@ -253,10 +253,10 @@  discard block
 block discarded – undo
253 253
 	 *
254 254
 	 * @return array Empty array if GFAPI class isn't available or no forms. Otherwise, the array of Forms
255 255
 	 */
256
-	public static function get_forms(  $active = true, $trash = false ) {
256
+	public static function get_forms( $active = true, $trash = false ) {
257 257
 		$forms = array();
258 258
 		if ( class_exists( 'GFAPI' ) ) {
259
-			if( 'any' === $active ) {
259
+			if ( 'any' === $active ) {
260 260
 				$active_forms = GFAPI::get_forms( true, $trash );
261 261
 				$inactive_forms = GFAPI::get_forms( false, $trash );
262 262
 				$forms = array_merge( array_filter( $active_forms ), array_filter( $inactive_forms ) );
@@ -287,9 +287,9 @@  discard block
 block discarded – undo
287 287
 		$has_post_fields = false;
288 288
 
289 289
 		if ( $form ) {
290
-			foreach ( $form['fields'] as $field ) {
291
-				if ( $include_parent_field || empty( $field['inputs'] ) ) {
292
-					$fields["{$field['id']}"] = array(
290
+			foreach ( $form[ 'fields' ] as $field ) {
291
+				if ( $include_parent_field || empty( $field[ 'inputs' ] ) ) {
292
+					$fields[ "{$field[ 'id' ]}" ] = array(
293 293
 						'label' => rgar( $field, 'label' ),
294 294
 						'parent' => null,
295 295
 						'type' => rgar( $field, 'type' ),
@@ -298,10 +298,10 @@  discard block
 block discarded – undo
298 298
 					);
299 299
 				}
300 300
 
301
-				if ( $add_default_properties && ! empty( $field['inputs'] ) ) {
302
-					foreach ( $field['inputs'] as $input ) {
301
+				if ( $add_default_properties && ! empty( $field[ 'inputs' ] ) ) {
302
+					foreach ( $field[ 'inputs' ] as $input ) {
303 303
 
304
-						if( ! empty( $input['isHidden'] ) ) {
304
+						if ( ! empty( $input[ 'isHidden' ] ) ) {
305 305
 							continue;
306 306
 						}
307 307
 
@@ -309,10 +309,10 @@  discard block
 block discarded – undo
309 309
                          * @hack
310 310
                          * In case of email/email confirmation, the input for email has the same id as the parent field
311 311
                          */
312
-						if( 'email' === $field['type'] && false === strpos( $input['id'], '.' ) ) {
312
+						if ( 'email' === $field[ 'type' ] && false === strpos( $input[ 'id' ], '.' ) ) {
313 313
                             continue;
314 314
                         }
315
-						$fields["{$input['id']}"] = array(
315
+						$fields[ "{$input[ 'id' ]}" ] = array(
316 316
 							'label' => rgar( $input, 'label' ),
317 317
 							'customLabel' => rgar( $input, 'customLabel' ),
318 318
 							'parent' => $field,
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 				}
325 325
 
326 326
 
327
-				if( GFCommon::is_product_field( $field['type'] ) ){
327
+				if ( GFCommon::is_product_field( $field[ 'type' ] ) ) {
328 328
 					$has_product_fields = true;
329 329
 				}
330 330
 
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 		 * @since 1.7
339 339
 		 */
340 340
 		if ( $has_post_fields ) {
341
-			$fields['post_id'] = array(
341
+			$fields[ 'post_id' ] = array(
342 342
 				'label' => __( 'Post ID', 'gravityview' ),
343 343
 				'type' => 'post_id',
344 344
 			);
@@ -351,11 +351,11 @@  discard block
 block discarded – undo
351 351
 			foreach ( $payment_fields as $payment_field ) {
352 352
 
353 353
 				// Either the field exists ($fields['shipping']) or the form explicitly contains a `shipping` field with numeric key
354
-				if( isset( $fields["{$payment_field->name}"] ) || GFCommon::get_fields_by_type( $form, $payment_field->name ) ) {
354
+				if ( isset( $fields[ "{$payment_field->name}" ] ) || GFCommon::get_fields_by_type( $form, $payment_field->name ) ) {
355 355
 					continue;
356 356
 				}
357 357
 
358
-				$fields["{$payment_field->name}"] = array(
358
+				$fields[ "{$payment_field->name}" ] = array(
359 359
 					'label' => $payment_field->label,
360 360
 					'desc' => $payment_field->description,
361 361
 					'type' => $payment_field->name,
@@ -387,9 +387,9 @@  discard block
 block discarded – undo
387 387
 
388 388
 		$fields = array();
389 389
 
390
-		foreach ( $extra_fields as $key => $field ){
391
-			if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) {
392
-				$fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' );
390
+		foreach ( $extra_fields as $key => $field ) {
391
+			if ( ! empty( $only_default_column ) && ! empty( $field[ 'is_default_column' ] ) ) {
392
+				$fields[ $key ] = array( 'label' => $field[ 'label' ], 'type' => 'entry_meta' );
393 393
 			}
394 394
 		}
395 395
 
@@ -429,32 +429,32 @@  discard block
 block discarded – undo
429 429
 			'search_criteria' => null,
430 430
 			'sorting' => null,
431 431
 			'paging' => null,
432
-			'cache' => (isset( $passed_criteria['cache'] ) ? (bool) $passed_criteria['cache'] : true),
432
+			'cache' => ( isset( $passed_criteria[ 'cache' ] ) ? (bool)$passed_criteria[ 'cache' ] : true ),
433 433
 		);
434 434
 
435 435
 		$criteria = wp_parse_args( $passed_criteria, $search_criteria_defaults );
436 436
 
437
-		if ( ! empty( $criteria['search_criteria']['field_filters'] ) ) {
438
-			foreach ( $criteria['search_criteria']['field_filters'] as &$filter ) {
437
+		if ( ! empty( $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) {
438
+			foreach ( $criteria[ 'search_criteria' ][ 'field_filters' ] as &$filter ) {
439 439
 
440 440
 				if ( ! is_array( $filter ) ) {
441 441
 					continue;
442 442
 				}
443 443
 
444 444
 				// By default, we want searches to be wildcard for each field.
445
-				$filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator'];
445
+				$filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ];
446 446
 
447 447
 				/**
448 448
 				 * @filter `gravityview_search_operator` Modify the search operator for the field (contains, is, isnot, etc)
449 449
 				 * @param string $operator Existing search operator
450 450
 				 * @param array $filter array with `key`, `value`, `operator`, `type` keys
451 451
 				 */
452
-				$filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter );
452
+				$filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter );
453 453
 			}
454 454
 
455 455
 			// don't send just the [mode] without any field filter.
456
-			if( count( $criteria['search_criteria']['field_filters'] ) === 1 && array_key_exists( 'mode' , $criteria['search_criteria']['field_filters'] ) ) {
457
-				unset( $criteria['search_criteria']['field_filters']['mode'] );
456
+			if ( count( $criteria[ 'search_criteria' ][ 'field_filters' ] ) === 1 && array_key_exists( 'mode', $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) {
457
+				unset( $criteria[ 'search_criteria' ][ 'field_filters' ][ 'mode' ] );
458 458
 			}
459 459
 
460 460
 		}
@@ -465,21 +465,21 @@  discard block
 block discarded – undo
465 465
 		 * Prepare date formats to be in Gravity Forms DB format;
466 466
 		 * $passed_criteria may include date formats incompatible with Gravity Forms.
467 467
 		 */
468
-		foreach ( array('start_date', 'end_date' ) as $key ) {
468
+		foreach ( array( 'start_date', 'end_date' ) as $key ) {
469 469
 
470
-			if ( ! empty( $criteria['search_criteria'][ $key ] ) ) {
470
+			if ( ! empty( $criteria[ 'search_criteria' ][ $key ] ) ) {
471 471
 
472 472
 				// Use date_create instead of new DateTime so it returns false if invalid date format.
473
-				$date = date_create( $criteria['search_criteria'][ $key ] );
473
+				$date = date_create( $criteria[ 'search_criteria' ][ $key ] );
474 474
 
475 475
 				if ( $date ) {
476 476
 					// Gravity Forms wants dates in the `Y-m-d H:i:s` format.
477
-					$criteria['search_criteria'][ $key ] = $date->format( 'Y-m-d H:i:s' );
477
+					$criteria[ 'search_criteria' ][ $key ] = $date->format( 'Y-m-d H:i:s' );
478 478
 				} else {
479
-					do_action( 'gravityview_log_error', '[filter_get_entries_criteria] '.$key.' Date format not valid:', $criteria['search_criteria'][ $key ] );
479
+					do_action( 'gravityview_log_error', '[filter_get_entries_criteria] ' . $key . ' Date format not valid:', $criteria[ 'search_criteria' ][ $key ] );
480 480
 
481 481
 					// If it's an invalid date, unset it. Gravity Forms freaks out otherwise.
482
-					unset( $criteria['search_criteria'][ $key ] );
482
+					unset( $criteria[ 'search_criteria' ][ $key ] );
483 483
 				}
484 484
 			}
485 485
 		}
@@ -498,14 +498,14 @@  discard block
 block discarded – undo
498 498
 
499 499
 		// Calculate the context view id and send it to the advanced filter
500 500
 		if ( GravityView_frontend::getInstance()->getSingleEntry() ) {
501
-			$criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id();
501
+			$criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id();
502 502
 		} elseif ( $multiple_original ) {
503
-			$criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id();
503
+			$criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id();
504 504
 		} elseif ( 'delete' === GFForms::get( 'action' ) ) {
505
-			$criteria['context_view_id'] = isset( $_GET['view_id'] ) ? intval( $_GET['view_id'] ) : null;
506
-		} elseif( !isset( $criteria['context_view_id'] ) ) {
505
+			$criteria[ 'context_view_id' ] = isset( $_GET[ 'view_id' ] ) ? intval( $_GET[ 'view_id' ] ) : null;
506
+		} elseif ( ! isset( $criteria[ 'context_view_id' ] ) ) {
507 507
             // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget)
508
-			$criteria['context_view_id'] = null;
508
+			$criteria[ 'context_view_id' ] = null;
509 509
 		}
510 510
 
511 511
 		/**
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
 		 * @param array $form_ids Forms to search
515 515
 		 * @param int $view_id ID of the view being used to search
516 516
 		 */
517
-		$criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria['context_view_id'] );
517
+		$criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria[ 'context_view_id' ] );
518 518
 
519 519
 		return (array)$criteria;
520 520
 	}
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
 		/** Reduce # of database calls */
545 545
 		add_filter( 'gform_is_encrypted_field', '__return_false' );
546 546
 
547
-		if ( ! empty( $criteria['cache'] ) ) {
547
+		if ( ! empty( $criteria[ 'cache' ] ) ) {
548 548
 
549 549
 			$Cache = new GravityView_Cache( $form_ids, $criteria );
550 550
 
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
 
553 553
 				// Still update the total count when using cached results
554 554
 				if ( ! is_null( $total ) ) {
555
-					$total = GFAPI::count_entries( $form_ids, $criteria['search_criteria'] );
555
+					$total = GFAPI::count_entries( $form_ids, $criteria[ 'search_criteria' ] );
556 556
 				}
557 557
 
558 558
 				$return = $entries;
@@ -572,9 +572,9 @@  discard block
 block discarded – undo
572 572
 			$entries = apply_filters( 'gravityview_before_get_entries', null, $criteria, $passed_criteria, $total );
573 573
 
574 574
 			// No entries returned from gravityview_before_get_entries
575
-			if( is_null( $entries ) ) {
575
+			if ( is_null( $entries ) ) {
576 576
 
577
-				$entries = GFAPI::get_entries( $form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total );
577
+				$entries = GFAPI::get_entries( $form_ids, $criteria[ 'search_criteria' ], $criteria[ 'sorting' ], $criteria[ 'paging' ], $total );
578 578
 
579 579
 				if ( is_wp_error( $entries ) ) {
580 580
 					do_action( 'gravityview_log_error', $entries->get_error_message(), $entries );
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
 				}
584 584
 			}
585 585
 
586
-			if ( ! empty( $criteria['cache'] ) && isset( $Cache ) ) {
586
+			if ( ! empty( $criteria[ 'cache' ] ) && isset( $Cache ) ) {
587 587
 
588 588
 				// Cache results
589 589
 				$Cache->set( $entries, 'entries' );
@@ -688,12 +688,12 @@  discard block
 block discarded – undo
688 688
 			 */
689 689
 			$check_entry_display = apply_filters( 'gravityview/common/get_entry/check_entry_display', $check_entry_display, $entry );
690 690
 
691
-			if( $check_entry_display ) {
691
+			if ( $check_entry_display ) {
692 692
 				// Is the entry allowed
693 693
 				$entry = self::check_entry_display( $entry );
694 694
 			}
695 695
 
696
-			if( is_wp_error( $entry ) ) {
696
+			if ( is_wp_error( $entry ) ) {
697 697
 				do_action( 'gravityview_log_error', __METHOD__ . ': ' . $entry->get_error_message() );
698 698
 				return false;
699 699
 			}
@@ -725,12 +725,12 @@  discard block
 block discarded – undo
725 725
 
726 726
 		$value = false;
727 727
 
728
-		if( 'context' === $val1 ) {
728
+		if ( 'context' === $val1 ) {
729 729
 
730 730
 			$matching_contexts = array( $val2 );
731 731
 
732 732
 			// We allow for non-standard contexts.
733
-			switch( $val2 ) {
733
+			switch ( $val2 ) {
734 734
 				// Check for either single or edit
735 735
 				case 'singular':
736 736
 					$matching_contexts = array( 'single', 'edit' );
@@ -786,76 +786,76 @@  discard block
 block discarded – undo
786 786
 	public static function check_entry_display( $entry ) {
787 787
 
788 788
 		if ( ! $entry || is_wp_error( $entry ) ) {
789
-			return new WP_Error('entry_not_found', 'Entry was not found.', $entry );
789
+			return new WP_Error( 'entry_not_found', 'Entry was not found.', $entry );
790 790
 		}
791 791
 
792
-		if ( empty( $entry['form_id'] ) ) {
792
+		if ( empty( $entry[ 'form_id' ] ) ) {
793 793
 			return new WP_Error( 'form_id_not_set', '[apply_filters_to_entry] Entry is empty!', $entry );
794 794
 		}
795 795
 
796 796
 		$criteria = self::calculate_get_entries_criteria();
797 797
 
798
-		if ( empty( $criteria['search_criteria'] ) || ! is_array( $criteria['search_criteria'] ) ) {
798
+		if ( empty( $criteria[ 'search_criteria' ] ) || ! is_array( $criteria[ 'search_criteria' ] ) ) {
799 799
 			do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No search criteria found:', $criteria );
800 800
 			return $entry;
801 801
 		}
802 802
 
803 803
 		// Make sure the current View is connected to the same form as the Entry
804
-		if( ! empty( $criteria['context_view_id'] ) ) {
805
-			$context_view_id = intval( $criteria['context_view_id'] );
804
+		if ( ! empty( $criteria[ 'context_view_id' ] ) ) {
805
+			$context_view_id = intval( $criteria[ 'context_view_id' ] );
806 806
 			$context_form_id = gravityview_get_form_id( $context_view_id );
807
-			if( intval( $context_form_id ) !== intval( $entry['form_id'] ) ) {
808
-				return new WP_Error( 'view_id_not_match', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry['form_id'] ), $criteria['context_view_id'] );
807
+			if ( intval( $context_form_id ) !== intval( $entry[ 'form_id' ] ) ) {
808
+				return new WP_Error( 'view_id_not_match', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry[ 'form_id' ] ), $criteria[ 'context_view_id' ] );
809 809
 			}
810 810
 		}
811 811
 
812
-		$search_criteria = $criteria['search_criteria'];
812
+		$search_criteria = $criteria[ 'search_criteria' ];
813 813
 
814 814
 		// check entry status
815
-		if ( array_key_exists( 'status', $search_criteria ) && $search_criteria['status'] != $entry['status'] ) {
816
-			return new WP_Error( 'status_not_valid', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry['status'] ), $search_criteria );
815
+		if ( array_key_exists( 'status', $search_criteria ) && $search_criteria[ 'status' ] != $entry[ 'status' ] ) {
816
+			return new WP_Error( 'status_not_valid', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry[ 'status' ] ), $search_criteria );
817 817
 		}
818 818
 
819 819
 		// check entry date
820 820
 		// @todo: Does it make sense to apply the Date create filters to the single entry?
821 821
 
822 822
 		// field_filters
823
-		if ( empty( $search_criteria['field_filters'] ) || ! is_array( $search_criteria['field_filters'] ) ) {
823
+		if ( empty( $search_criteria[ 'field_filters' ] ) || ! is_array( $search_criteria[ 'field_filters' ] ) ) {
824 824
 			do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No field filters criteria found:', $search_criteria );
825 825
 			return $entry;
826 826
 		}
827 827
 
828
-		$filters = $search_criteria['field_filters'];
828
+		$filters = $search_criteria[ 'field_filters' ];
829 829
 
830
-		$mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters['mode'] ) : 'all';
830
+		$mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters[ 'mode' ] ) : 'all';
831 831
 
832 832
 		// Prevent the mode from being processed below
833
-		unset( $filters['mode'] );
833
+		unset( $filters[ 'mode' ] );
834 834
 
835
-		$form = self::get_form( $entry['form_id'] );
835
+		$form = self::get_form( $entry[ 'form_id' ] );
836 836
 
837 837
 		foreach ( $filters as $filter ) {
838 838
 
839
-			if ( ! isset( $filter['key'] ) ) {
839
+			if ( ! isset( $filter[ 'key' ] ) ) {
840 840
 				do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Filter key not set', $filter );
841 841
 				continue;
842 842
 			}
843 843
 
844
-			$k = $filter['key'];
844
+			$k = $filter[ 'key' ];
845 845
 
846 846
 			$field = self::get_field( $form, $k );
847 847
 
848 848
 			if ( is_null( $field ) ) {
849 849
 				$field_value = isset( $entry[ $k ] ) ? $entry[ $k ] : null;
850 850
 			} else {
851
-				$field_value  = GFFormsModel::get_lead_field_value( $entry, $field );
851
+				$field_value = GFFormsModel::get_lead_field_value( $entry, $field );
852 852
 				 // If it's a complex field, then fetch the input's value, if exists at the current key. Otherwise, let GF handle it
853 853
 				$field_value = ( is_array( $field_value ) && isset( $field_value[ $k ] ) ) ? rgar( $field_value, $k ) : $field_value;
854 854
 			}
855 855
 
856
-			$operator = isset( $filter['operator'] ) ? strtolower( $filter['operator'] ) : 'is';
856
+			$operator = isset( $filter[ 'operator' ] ) ? strtolower( $filter[ 'operator' ] ) : 'is';
857 857
 
858
-			$is_value_match = GFFormsModel::is_value_match( $field_value, $filter['value'], $operator, $field );
858
+			$is_value_match = GFFormsModel::is_value_match( $field_value, $filter[ 'value' ], $operator, $field );
859 859
 
860 860
 			// Any match is all we need to know
861 861
 			if ( $is_value_match && 'any' === $mode ) {
@@ -864,7 +864,7 @@  discard block
 block discarded – undo
864 864
 
865 865
 			// Any failed match is a total fail
866 866
 			if ( ! $is_value_match && 'all' === $mode ) {
867
-				return new WP_Error('failed_criteria', '[apply_filters_to_entry] Entry cannot be displayed. Failed a criterium for ALL mode', $filter );
867
+				return new WP_Error( 'failed_criteria', '[apply_filters_to_entry] Entry cannot be displayed. Failed a criterium for ALL mode', $filter );
868 868
 			}
869 869
 		}
870 870
 
@@ -874,7 +874,7 @@  discard block
 block discarded – undo
874 874
 			do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved: all conditions were met' );
875 875
 			return $entry;
876 876
 		} else {
877
-			return new WP_Error('failed_any_criteria', '[apply_filters_to_entry] Entry cannot be displayed. Failed all the criteria for ANY mode', $filters );
877
+			return new WP_Error( 'failed_any_criteria', '[apply_filters_to_entry] Entry cannot be displayed. Failed all the criteria for ANY mode', $filters );
878 878
 		}
879 879
 
880 880
 	}
@@ -915,18 +915,18 @@  discard block
 block discarded – undo
915 915
 		 * Gravity Forms code to adjust date to locally-configured Time Zone
916 916
 		 * @see GFCommon::format_date() for original code
917 917
 		 */
918
-		$date_gmt_time   = mysql2date( 'G', $date_string );
918
+		$date_gmt_time = mysql2date( 'G', $date_string );
919 919
 		$date_local_timestamp = GFCommon::get_local_timestamp( $date_gmt_time );
920 920
 
921
-		$format  = rgar( $atts, 'format' );
922
-		$is_human  = ! empty( $atts['human'] );
923
-		$is_diff  = ! empty( $atts['diff'] );
924
-		$is_raw = ! empty( $atts['raw'] );
925
-		$is_timestamp = ! empty( $atts['timestamp'] );
926
-		$include_time = ! empty( $atts['time'] );
921
+		$format = rgar( $atts, 'format' );
922
+		$is_human = ! empty( $atts[ 'human' ] );
923
+		$is_diff = ! empty( $atts[ 'diff' ] );
924
+		$is_raw = ! empty( $atts[ 'raw' ] );
925
+		$is_timestamp = ! empty( $atts[ 'timestamp' ] );
926
+		$include_time = ! empty( $atts[ 'time' ] );
927 927
 
928 928
 		// If we're using time diff, we want to have a different default format
929
-		if( empty( $format ) ) {
929
+		if ( empty( $format ) ) {
930 930
 			/* translators: %s: relative time from now, used for generic date comparisons. "1 day ago", or "20 seconds ago" */
931 931
 			$format = $is_diff ? esc_html__( '%s ago', 'gravityview' ) : get_option( 'date_format' );
932 932
 		}
@@ -934,7 +934,7 @@  discard block
 block discarded – undo
934 934
 		// If raw was specified, don't modify the stored value
935 935
 		if ( $is_raw ) {
936 936
 			$formatted_date = $date_string;
937
-		} elseif( $is_timestamp ) {
937
+		} elseif ( $is_timestamp ) {
938 938
 			$formatted_date = $date_local_timestamp;
939 939
 		} elseif ( $is_diff ) {
940 940
 			$formatted_date = sprintf( $format, human_time_diff( $date_gmt_time ) );
@@ -968,7 +968,7 @@  discard block
 block discarded – undo
968 968
 
969 969
 		$label = rgar( $field, 'label' );
970 970
 
971
-		if( floor( $field_id ) !== floatval( $field_id ) ) {
971
+		if ( floor( $field_id ) !== floatval( $field_id ) ) {
972 972
 			$label = GFFormsModel::get_choice_text( $field, $field_value, $field_id );
973 973
 		}
974 974
 
@@ -996,7 +996,7 @@  discard block
 block discarded – undo
996 996
 			$form = GFAPI::get_form( $form );
997 997
 		}
998 998
 
999
-		if ( class_exists( 'GFFormsModel' ) ){
999
+		if ( class_exists( 'GFFormsModel' ) ) {
1000 1000
 			return GFFormsModel::get_field( $form, $field_id );
1001 1001
 		} else {
1002 1002
 			return null;
@@ -1043,19 +1043,19 @@  discard block
 block discarded – undo
1043 1043
 			$shortcodes = array();
1044 1044
 
1045 1045
 			preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER );
1046
-			if ( empty( $matches ) ){
1046
+			if ( empty( $matches ) ) {
1047 1047
 				return false;
1048 1048
 			}
1049 1049
 
1050 1050
 			foreach ( $matches as $shortcode ) {
1051
-				if ( $tag === $shortcode[2] ) {
1051
+				if ( $tag === $shortcode[ 2 ] ) {
1052 1052
 
1053 1053
 					// Changed this to $shortcode instead of true so we get the parsed atts.
1054
-					$shortcodes[] = $shortcode;
1054
+					$shortcodes[ ] = $shortcode;
1055 1055
 
1056
-				} else if ( isset( $shortcode[5] ) && $results = self::has_shortcode_r( $shortcode[5], $tag ) ) {
1057
-					foreach( $results as $result ) {
1058
-						$shortcodes[] = $result;
1056
+				} else if ( isset( $shortcode[ 5 ] ) && $results = self::has_shortcode_r( $shortcode[ 5 ], $tag ) ) {
1057
+					foreach ( $results as $result ) {
1058
+						$shortcodes[ ] = $result;
1059 1059
 					}
1060 1060
 				}
1061 1061
 			}
@@ -1199,7 +1199,7 @@  discard block
 block discarded – undo
1199 1199
 	public static function get_directory_fields( $post_id, $apply_filter = true ) {
1200 1200
 		$fields = get_post_meta( $post_id, '_gravityview_directory_fields', true );
1201 1201
 
1202
-		if( $apply_filter ) {
1202
+		if ( $apply_filter ) {
1203 1203
 			/**
1204 1204
 			 * @filter `gravityview/configuration/fields` Filter the View fields' configuration array
1205 1205
 			 * @since 1.6.5
@@ -1222,7 +1222,7 @@  discard block
 block discarded – undo
1222 1222
 	 * @return string         html
1223 1223
 	 */
1224 1224
 	public static function get_sortable_fields( $formid, $current = '' ) {
1225
-		$output = '<option value="" ' . selected( '', $current, false ).'>' . esc_html__( 'Default', 'gravityview' ) .'</option>';
1225
+		$output = '<option value="" ' . selected( '', $current, false ) . '>' . esc_html__( 'Default', 'gravityview' ) . '</option>';
1226 1226
 
1227 1227
 		if ( empty( $formid ) ) {
1228 1228
 			return $output;
@@ -1235,11 +1235,11 @@  discard block
 block discarded – undo
1235 1235
 			$blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', array( 'list', 'textarea' ), null );
1236 1236
 
1237 1237
 			foreach ( $fields as $id => $field ) {
1238
-				if ( in_array( $field['type'], $blacklist_field_types ) ) {
1238
+				if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
1239 1239
 					continue;
1240 1240
 				}
1241 1241
 
1242
-				$output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'>'. esc_attr( $field['label'] ) .'</option>';
1242
+				$output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . '>' . esc_attr( $field[ 'label' ] ) . '</option>';
1243 1243
 			}
1244 1244
 		}
1245 1245
 
@@ -1274,9 +1274,9 @@  discard block
 block discarded – undo
1274 1274
 		$blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL );
1275 1275
 
1276 1276
 		// TODO: Convert to using array_filter
1277
-		foreach( $fields as $id => $field ) {
1277
+		foreach ( $fields as $id => $field ) {
1278 1278
 
1279
-			if( in_array( $field['type'], $blacklist_field_types ) ) {
1279
+			if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
1280 1280
 				unset( $fields[ $id ] );
1281 1281
 			}
1282 1282
 		}
@@ -1317,14 +1317,14 @@  discard block
 block discarded – undo
1317 1317
 	 * @param  int|array  $field field key or field array
1318 1318
 	 * @return boolean
1319 1319
 	 */
1320
-	public static function is_field_numeric(  $form = null, $field = '' ) {
1320
+	public static function is_field_numeric( $form = null, $field = '' ) {
1321 1321
 
1322 1322
 		if ( ! is_array( $form ) && ! is_array( $field ) ) {
1323 1323
 			$form = self::get_form( $form );
1324 1324
 		}
1325 1325
 
1326 1326
 		// If entry meta, it's a string. Otherwise, numeric
1327
-		if( ! is_numeric( $field ) && is_string( $field ) ) {
1327
+		if ( ! is_numeric( $field ) && is_string( $field ) ) {
1328 1328
 			$type = $field;
1329 1329
 		} else {
1330 1330
 			$type = self::get_field_type( $form, $field );
@@ -1338,9 +1338,9 @@  discard block
 block discarded – undo
1338 1338
 		$numeric_types = apply_filters( 'gravityview/common/numeric_types', array( 'number', 'time' ) );
1339 1339
 
1340 1340
 		// Defer to GravityView_Field setting, if the field type is registered and `is_numeric` is true
1341
-		if( $gv_field = GravityView_Fields::get( $type ) ) {
1342
-			if( true === $gv_field->is_numeric ) {
1343
-				$numeric_types[] = $gv_field->is_numeric;
1341
+		if ( $gv_field = GravityView_Fields::get( $type ) ) {
1342
+			if ( true === $gv_field->is_numeric ) {
1343
+				$numeric_types[ ] = $gv_field->is_numeric;
1344 1344
 			}
1345 1345
 		}
1346 1346
 
@@ -1490,18 +1490,18 @@  discard block
 block discarded – undo
1490 1490
 		$final_atts = array_filter( $final_atts );
1491 1491
 
1492 1492
 		// If the href wasn't passed as an attribute, use the value passed to the function
1493
-		if ( empty( $final_atts['href'] ) && ! empty( $href ) ) {
1494
-			$final_atts['href'] = $href;
1493
+		if ( empty( $final_atts[ 'href' ] ) && ! empty( $href ) ) {
1494
+			$final_atts[ 'href' ] = $href;
1495 1495
 		}
1496 1496
 
1497
-		$final_atts['href'] = esc_url_raw( $href );
1497
+		$final_atts[ 'href' ] = esc_url_raw( $href );
1498 1498
 
1499 1499
 		/**
1500 1500
 		 * Fix potential security issue with target=_blank
1501 1501
 		 * @see https://dev.to/ben/the-targetblank-vulnerability-by-example
1502 1502
 		 */
1503
-		if( '_blank' === rgar( $final_atts, 'target' ) ) {
1504
-			$final_atts['rel'] = trim( rgar( $final_atts, 'rel', '' ) . ' noopener noreferrer' );
1503
+		if ( '_blank' === rgar( $final_atts, 'target' ) ) {
1504
+			$final_atts[ 'rel' ] = trim( rgar( $final_atts, 'rel', '' ) . ' noopener noreferrer' );
1505 1505
 		}
1506 1506
 
1507 1507
 		// Sort the attributes alphabetically, to help testing
@@ -1513,7 +1513,7 @@  discard block
 block discarded – undo
1513 1513
 			$output .= sprintf( ' %s="%s"', $attr, esc_attr( $value ) );
1514 1514
 		}
1515 1515
 
1516
-		if( '' !== $output ) {
1516
+		if ( '' !== $output ) {
1517 1517
 			$output = '<a' . $output . '>' . $anchor_text . '</a>';
1518 1518
 		}
1519 1519
 
@@ -1540,7 +1540,7 @@  discard block
 block discarded – undo
1540 1540
 			if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) {
1541 1541
 				$merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value );
1542 1542
 			} else if ( is_numeric( $key ) && isset( $merged[ $key ] ) ) {
1543
-				$merged[] = $value;
1543
+				$merged[ ] = $value;
1544 1544
 			} else {
1545 1545
 				$merged[ $key ] = $value;
1546 1546
 			}
@@ -1573,7 +1573,7 @@  discard block
 block discarded – undo
1573 1573
 		 * `$context` is where are we using this information (e.g. change_entry_creator, search_widget ..)
1574 1574
 		 * @param array $settings Settings array, with `number` key defining the # of users to display
1575 1575
 		 */
1576
-		$get_users_settings = apply_filters( 'gravityview/get_users/'. $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) );
1576
+		$get_users_settings = apply_filters( 'gravityview/get_users/' . $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) );
1577 1577
 
1578 1578
 		return get_users( $get_users_settings );
1579 1579
 	}
@@ -1593,11 +1593,11 @@  discard block
 block discarded – undo
1593 1593
     public static function generate_notice( $notice, $class = '', $cap = '', $object_id = null ) {
1594 1594
 
1595 1595
     	// If $cap is defined, only show notice if user has capability
1596
-    	if( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) {
1596
+    	if ( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) {
1597 1597
     		return '';
1598 1598
 	    }
1599 1599
 
1600
-        return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>';
1600
+        return '<div class="gv-notice ' . gravityview_sanitize_html_class( $class ) . '">' . $notice . '</div>';
1601 1601
     }
1602 1602
 
1603 1603
 	/**
Please login to merge, or discard this patch.
includes/plugin-and-theme-hooks/class-gravityview-plugin-hooks-acf.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 			return $meta_keys;
49 49
 		}
50 50
 
51
-		if( $acf_keys = get_field_objects( $post_id, array( 'load_value' => false ) ) ) {
51
+		if ( $acf_keys = get_field_objects( $post_id, array( 'load_value' => false ) ) ) {
52 52
 			return array_merge( array_keys( $acf_keys ), $meta_keys );
53 53
 		}
54 54
 
@@ -63,9 +63,9 @@  discard block
 block discarded – undo
63 63
 	 * @return void
64 64
 	 */
65 65
 	private function fix_posted_fields() {
66
-		if( is_admin() && isset( $_POST['action'] ) && isset( $_POST['post_type'] ) ) {
67
-			if( 'editpost' === $_POST['action'] && 'gravityview' === $_POST['post_type'] ) {
68
-				$_POST['fields'] = _gravityview_process_posted_fields();
66
+		if ( is_admin() && isset( $_POST[ 'action' ] ) && isset( $_POST[ 'post_type' ] ) ) {
67
+			if ( 'editpost' === $_POST[ 'action' ] && 'gravityview' === $_POST[ 'post_type' ] ) {
68
+				$_POST[ 'fields' ] = _gravityview_process_posted_fields();
69 69
 			}
70 70
 		}
71 71
 	}
Please login to merge, or discard this patch.
future/loader.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
 }
6 6
 
7 7
 /** The future branch of GravityView requires PHP 5.3+ namespaces and SPL. */
8
-if ( version_compare( phpversion(), '5.3' , '<' ) ) {
8
+if ( version_compare( phpversion(), '5.3', '<' ) ) {
9 9
 	return false;
10 10
 
11 11
 /** Tests with a suppressed future. */
Please login to merge, or discard this patch.
future/includes/class-gv-shortcode.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -56,16 +56,16 @@  discard block
 block discarded – undo
56 56
 	public static function add() {
57 57
 		$shortcode = new static();
58 58
 		if ( shortcode_exists( $shortcode->name ) ) {
59
-			if ( empty( self::$shortcodes[$shortcode->name] ) ) {
59
+			if ( empty( self::$shortcodes[ $shortcode->name ] ) ) {
60 60
 				gravityview()->log->error( 'Shortcode [{shortcode}] has already been registered elsewhere.', array( 'shortcode' => $shortcode->name ) );
61 61
 				return null;
62 62
 			}
63 63
 		} else {
64 64
 			add_shortcode( $shortcode->name, array( get_class( $shortcode ), 'callback' ) );
65
-			self::$shortcodes[$shortcode->name] = $shortcode;
65
+			self::$shortcodes[ $shortcode->name ] = $shortcode;
66 66
 		}
67 67
 
68
-		return self::$shortcodes[$shortcode->name];
68
+		return self::$shortcodes[ $shortcode->name ];
69 69
 	}
70 70
 
71 71
 	/**
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	 */
78 78
 	public static function remove() {
79 79
 		$shortcode = new static();
80
-		unset( self::$shortcodes[$shortcode->name] );
80
+		unset( self::$shortcodes[ $shortcode->name ] );
81 81
 		remove_shortcode( $shortcode->name );
82 82
 	}
83 83
 
@@ -109,14 +109,14 @@  discard block
 block discarded – undo
109 109
 		preg_match_all( '/' . get_shortcode_regex() . '/', $content, $matches, PREG_SET_ORDER );
110 110
 
111 111
 		foreach ( $matches as $shortcode ) {
112
-			$shortcode_name = $shortcode[2];
112
+			$shortcode_name = $shortcode[ 2 ];
113 113
 
114
-			$shortcode_atts = shortcode_parse_atts( $shortcode[3] );
115
-			$shortcode_content = $shortcode[5];
114
+			$shortcode_atts = shortcode_parse_atts( $shortcode[ 3 ] );
115
+			$shortcode_content = $shortcode[ 5 ];
116 116
 
117 117
 			/** This is a registered GravityView shortcode. */
118
-			if ( !empty( self::$shortcodes[$shortcode_name] ) ) {
119
-				$shortcode = clone self::$shortcodes[$shortcode_name];
118
+			if ( ! empty( self::$shortcodes[ $shortcode_name ] ) ) {
119
+				$shortcode = clone self::$shortcodes[ $shortcode_name ];
120 120
 			} else {
121 121
 				/** This is some generic shortcode. */
122 122
 				$shortcode = new self;
Please login to merge, or discard this patch.
future/includes/class-gv-view.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 		$supports = array( 'title', 'revisions' );
87 87
 
88 88
 		if ( $is_hierarchical ) {
89
-			$supports[] = 'page-attributes';
89
+			$supports[ ] = 'page-attributes';
90 90
 		}
91 91
 
92 92
 		/**
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 		if ( ! $view->form ) {
198 198
 			gravityview()->log->error( 'View #{view_id} tried attaching non-existent Form #{form_id} to it.', array(
199 199
 				'view_id' => $view->ID,
200
-				'form_id' => $view->_gravityview_form_id ? : 0,
200
+				'form_id' => $view->_gravityview_form_id ?: 0,
201 201
 			) );
202 202
 		}
203 203
 
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
 		
336 336
 		gravityview()->log->notice( 'This is a \GV\View object should not be accessed as an array.' );
337 337
 
338
-		if ( ! isset( $this[$offset] ) ) {
338
+		if ( ! isset( $this[ $offset ] ) ) {
339 339
 			return null;
340 340
 		}
341 341
 
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 				return $this->template ? $this->template->ID : null;
354 354
 			default:
355 355
 				/** @todo move the rest out and get rid of _data completely! */
356
-				return $this->_data[$offset];
356
+				return $this->_data[ $offset ];
357 357
 		}
358 358
 	}
359 359
 
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
 			array( 'form' => $this->form ? gravityview_get_form( $this->form->ID ) : null ),
403 403
 			array( 'atts' => $this->settings->as_atts() ),
404 404
 			array( 'fields' => $this->fields->by_visible()->as_configuration() ),
405
-			array( 'template_id' => $this->template? $this->template->ID : null ),
405
+			array( 'template_id' => $this->template ? $this->template->ID : null ),
406 406
 			$this->_data
407 407
 		);
408 408
 	}
Please login to merge, or discard this patch.
future/includes/class-gv-plugin.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -202,8 +202,8 @@  discard block
 block discarded – undo
202 202
 	 * @return string The version of PHP.
203 203
 	 */
204 204
 	private function get_php_version() {
205
-		return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] ) ?
206
-			$GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] : phpversion();
205
+		return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE' ] ) ?
206
+			$GLOBALS[ 'GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE' ] : phpversion();
207 207
 	}
208 208
 
209 209
 	/**
@@ -214,8 +214,8 @@  discard block
 block discarded – undo
214 214
 	 * @return string The version of WordPress.
215 215
 	 */
216 216
 	private function get_wordpress_version() {
217
-		return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] ) ?
218
-			$GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] : $GLOBALS['wp_version'];
217
+		return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE' ] ) ?
218
+			$GLOBALS[ 'GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE' ] : $GLOBALS[ 'wp_version' ];
219 219
 	}
220 220
 
221 221
 	/**
@@ -226,13 +226,13 @@  discard block
 block discarded – undo
226 226
 	 * @return string|null The version of Gravity Forms or null if inactive.
227 227
 	 */
228 228
 	private function get_gravityforms_version() {
229
-		if ( ! class_exists( '\GFCommon' ) || ! empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE'] ) ) {
229
+		if ( ! class_exists( '\GFCommon' ) || ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE' ] ) ) {
230 230
 			gravityview()->log->error( 'Gravity Forms is inactive or not installed.' );
231 231
 			return null;
232 232
 		}
233 233
 
234
-		return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] ) ?
235
-			$GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] : \GFCommon::$version;
234
+		return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE' ] ) ?
235
+			$GLOBALS[ 'GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE' ] : \GFCommon::$version;
236 236
 	}
237 237
 
238 238
 	private function __clone() { }
Please login to merge, or discard this patch.
includes/widgets/search-widget/class-search-widget.php 1 patch
Spacing   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 				'type' => 'radio',
64 64
 				'full_width' => true,
65 65
 				'label' => esc_html__( 'Search Mode', 'gravityview' ),
66
-				'desc' => __('Should search results match all search fields, or any?', 'gravityview'),
66
+				'desc' => __( 'Should search results match all search fields, or any?', 'gravityview' ),
67 67
 				'value' => 'any',
68 68
 				'class' => 'hide-if-js',
69 69
 				'options' => array(
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 
86 86
 		// admin - add scripts - run at 1100 to make sure GravityView_Admin_Views::add_scripts_and_styles() runs first at 999
87 87
 		add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 1100 );
88
-		add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts') );
88
+		add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) );
89 89
 		add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) );
90 90
 
91 91
 		// ajax - get the searchable fields
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 		$script_min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
222 222
 		$script_source = empty( $script_min ) ? '/source' : '';
223 223
 
224
-		wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js'.$script_source.'/admin-search-widget'.$script_min.'.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), GravityView_Plugin::version );
224
+		wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js' . $script_source . '/admin-search-widget' . $script_min . '.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), GravityView_Plugin::version );
225 225
 
226 226
 		wp_localize_script( 'gravityview_searchwidget_admin', 'gvSearchVar', array(
227 227
 			'nonce' => wp_create_nonce( 'gravityview_ajaxsearchwidget' ),
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 	 * @return array Scripts allowed in no-conflict mode, plus the search widget script
244 244
 	 */
245 245
 	public function register_no_conflict( $allowed ) {
246
-		$allowed[] = 'gravityview_searchwidget_admin';
246
+		$allowed[ ] = 'gravityview_searchwidget_admin';
247 247
 		return $allowed;
248 248
 	}
249 249
 
@@ -256,24 +256,24 @@  discard block
 block discarded – undo
256 256
 	 */
257 257
 	public static function get_searchable_fields() {
258 258
 
259
-		if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxsearchwidget' ) ) {
259
+		if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxsearchwidget' ) ) {
260 260
 			exit( '0' );
261 261
 		}
262 262
 
263 263
 		$form = '';
264 264
 
265 265
 		// Fetch the form for the current View
266
-		if ( ! empty( $_POST['view_id'] ) ) {
266
+		if ( ! empty( $_POST[ 'view_id' ] ) ) {
267 267
 
268
-			$form = gravityview_get_form_id( $_POST['view_id'] );
268
+			$form = gravityview_get_form_id( $_POST[ 'view_id' ] );
269 269
 
270
-		} elseif ( ! empty( $_POST['formid'] ) ) {
270
+		} elseif ( ! empty( $_POST[ 'formid' ] ) ) {
271 271
 
272
-			$form = (int) $_POST['formid'];
272
+			$form = (int)$_POST[ 'formid' ];
273 273
 
274
-		} elseif ( ! empty( $_POST['template_id'] ) && class_exists( 'GravityView_Ajax' ) ) {
274
+		} elseif ( ! empty( $_POST[ 'template_id' ] ) && class_exists( 'GravityView_Ajax' ) ) {
275 275
 
276
-			$form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] );
276
+			$form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] );
277 277
 
278 278
 		}
279 279
 
@@ -318,8 +318,8 @@  discard block
 block discarded – undo
318 318
 			)
319 319
 		);
320 320
 
321
-		foreach( $custom_fields as $custom_field_key => $custom_field ) {
322
-			$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'] );
321
+		foreach ( $custom_fields as $custom_field_key => $custom_field ) {
322
+			$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' ] );
323 323
 		}
324 324
 
325 325
 		// Get fields with sub-inputs and no parent
@@ -341,13 +341,13 @@  discard block
 block discarded – undo
341 341
 
342 342
 			foreach ( $fields as $id => $field ) {
343 343
 
344
-				if ( in_array( $field['type'], $blacklist_field_types ) ) {
344
+				if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
345 345
 					continue;
346 346
 				}
347 347
 
348
-				$types = self::get_search_input_types( $id, $field['type'] );
348
+				$types = self::get_search_input_types( $id, $field[ 'type' ] );
349 349
 
350
-				$output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'data-inputtypes="'. esc_attr( $types ) .'">'. esc_html( $field['label'] ) .'</option>';
350
+				$output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . 'data-inputtypes="' . esc_attr( $types ) . '">' . esc_html( $field[ 'label' ] ) . '</option>';
351 351
 			}
352 352
 		}
353 353
 
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
 	public static function get_search_input_types( $field_id = '', $field_type = null ) {
371 371
 
372 372
 		// @todo - This needs to be improved - many fields have . including products and addresses
373
-		if ( false !== strpos( (string) $field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) {
373
+		if ( false !== strpos( (string)$field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) {
374 374
 			$input_type = 'boolean'; // on/off checkbox
375 375
 		} elseif ( in_array( $field_type, array( 'checkbox', 'post_category', 'multiselect' ) ) ) {
376 376
 			$input_type = 'multi'; //multiselect
@@ -414,19 +414,19 @@  discard block
 block discarded – undo
414 414
 			$post_id = 0;
415 415
 
416 416
 			// We're in the WordPress Widget context, and an overriding post ID has been set.
417
-			if ( ! empty( $widget_args['post_id'] ) ) {
418
-				$post_id = absint( $widget_args['post_id'] );
417
+			if ( ! empty( $widget_args[ 'post_id' ] ) ) {
418
+				$post_id = absint( $widget_args[ 'post_id' ] );
419 419
 			}
420 420
 			// We're in the WordPress Widget context, and the base View ID should be used
421
-			else if ( ! empty( $widget_args['view_id'] ) ) {
422
-				$post_id = absint( $widget_args['view_id'] );
421
+			else if ( ! empty( $widget_args[ 'view_id' ] ) ) {
422
+				$post_id = absint( $widget_args[ 'view_id' ] );
423 423
 			}
424 424
 
425 425
 			$args = gravityview_get_permalink_query_args( $post_id );
426 426
 
427 427
 			// Add hidden fields to the search form
428 428
 			foreach ( $args as $key => $value ) {
429
-				$search_fields[] = array(
429
+				$search_fields[ ] = array(
430 430
 					'name'  => $key,
431 431
 					'input' => 'hidden',
432 432
 					'value' => $value,
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 	 */
448 448
 	public function filter_entries( $search_criteria ) {
449 449
 
450
-		if( 'post' === $this->search_method ) {
450
+		if ( 'post' === $this->search_method ) {
451 451
 			$get = $_POST;
452 452
 		} else {
453 453
 			$get = $_GET;
@@ -464,12 +464,12 @@  discard block
 block discarded – undo
464 464
 		$get = gv_map_deep( $get, 'rawurldecode' );
465 465
 
466 466
 		// Make sure array key is set up
467
-		$search_criteria['field_filters'] = rgar( $search_criteria, 'field_filters', array() );
467
+		$search_criteria[ 'field_filters' ] = rgar( $search_criteria, 'field_filters', array() );
468 468
 
469 469
 		// add free search
470
-		if ( ! empty( $get['gv_search'] ) ) {
470
+		if ( ! empty( $get[ 'gv_search' ] ) ) {
471 471
 
472
-			$search_all_value = trim( $get['gv_search'] );
472
+			$search_all_value = trim( $get[ 'gv_search' ] );
473 473
 
474 474
 			/**
475 475
 			 * @filter `gravityview/search-all-split-words` Search for each word separately or the whole phrase?
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
 			 */
479 479
 			$split_words = apply_filters( 'gravityview/search-all-split-words', true );
480 480
 
481
-			if( $split_words ) {
481
+			if ( $split_words ) {
482 482
 
483 483
 				// Search for a piece
484 484
 				$words = explode( ' ', $search_all_value );
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
 			}
495 495
 
496 496
 			foreach ( $words as $word ) {
497
-				$search_criteria['field_filters'][] = array(
497
+				$search_criteria[ 'field_filters' ][ ] = array(
498 498
 					'key' => null, // The field ID to search
499 499
 					'value' => $word, // The value to search
500 500
 					'operator' => 'contains', // What to search in. Options: `is` or `contains`
@@ -503,8 +503,8 @@  discard block
 block discarded – undo
503 503
 		}
504 504
 
505 505
 		//start date & end date
506
-		$curr_start = !empty( $get['gv_start'] ) ? $get['gv_start'] : '';
507
-		$curr_end = !empty( $get['gv_start'] ) ? $get['gv_end'] : '';
506
+		$curr_start = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_start' ] : '';
507
+		$curr_end = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_end' ] : '';
508 508
 
509 509
 		/**
510 510
 		 * @filter `gravityview_date_created_adjust_timezone` Whether to adjust the timezone for entries. \n
@@ -519,16 +519,16 @@  discard block
 block discarded – undo
519 519
 		/**
520 520
 		 * Don't set $search_criteria['start_date'] if start_date is empty as it may lead to bad query results (GFAPI::get_entries)
521 521
 		 */
522
-		if( !empty( $curr_start ) ) {
523
-			$search_criteria['start_date'] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start;
522
+		if ( ! empty( $curr_start ) ) {
523
+			$search_criteria[ 'start_date' ] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start;
524 524
 		}
525
-		if( !empty( $curr_end ) ) {
526
-			$search_criteria['end_date'] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end;
525
+		if ( ! empty( $curr_end ) ) {
526
+			$search_criteria[ 'end_date' ] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end;
527 527
 		}
528 528
 
529 529
 		// search for a specific entry ID
530 530
 		if ( ! empty( $get[ 'gv_id' ] ) ) {
531
-			$search_criteria['field_filters'][] = array(
531
+			$search_criteria[ 'field_filters' ][ ] = array(
532 532
 				'key' => 'id',
533 533
 				'value' => absint( $get[ 'gv_id' ] ),
534 534
 				'operator' => '=',
@@ -537,36 +537,36 @@  discard block
 block discarded – undo
537 537
 
538 538
 		// search for a specific Created_by ID
539 539
 		if ( ! empty( $get[ 'gv_by' ] ) ) {
540
-			$search_criteria['field_filters'][] = array(
540
+			$search_criteria[ 'field_filters' ][ ] = array(
541 541
 				'key' => 'created_by',
542
-				'value' => absint( $get['gv_by'] ),
542
+				'value' => absint( $get[ 'gv_by' ] ),
543 543
 				'operator' => '=',
544 544
 			);
545 545
 		}
546 546
 
547 547
 
548 548
 		// Get search mode passed in URL
549
-		$mode = isset( $get['mode'] ) && in_array( $get['mode'], array( 'any', 'all' ) ) ?  $get['mode'] : 'any';
549
+		$mode = isset( $get[ 'mode' ] ) && in_array( $get[ 'mode' ], array( 'any', 'all' ) ) ? $get[ 'mode' ] : 'any';
550 550
 
551 551
 		// get the other search filters
552 552
 		foreach ( $get as $key => $value ) {
553 553
 
554
-			if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[0], false ) ) ) {
554
+			if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[ 0 ], false ) ) ) {
555 555
 				continue;
556 556
 			}
557 557
 
558 558
 			// could return simple filter or multiple filters
559 559
 			$filter = $this->prepare_field_filter( $key, $value );
560 560
 
561
-			if ( isset( $filter[0]['value'] ) ) {
562
-				$search_criteria['field_filters'] = array_merge( $search_criteria['field_filters'], $filter );
561
+			if ( isset( $filter[ 0 ][ 'value' ] ) ) {
562
+				$search_criteria[ 'field_filters' ] = array_merge( $search_criteria[ 'field_filters' ], $filter );
563 563
 
564 564
 				// if date range type, set search mode to ALL
565
-				if ( ! empty( $filter[0]['operator'] ) && in_array( $filter[0]['operator'], array( '>=', '<=', '>', '<' ) ) ) {
565
+				if ( ! empty( $filter[ 0 ][ 'operator' ] ) && in_array( $filter[ 0 ][ 'operator' ], array( '>=', '<=', '>', '<' ) ) ) {
566 566
 					$mode = 'all';
567 567
 				}
568
-			} elseif( !empty( $filter ) ) {
569
-				$search_criteria['field_filters'][] = $filter;
568
+			} elseif ( ! empty( $filter ) ) {
569
+				$search_criteria[ 'field_filters' ][ ] = $filter;
570 570
 			}
571 571
 		}
572 572
 
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
 		 * @since 1.5.1
576 576
 		 * @param[out,in] string $mode Search mode (`any` vs `all`)
577 577
 		 */
578
-		$search_criteria['field_filters']['mode'] = apply_filters( 'gravityview/search/mode', $mode );
578
+		$search_criteria[ 'field_filters' ][ 'mode' ] = apply_filters( 'gravityview/search/mode', $mode );
579 579
 
580 580
 		do_action( 'gravityview_log_debug', sprintf( '%s[filter_entries] Returned Search Criteria: ', get_class( $this ) ), $search_criteria );
581 581
 
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
 		$field_id = str_replace( 'filter_', '', $key );
602 602
 
603 603
 		// calculates field_id, removing 'filter_' and for '_' for advanced fields ( like name or checkbox )
604
-		if ( preg_match('/^[0-9_]+$/ism', $field_id ) ) {
604
+		if ( preg_match( '/^[0-9_]+$/ism', $field_id ) ) {
605 605
 			$field_id = str_replace( '_', '.', $field_id );
606 606
 		}
607 607
 
@@ -615,11 +615,11 @@  discard block
 block discarded – undo
615 615
 			'value' => $value,
616 616
 		);
617 617
 
618
-		switch ( $form_field['type'] ) {
618
+		switch ( $form_field[ 'type' ] ) {
619 619
 
620 620
 			case 'select':
621 621
 			case 'radio':
622
-				$filter['operator'] = 'is';
622
+				$filter[ 'operator' ] = 'is';
623 623
 				break;
624 624
 
625 625
 			case 'post_category':
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
 
634 634
 				foreach ( $value as $val ) {
635 635
 					$cat = get_term( $val, 'category' );
636
-					$filter[] = array(
636
+					$filter[ ] = array(
637 637
 						'key' => $field_id,
638 638
 						'value' => esc_attr( $cat->name ) . ':' . $val,
639 639
 						'operator' => 'is',
@@ -652,18 +652,18 @@  discard block
 block discarded – undo
652 652
 				$filter = array();
653 653
 
654 654
 				foreach ( $value as $val ) {
655
-					$filter[] = array( 'key' => $field_id, 'value' => $val );
655
+					$filter[ ] = array( 'key' => $field_id, 'value' => $val );
656 656
 				}
657 657
 
658 658
 				break;
659 659
 
660 660
 			case 'checkbox':
661 661
 				// convert checkbox on/off into the correct search filter
662
-				if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field['inputs'] ) && ! empty( $form_field['choices'] ) ) {
663
-					foreach ( $form_field['inputs'] as $k => $input ) {
664
-						if ( $input['id'] == $field_id ) {
665
-							$filter['value'] = $form_field['choices'][ $k ]['value'];
666
-							$filter['operator'] = 'is';
662
+				if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field[ 'inputs' ] ) && ! empty( $form_field[ 'choices' ] ) ) {
663
+					foreach ( $form_field[ 'inputs' ] as $k => $input ) {
664
+						if ( $input[ 'id' ] == $field_id ) {
665
+							$filter[ 'value' ] = $form_field[ 'choices' ][ $k ][ 'value' ];
666
+							$filter[ 'operator' ] = 'is';
667 667
 							break;
668 668
 						}
669 669
 					}
@@ -673,7 +673,7 @@  discard block
 block discarded – undo
673 673
 					$filter = array();
674 674
 
675 675
 					foreach ( $value as $val ) {
676
-						$filter[] = array(
676
+						$filter[ ] = array(
677 677
 							'key'   => $field_id,
678 678
 							'value' => $val,
679 679
 							'operator' => 'is',
@@ -694,9 +694,9 @@  discard block
 block discarded – undo
694 694
 					foreach ( $words as $word ) {
695 695
 						if ( ! empty( $word ) && strlen( $word ) > 1 ) {
696 696
 							// Keep the same key for each filter
697
-							$filter['value'] = $word;
697
+							$filter[ 'value' ] = $word;
698 698
 							// Add a search for the value
699
-							$filters[] = $filter;
699
+							$filters[ ] = $filter;
700 700
 						}
701 701
 					}
702 702
 
@@ -723,19 +723,19 @@  discard block
 block discarded – undo
723 723
 						 * @since 1.16.3
724 724
 						 * Safeguard until GF implements '<=' operator
725 725
 						 */
726
-						if( !GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) {
726
+						if ( ! GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) {
727 727
 							$operator = '<';
728 728
 							$date = date( 'Y-m-d', strtotime( $date . ' +1 day' ) );
729 729
 						}
730 730
 
731
-						$filter[] = array(
731
+						$filter[ ] = array(
732 732
 							'key' => $field_id,
733 733
 							'value' => self::get_formatted_date( $date, 'Y-m-d' ),
734 734
 							'operator' => $operator,
735 735
 						);
736 736
 					}
737 737
 				} else {
738
-					$filter['value'] = self::get_formatted_date( $value, 'Y-m-d' );
738
+					$filter[ 'value' ] = self::get_formatted_date( $value, 'Y-m-d' );
739 739
 				}
740 740
 
741 741
 				break;
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
 			'ymd_dot' => 'Y.m.d',
767 767
 		);
768 768
 
769
-		if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){
769
+		if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) {
770 770
 			$format = $datepicker[ $field->dateFormat ];
771 771
 		}
772 772
 
@@ -797,7 +797,7 @@  discard block
 block discarded – undo
797 797
 	public function add_template_path( $file_paths ) {
798 798
 
799 799
 		// Index 100 is the default GravityView template path.
800
-		$file_paths[102] = self::$file . 'templates/';
800
+		$file_paths[ 102 ] = self::$file . 'templates/';
801 801
 
802 802
 		return $file_paths;
803 803
 	}
@@ -816,7 +816,7 @@  discard block
 block discarded – undo
816 816
 		$has_date = false;
817 817
 
818 818
 		foreach ( $search_fields as $k => $field ) {
819
-			if ( in_array( $field['input'], array( 'date', 'date_range', 'entry_date' ) ) ) {
819
+			if ( in_array( $field[ 'input' ], array( 'date', 'date_range', 'entry_date' ) ) ) {
820 820
 				$has_date = true;
821 821
 				break;
822 822
 			}
@@ -843,7 +843,7 @@  discard block
 block discarded – undo
843 843
 		}
844 844
 
845 845
 		// get configured search fields
846
-		$search_fields = ! empty( $widget_args['search_fields'] ) ? json_decode( $widget_args['search_fields'], true ) : '';
846
+		$search_fields = ! empty( $widget_args[ 'search_fields' ] ) ? json_decode( $widget_args[ 'search_fields' ], true ) : '';
847 847
 
848 848
 		if ( empty( $search_fields ) || ! is_array( $search_fields ) ) {
849 849
 			do_action( 'gravityview_log_debug', sprintf( '%s[render_frontend] No search fields configured for widget:', get_class( $this ) ), $widget_args );
@@ -858,34 +858,34 @@  discard block
 block discarded – undo
858 858
 
859 859
 			$updated_field = $this->get_search_filter_details( $updated_field );
860 860
 
861
-			switch ( $field['field'] ) {
861
+			switch ( $field[ 'field' ] ) {
862 862
 
863 863
 				case 'search_all':
864
-					$updated_field['key'] = 'search_all';
865
-					$updated_field['input'] = 'search_all';
866
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_search' );
864
+					$updated_field[ 'key' ] = 'search_all';
865
+					$updated_field[ 'input' ] = 'search_all';
866
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_search' );
867 867
 					break;
868 868
 
869 869
 				case 'entry_date':
870
-					$updated_field['key'] = 'entry_date';
871
-					$updated_field['input'] = 'entry_date';
872
-					$updated_field['value'] = array(
870
+					$updated_field[ 'key' ] = 'entry_date';
871
+					$updated_field[ 'input' ] = 'entry_date';
872
+					$updated_field[ 'value' ] = array(
873 873
 						'start' => $this->rgget_or_rgpost( 'gv_start' ),
874 874
 						'end' => $this->rgget_or_rgpost( 'gv_end' ),
875 875
 					);
876 876
 					break;
877 877
 
878 878
 				case 'entry_id':
879
-					$updated_field['key'] = 'entry_id';
880
-					$updated_field['input'] = 'entry_id';
881
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_id' );
879
+					$updated_field[ 'key' ] = 'entry_id';
880
+					$updated_field[ 'input' ] = 'entry_id';
881
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_id' );
882 882
 					break;
883 883
 
884 884
 				case 'created_by':
885
-					$updated_field['key'] = 'created_by';
886
-					$updated_field['name'] = 'gv_by';
887
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_by' );
888
-					$updated_field['choices'] = self::get_created_by_choices();
885
+					$updated_field[ 'key' ] = 'created_by';
886
+					$updated_field[ 'name' ] = 'gv_by';
887
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_by' );
888
+					$updated_field[ 'choices' ] = self::get_created_by_choices();
889 889
 					break;
890 890
 			}
891 891
 
@@ -903,16 +903,16 @@  discard block
 block discarded – undo
903 903
 		 */
904 904
 		$gravityview_view->search_fields = apply_filters( 'gravityview_widget_search_filters', $search_fields, $this, $widget_args );
905 905
 
906
-		$gravityview_view->search_layout = ! empty( $widget_args['search_layout'] ) ? $widget_args['search_layout'] : 'horizontal';
906
+		$gravityview_view->search_layout = ! empty( $widget_args[ 'search_layout' ] ) ? $widget_args[ 'search_layout' ] : 'horizontal';
907 907
 
908 908
 		/** @since 1.14 */
909
-		$gravityview_view->search_mode = ! empty( $widget_args['search_mode'] ) ? $widget_args['search_mode'] : 'any';
909
+		$gravityview_view->search_mode = ! empty( $widget_args[ 'search_mode' ] ) ? $widget_args[ 'search_mode' ] : 'any';
910 910
 
911
-		$custom_class = ! empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : '';
911
+		$custom_class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : '';
912 912
 
913 913
 		$gravityview_view->search_class = self::get_search_class( $custom_class );
914 914
 
915
-		$gravityview_view->search_clear = ! empty( $widget_args['search_clear'] ) ? $widget_args['search_clear'] : false;
915
+		$gravityview_view->search_clear = ! empty( $widget_args[ 'search_clear' ] ) ? $widget_args[ 'search_clear' ] : false;
916 916
 
917 917
 		if ( $this->has_date_field( $search_fields ) ) {
918 918
 			// enqueue datepicker stuff only if needed!
@@ -934,10 +934,10 @@  discard block
 block discarded – undo
934 934
 	public static function get_search_class( $custom_class = '' ) {
935 935
 		$gravityview_view = GravityView_View::getInstance();
936 936
 
937
-		$search_class = 'gv-search-'.$gravityview_view->search_layout;
937
+		$search_class = 'gv-search-' . $gravityview_view->search_layout;
938 938
 
939
-		if ( ! empty( $custom_class )  ) {
940
-			$search_class .= ' '.$custom_class;
939
+		if ( ! empty( $custom_class ) ) {
940
+			$search_class .= ' ' . $custom_class;
941 941
 		}
942 942
 
943 943
 		/**
@@ -979,11 +979,11 @@  discard block
 block discarded – undo
979 979
 
980 980
 		$label = rgget( 'label', $field );
981 981
 
982
-		if( '' === $label ) {
982
+		if ( '' === $label ) {
983 983
 
984
-			$label = isset( $form_field['label'] ) ? $form_field['label'] : '';
984
+			$label = isset( $form_field[ 'label' ] ) ? $form_field[ 'label' ] : '';
985 985
 
986
-			switch( $field['field'] ) {
986
+			switch ( $field[ 'field' ] ) {
987 987
 				case 'search_all':
988 988
 					$label = __( 'Search Entries:', 'gravityview' );
989 989
 					break;
@@ -995,10 +995,10 @@  discard block
 block discarded – undo
995 995
 					break;
996 996
 				default:
997 997
 					// If this is a field input, not a field
998
-					if ( strpos( $field['field'], '.' ) > 0 && ! empty( $form_field['inputs'] ) ) {
998
+					if ( strpos( $field[ 'field' ], '.' ) > 0 && ! empty( $form_field[ 'inputs' ] ) ) {
999 999
 
1000 1000
 						// Get the label for the field in question, which returns an array
1001
-						$items = wp_list_filter( $form_field['inputs'], array( 'id' => $field['field'] ) );
1001
+						$items = wp_list_filter( $form_field[ 'inputs' ], array( 'id' => $field[ 'field' ] ) );
1002 1002
 
1003 1003
 						// Get the item with the `label` key
1004 1004
 						$values = wp_list_pluck( $items, 'label' );
@@ -1037,32 +1037,32 @@  discard block
 block discarded – undo
1037 1037
 		$form = $gravityview_view->getForm();
1038 1038
 
1039 1039
 		// for advanced field ids (eg, first name / last name )
1040
-		$name = 'filter_' . str_replace( '.', '_', $field['field'] );
1040
+		$name = 'filter_' . str_replace( '.', '_', $field[ 'field' ] );
1041 1041
 
1042 1042
 		// get searched value from $_GET/$_POST (string or array)
1043 1043
 		$value = $this->rgget_or_rgpost( $name );
1044 1044
 
1045 1045
 		// get form field details
1046
-		$form_field = gravityview_get_field( $form, $field['field'] );
1046
+		$form_field = gravityview_get_field( $form, $field[ 'field' ] );
1047 1047
 
1048 1048
 		$filter = array(
1049
-			'key' => $field['field'],
1049
+			'key' => $field[ 'field' ],
1050 1050
 			'name' => $name,
1051 1051
 			'label' => self::get_field_label( $field, $form_field ),
1052
-			'input' => $field['input'],
1052
+			'input' => $field[ 'input' ],
1053 1053
 			'value' => $value,
1054
-			'type' => $form_field['type'],
1054
+			'type' => $form_field[ 'type' ],
1055 1055
 		);
1056 1056
 
1057 1057
 		// collect choices
1058
-		if ( 'post_category' === $form_field['type'] && ! empty( $form_field['displayAllCategories'] ) && empty( $form_field['choices'] ) ) {
1059
-			$filter['choices'] = gravityview_get_terms_choices();
1060
-		} elseif ( ! empty( $form_field['choices'] ) ) {
1061
-			$filter['choices'] = $form_field['choices'];
1058
+		if ( 'post_category' === $form_field[ 'type' ] && ! empty( $form_field[ 'displayAllCategories' ] ) && empty( $form_field[ 'choices' ] ) ) {
1059
+			$filter[ 'choices' ] = gravityview_get_terms_choices();
1060
+		} elseif ( ! empty( $form_field[ 'choices' ] ) ) {
1061
+			$filter[ 'choices' ] = $form_field[ 'choices' ];
1062 1062
 		}
1063 1063
 
1064
-		if ( 'date_range' === $field['input'] && empty( $value ) ) {
1065
-			$filter['value'] = array( 'start' => '', 'end' => '' );
1064
+		if ( 'date_range' === $field[ 'input' ] && empty( $value ) ) {
1065
+			$filter[ 'value' ] = array( 'start' => '', 'end' => '' );
1066 1066
 		}
1067 1067
 
1068 1068
 		return $filter;
@@ -1086,7 +1086,7 @@  discard block
 block discarded – undo
1086 1086
 
1087 1087
 		$choices = array();
1088 1088
 		foreach ( $users as $user ) {
1089
-			$choices[] = array(
1089
+			$choices[ ] = array(
1090 1090
 				'value' => $user->ID,
1091 1091
 				'text' => $user->display_name,
1092 1092
 			);
@@ -1141,7 +1141,7 @@  discard block
 block discarded – undo
1141 1141
 	 */
1142 1142
 	public function add_datepicker_js_dependency( $js_dependencies ) {
1143 1143
 
1144
-		$js_dependencies[] = 'jquery-ui-datepicker';
1144
+		$js_dependencies[ ] = 'jquery-ui-datepicker';
1145 1145
 
1146 1146
 		return $js_dependencies;
1147 1147
 	}
@@ -1185,7 +1185,7 @@  discard block
 block discarded – undo
1185 1185
 			'isRTL'             => is_rtl(),
1186 1186
 		), $view_data );
1187 1187
 
1188
-		$localizations['datepicker'] = $datepicker_settings;
1188
+		$localizations[ 'datepicker' ] = $datepicker_settings;
1189 1189
 
1190 1190
 		return $localizations;
1191 1191
 
@@ -1214,7 +1214,7 @@  discard block
 block discarded – undo
1214 1214
 	 * @return void
1215 1215
 	 */
1216 1216
 	private function maybe_enqueue_flexibility() {
1217
-		if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/MSIE [8-9]/', $_SERVER['HTTP_USER_AGENT'] ) ) {
1217
+		if ( isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) && preg_match( '/MSIE [8-9]/', $_SERVER[ 'HTTP_USER_AGENT' ] ) ) {
1218 1218
 			wp_enqueue_script( 'gv-flexibility' );
1219 1219
 		}
1220 1220
 	}
@@ -1236,7 +1236,7 @@  discard block
 block discarded – undo
1236 1236
 		add_filter( 'gravityview_js_localization', array( $this, 'add_datepicker_localization' ), 10, 2 );
1237 1237
 
1238 1238
 		$scheme = is_ssl() ? 'https://' : 'http://';
1239
-		wp_enqueue_style( 'jquery-ui-datepicker', $scheme.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' );
1239
+		wp_enqueue_style( 'jquery-ui-datepicker', $scheme . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' );
1240 1240
 
1241 1241
 		/**
1242 1242
 		 * @filter `gravityview_search_datepicker_class`
Please login to merge, or discard this patch.