Completed
Push — develop ( 14bc9d...2be206 )
by Zack
23:24 queued 20:16
created
includes/class-common.php 4 patches
Doc Comments   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 	 * Return array of fields' id and label, for a given Form ID
218 218
 	 *
219 219
 	 * @access public
220
-	 * @param string|array $form_id (default: '') or $form object
220
+	 * @param string|array $form (default: '') or $form object
221 221
 	 * @param bool $add_default_properties
222 222
 	 * @param bool $include_parent_field
223 223
 	 * @return array
@@ -882,7 +882,7 @@  discard block
 block discarded – undo
882 882
 	 *
883 883
 	 * @param array $form Gravity Forms form array
884 884
 	 * @param string $field_id ID of the field. If an input, full input ID (like `1.3`)
885
-	 * @param string|array $field_value Raw value of the field.
885
+	 * @param string $field_value Raw value of the field.
886 886
 	 * @return string
887 887
 	 */
888 888
 	public static function get_field_label( $form = array(), $field_id = '', $field_value = '' ) {
@@ -1514,6 +1514,7 @@  discard block
 block discarded – undo
1514 1514
      * @param string $notice text/HTML of notice
1515 1515
      * @param string $class CSS class for notice (`updated` or `error`)
1516 1516
      * @param string $cap [Optional] Define a capability required to show a notice. If not set, displays to all caps.
1517
+     * @param integer $object_id
1517 1518
      *
1518 1519
      * @return string
1519 1520
      */
@@ -1557,9 +1558,9 @@  discard block
 block discarded – undo
1557 1558
 	 * @param string $message            Message body (required)
1558 1559
 	 * @param string $from_name          Displayed name of the sender
1559 1560
 	 * @param string $message_format     If "html", sent text as `text/html`. Otherwise, `text/plain`. Default: "html".
1560
-	 * @param string|array $attachments  Optional. Files to attach. {@see wp_mail()} for usage. Default: "".
1561
+	 * @param string $attachments  Optional. Files to attach. {@see wp_mail()} for usage. Default: "".
1561 1562
 	 * @param array|false $entry         Gravity Forms entry array, related to the email. Default: false.
1562
-	 * @param array|false $notification  Gravity Forms notification that triggered the email. {@see GFCommon::send_notification}. Default:false.
1563
+	 * @param boolean $notification  Gravity Forms notification that triggered the email. {@see GFCommon::send_notification}. Default:false.
1563 1564
 	 */
1564 1565
 	public static function send_email( $from, $to, $bcc, $reply_to, $subject, $message, $from_name = '', $message_format = 'html', $attachments = '', $entry = false, $notification = false ) {
1565 1566
 
Please login to merge, or discard this patch.
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -306,12 +306,12 @@  discard block
 block discarded – undo
306 306
 						}
307 307
 
308 308
 						/**
309
-                         * @hack
310
-                         * In case of email/email confirmation, the input for email has the same id as the parent field
311
-                         */
309
+						 * @hack
310
+						 * In case of email/email confirmation, the input for email has the same id as the parent field
311
+						 */
312 312
 						if( 'email' === $field['type'] && false === strpos( $input['id'], '.' ) ) {
313
-                            continue;
314
-                        }
313
+							continue;
314
+						}
315 315
 						$fields["{$input['id']}"] = array(
316 316
 							'label' => rgar( $input, 'label' ),
317 317
 							'customLabel' => rgar( $input, 'customLabel' ),
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
 		} elseif ( 'delete' === GFForms::get( 'action' ) ) {
489 489
 			$criteria['context_view_id'] = isset( $_GET['view_id'] ) ? intval( $_GET['view_id'] ) : null;
490 490
 		} elseif( !isset( $criteria['context_view_id'] ) ) {
491
-            // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget)
491
+			// Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget)
492 492
 			$criteria['context_view_id'] = null;
493 493
 		}
494 494
 
@@ -1251,7 +1251,7 @@  discard block
 block discarded – undo
1251 1251
 			),
1252 1252
 		);
1253 1253
 
1254
-        $fields = $date_created + $fields;
1254
+		$fields = $date_created + $fields;
1255 1255
 
1256 1256
 		$blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL );
1257 1257
 
@@ -1263,13 +1263,13 @@  discard block
 block discarded – undo
1263 1263
 			}
1264 1264
 		}
1265 1265
 
1266
-        /**
1267
-         * @filter `gravityview/common/sortable_fields` Filter the sortable fields
1268
-         * @since 1.12
1269
-         * @param array $fields Sub-set of GF form fields that are sortable
1270
-         * @param int $formid The Gravity Forms form ID that the fields are from
1271
-         */
1272
-        $fields = apply_filters( 'gravityview/common/sortable_fields', $fields, $formid );
1266
+		/**
1267
+		 * @filter `gravityview/common/sortable_fields` Filter the sortable fields
1268
+		 * @since 1.12
1269
+		 * @param array $fields Sub-set of GF form fields that are sortable
1270
+		 * @param int $formid The Gravity Forms form ID that the fields are from
1271
+		 */
1272
+		$fields = apply_filters( 'gravityview/common/sortable_fields', $fields, $formid );
1273 1273
 
1274 1274
 		return $fields;
1275 1275
 	}
@@ -1561,26 +1561,26 @@  discard block
 block discarded – undo
1561 1561
 	}
1562 1562
 
1563 1563
 
1564
-    /**
1565
-     * Display updated/error notice
1566
-     *
1567
-     * @since 1.19.2 Added $cap and $object_id parameters
1568
-     *
1569
-     * @param string $notice text/HTML of notice
1570
-     * @param string $class CSS class for notice (`updated` or `error`)
1571
-     * @param string $cap [Optional] Define a capability required to show a notice. If not set, displays to all caps.
1572
-     *
1573
-     * @return string
1574
-     */
1575
-    public static function generate_notice( $notice, $class = '', $cap = '', $object_id = null ) {
1576
-
1577
-    	// If $cap is defined, only show notice if user has capability
1578
-    	if( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) {
1579
-    		return '';
1580
-	    }
1581
-
1582
-        return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>';
1583
-    }
1564
+	/**
1565
+	 * Display updated/error notice
1566
+	 *
1567
+	 * @since 1.19.2 Added $cap and $object_id parameters
1568
+	 *
1569
+	 * @param string $notice text/HTML of notice
1570
+	 * @param string $class CSS class for notice (`updated` or `error`)
1571
+	 * @param string $cap [Optional] Define a capability required to show a notice. If not set, displays to all caps.
1572
+	 *
1573
+	 * @return string
1574
+	 */
1575
+	public static function generate_notice( $notice, $class = '', $cap = '', $object_id = null ) {
1576
+
1577
+		// If $cap is defined, only show notice if user has capability
1578
+		if( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) {
1579
+			return '';
1580
+		}
1581
+
1582
+		return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>';
1583
+	}
1584 1584
 
1585 1585
 	/**
1586 1586
 	 * Inspired on \GFCommon::encode_shortcodes, reverse the encoding by replacing the ascii characters by the shortcode brackets
Please login to merge, or discard this patch.
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -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
 
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 
385 385
 		$fields = array();
386 386
 
387
-		foreach ( $extra_fields as $key => $field ){
387
+		foreach ( $extra_fields as $key => $field ) {
388 388
 			if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) {
389 389
 				$fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' );
390 390
 			}
@@ -978,7 +978,7 @@  discard block
 block discarded – undo
978 978
 			$form = GFAPI::get_form( $form );
979 979
 		}
980 980
 
981
-		if ( class_exists( 'GFFormsModel' ) ){
981
+		if ( class_exists( 'GFFormsModel' ) ) {
982 982
 			return GFFormsModel::get_field( $form, $field_id );
983 983
 		} else {
984 984
 			return null;
@@ -1025,7 +1025,7 @@  discard block
 block discarded – undo
1025 1025
 			$shortcodes = array();
1026 1026
 
1027 1027
 			preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER );
1028
-			if ( empty( $matches ) ){
1028
+			if ( empty( $matches ) ) {
1029 1029
 				return false;
1030 1030
 			}
1031 1031
 
Please login to merge, or discard this patch.
Spacing   +113 added lines, -113 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;
@@ -573,9 +573,9 @@  discard block
 block discarded – undo
573 573
 			$entries = apply_filters( 'gravityview_before_get_entries', null, $criteria, $passed_criteria, $total );
574 574
 
575 575
 			// No entries returned from gravityview_before_get_entries
576
-			if( is_null( $entries ) ) {
576
+			if ( is_null( $entries ) ) {
577 577
 
578
-				$entries = GFAPI::get_entries( $form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total );
578
+				$entries = GFAPI::get_entries( $form_ids, $criteria[ 'search_criteria' ], $criteria[ 'sorting' ], $criteria[ 'paging' ], $total );
579 579
 
580 580
 				if ( is_wp_error( $entries ) ) {
581 581
 					do_action( 'gravityview_log_error', $entries->get_error_message(), $entries );
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
 				}
587 587
 			}
588 588
 
589
-			if ( ! empty( $criteria['cache'] ) && isset( $Cache ) ) {
589
+			if ( ! empty( $criteria[ 'cache' ] ) && isset( $Cache ) ) {
590 590
 
591 591
 				// Cache results
592 592
 				$Cache->set( $entries, 'entries' );
@@ -691,12 +691,12 @@  discard block
 block discarded – undo
691 691
 			 */
692 692
 			$check_entry_display = apply_filters( 'gravityview/common/get_entry/check_entry_display', $check_entry_display, $entry );
693 693
 
694
-			if( $check_entry_display ) {
694
+			if ( $check_entry_display ) {
695 695
 				// Is the entry allowed
696 696
 				$entry = self::check_entry_display( $entry );
697 697
 			}
698 698
 
699
-			if( is_wp_error( $entry ) ) {
699
+			if ( is_wp_error( $entry ) ) {
700 700
 				do_action( 'gravityview_log_error', __METHOD__ . ': ' . $entry->get_error_message() );
701 701
 				return false;
702 702
 			}
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
 	 */
728 728
 	public static function matches_operation( $val1, $val2, $operation ) {
729 729
 
730
-		$json_function = function_exists('wp_json_encode') ? 'wp_json_encode' : 'json_encode';
730
+		$json_function = function_exists( 'wp_json_encode' ) ? 'wp_json_encode' : 'json_encode';
731 731
 
732 732
 		// Only process strings
733 733
 		$val1 = ! is_string( $val1 ) ? $json_function( $val1 ) : $val1;
@@ -735,12 +735,12 @@  discard block
 block discarded – undo
735 735
 
736 736
 		$value = false;
737 737
 
738
-		if( 'context' === $val1 ) {
738
+		if ( 'context' === $val1 ) {
739 739
 
740 740
 			$matching_contexts = array( $val2 );
741 741
 
742 742
 			// We allow for non-standard contexts.
743
-			switch( $val2 ) {
743
+			switch ( $val2 ) {
744 744
 				// Check for either single or edit
745 745
 				case 'singular':
746 746
 					$matching_contexts = array( 'single', 'edit' );
@@ -783,7 +783,7 @@  discard block
 block discarded – undo
783 783
 				$json_val_1 = json_decode( $val1, true );
784 784
 				$json_val_2 = json_decode( $val2, true );
785 785
 
786
-				if( ! empty( $json_val_1 ) || ! empty( $json_val_2 ) ) {
786
+				if ( ! empty( $json_val_1 ) || ! empty( $json_val_2 ) ) {
787 787
 
788 788
 					$json_in = false;
789 789
 					$json_val_1 = $json_val_1 ? $json_val_1 : array( $val1 );
@@ -794,7 +794,7 @@  discard block
 block discarded – undo
794 794
 						foreach ( $json_val_2 as $item_2 ) {
795 795
 							$json_in = self::matches_operation( $item_1, $item_2, 'is' );
796 796
 
797
-							if( $json_in ) {
797
+							if ( $json_in ) {
798 798
 								break 2;
799 799
 							}
800 800
 						}
@@ -861,76 +861,76 @@  discard block
 block discarded – undo
861 861
 	public static function check_entry_display( $entry ) {
862 862
 
863 863
 		if ( ! $entry || is_wp_error( $entry ) ) {
864
-			return new WP_Error('entry_not_found', 'Entry was not found.', $entry );
864
+			return new WP_Error( 'entry_not_found', 'Entry was not found.', $entry );
865 865
 		}
866 866
 
867
-		if ( empty( $entry['form_id'] ) ) {
867
+		if ( empty( $entry[ 'form_id' ] ) ) {
868 868
 			return new WP_Error( 'form_id_not_set', '[apply_filters_to_entry] Entry is empty!', $entry );
869 869
 		}
870 870
 
871 871
 		$criteria = self::calculate_get_entries_criteria();
872 872
 
873
-		if ( empty( $criteria['search_criteria'] ) || ! is_array( $criteria['search_criteria'] ) ) {
873
+		if ( empty( $criteria[ 'search_criteria' ] ) || ! is_array( $criteria[ 'search_criteria' ] ) ) {
874 874
 			do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No search criteria found:', $criteria );
875 875
 			return $entry;
876 876
 		}
877 877
 
878 878
 		// Make sure the current View is connected to the same form as the Entry
879
-		if( ! empty( $criteria['context_view_id'] ) ) {
880
-			$context_view_id = intval( $criteria['context_view_id'] );
879
+		if ( ! empty( $criteria[ 'context_view_id' ] ) ) {
880
+			$context_view_id = intval( $criteria[ 'context_view_id' ] );
881 881
 			$context_form_id = gravityview_get_form_id( $context_view_id );
882
-			if( intval( $context_form_id ) !== intval( $entry['form_id'] ) ) {
883
-				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'] );
882
+			if ( intval( $context_form_id ) !== intval( $entry[ 'form_id' ] ) ) {
883
+				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' ] );
884 884
 			}
885 885
 		}
886 886
 
887
-		$search_criteria = $criteria['search_criteria'];
887
+		$search_criteria = $criteria[ 'search_criteria' ];
888 888
 
889 889
 		// check entry status
890
-		if ( array_key_exists( 'status', $search_criteria ) && $search_criteria['status'] != $entry['status'] ) {
891
-			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 );
890
+		if ( array_key_exists( 'status', $search_criteria ) && $search_criteria[ 'status' ] != $entry[ 'status' ] ) {
891
+			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 );
892 892
 		}
893 893
 
894 894
 		// check entry date
895 895
 		// @todo: Does it make sense to apply the Date create filters to the single entry?
896 896
 
897 897
 		// field_filters
898
-		if ( empty( $search_criteria['field_filters'] ) || ! is_array( $search_criteria['field_filters'] ) ) {
898
+		if ( empty( $search_criteria[ 'field_filters' ] ) || ! is_array( $search_criteria[ 'field_filters' ] ) ) {
899 899
 			do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No field filters criteria found:', $search_criteria );
900 900
 			return $entry;
901 901
 		}
902 902
 
903
-		$filters = $search_criteria['field_filters'];
903
+		$filters = $search_criteria[ 'field_filters' ];
904 904
 
905
-		$mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters['mode'] ) : 'all';
905
+		$mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters[ 'mode' ] ) : 'all';
906 906
 
907 907
 		// Prevent the mode from being processed below
908
-		unset( $filters['mode'] );
908
+		unset( $filters[ 'mode' ] );
909 909
 
910
-		$form = self::get_form( $entry['form_id'] );
910
+		$form = self::get_form( $entry[ 'form_id' ] );
911 911
 
912 912
 		foreach ( $filters as $filter ) {
913 913
 
914
-			if ( ! isset( $filter['key'] ) ) {
914
+			if ( ! isset( $filter[ 'key' ] ) ) {
915 915
 				do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Filter key not set', $filter );
916 916
 				continue;
917 917
 			}
918 918
 
919
-			$k = $filter['key'];
919
+			$k = $filter[ 'key' ];
920 920
 
921 921
 			$field = self::get_field( $form, $k );
922 922
 
923 923
 			if ( is_null( $field ) ) {
924 924
 				$field_value = isset( $entry[ $k ] ) ? $entry[ $k ] : null;
925 925
 			} else {
926
-				$field_value  = GFFormsModel::get_lead_field_value( $entry, $field );
926
+				$field_value = GFFormsModel::get_lead_field_value( $entry, $field );
927 927
 				 // If it's a complex field, then fetch the input's value, if exists at the current key. Otherwise, let GF handle it
928 928
 				$field_value = ( is_array( $field_value ) && isset( $field_value[ $k ] ) ) ? rgar( $field_value, $k ) : $field_value;
929 929
 			}
930 930
 
931
-			$operator = isset( $filter['operator'] ) ? strtolower( $filter['operator'] ) : 'is';
931
+			$operator = isset( $filter[ 'operator' ] ) ? strtolower( $filter[ 'operator' ] ) : 'is';
932 932
 
933
-			$is_value_match = GFFormsModel::is_value_match( $field_value, $filter['value'], $operator, $field );
933
+			$is_value_match = GFFormsModel::is_value_match( $field_value, $filter[ 'value' ], $operator, $field );
934 934
 
935 935
 			// Any match is all we need to know
936 936
 			if ( $is_value_match && 'any' === $mode ) {
@@ -939,7 +939,7 @@  discard block
 block discarded – undo
939 939
 
940 940
 			// Any failed match is a total fail
941 941
 			if ( ! $is_value_match && 'all' === $mode ) {
942
-				return new WP_Error('failed_criteria', '[apply_filters_to_entry] Entry cannot be displayed. Failed a criterium for ALL mode', $filter );
942
+				return new WP_Error( 'failed_criteria', '[apply_filters_to_entry] Entry cannot be displayed. Failed a criterium for ALL mode', $filter );
943 943
 			}
944 944
 		}
945 945
 
@@ -949,7 +949,7 @@  discard block
 block discarded – undo
949 949
 			do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved: all conditions were met' );
950 950
 			return $entry;
951 951
 		} else {
952
-			return new WP_Error('failed_any_criteria', '[apply_filters_to_entry] Entry cannot be displayed. Failed all the criteria for ANY mode', $filters );
952
+			return new WP_Error( 'failed_any_criteria', '[apply_filters_to_entry] Entry cannot be displayed. Failed all the criteria for ANY mode', $filters );
953 953
 		}
954 954
 
955 955
 	}
@@ -990,18 +990,18 @@  discard block
 block discarded – undo
990 990
 		 * Gravity Forms code to adjust date to locally-configured Time Zone
991 991
 		 * @see GFCommon::format_date() for original code
992 992
 		 */
993
-		$date_gmt_time   = mysql2date( 'G', $date_string );
993
+		$date_gmt_time = mysql2date( 'G', $date_string );
994 994
 		$date_local_timestamp = GFCommon::get_local_timestamp( $date_gmt_time );
995 995
 
996
-		$format  = rgar( $atts, 'format' );
997
-		$is_human  = ! empty( $atts['human'] );
998
-		$is_diff  = ! empty( $atts['diff'] );
999
-		$is_raw = ! empty( $atts['raw'] );
1000
-		$is_timestamp = ! empty( $atts['timestamp'] );
1001
-		$include_time = ! empty( $atts['time'] );
996
+		$format = rgar( $atts, 'format' );
997
+		$is_human = ! empty( $atts[ 'human' ] );
998
+		$is_diff = ! empty( $atts[ 'diff' ] );
999
+		$is_raw = ! empty( $atts[ 'raw' ] );
1000
+		$is_timestamp = ! empty( $atts[ 'timestamp' ] );
1001
+		$include_time = ! empty( $atts[ 'time' ] );
1002 1002
 
1003 1003
 		// If we're using time diff, we want to have a different default format
1004
-		if( empty( $format ) ) {
1004
+		if ( empty( $format ) ) {
1005 1005
 			/* translators: %s: relative time from now, used for generic date comparisons. "1 day ago", or "20 seconds ago" */
1006 1006
 			$format = $is_diff ? esc_html__( '%s ago', 'gravityview' ) : get_option( 'date_format' );
1007 1007
 		}
@@ -1009,7 +1009,7 @@  discard block
 block discarded – undo
1009 1009
 		// If raw was specified, don't modify the stored value
1010 1010
 		if ( $is_raw ) {
1011 1011
 			$formatted_date = $date_string;
1012
-		} elseif( $is_timestamp ) {
1012
+		} elseif ( $is_timestamp ) {
1013 1013
 			$formatted_date = $date_local_timestamp;
1014 1014
 		} elseif ( $is_diff ) {
1015 1015
 			$formatted_date = sprintf( $format, human_time_diff( $date_gmt_time ) );
@@ -1043,7 +1043,7 @@  discard block
 block discarded – undo
1043 1043
 
1044 1044
 		$label = rgar( $field, 'label' );
1045 1045
 
1046
-		if( floor( $field_id ) !== floatval( $field_id ) ) {
1046
+		if ( floor( $field_id ) !== floatval( $field_id ) ) {
1047 1047
 			$label = GFFormsModel::get_choice_text( $field, $field_value, $field_id );
1048 1048
 		}
1049 1049
 
@@ -1071,7 +1071,7 @@  discard block
 block discarded – undo
1071 1071
 			$form = GFAPI::get_form( $form );
1072 1072
 		}
1073 1073
 
1074
-		if ( class_exists( 'GFFormsModel' ) ){
1074
+		if ( class_exists( 'GFFormsModel' ) ) {
1075 1075
 			return GFFormsModel::get_field( $form, $field_id );
1076 1076
 		} else {
1077 1077
 			return null;
@@ -1118,19 +1118,19 @@  discard block
 block discarded – undo
1118 1118
 			$shortcodes = array();
1119 1119
 
1120 1120
 			preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER );
1121
-			if ( empty( $matches ) ){
1121
+			if ( empty( $matches ) ) {
1122 1122
 				return false;
1123 1123
 			}
1124 1124
 
1125 1125
 			foreach ( $matches as $shortcode ) {
1126
-				if ( $tag === $shortcode[2] ) {
1126
+				if ( $tag === $shortcode[ 2 ] ) {
1127 1127
 
1128 1128
 					// Changed this to $shortcode instead of true so we get the parsed atts.
1129
-					$shortcodes[] = $shortcode;
1129
+					$shortcodes[ ] = $shortcode;
1130 1130
 
1131
-				} else if ( isset( $shortcode[5] ) && $results = self::has_shortcode_r( $shortcode[5], $tag ) ) {
1132
-					foreach( $results as $result ) {
1133
-						$shortcodes[] = $result;
1131
+				} else if ( isset( $shortcode[ 5 ] ) && $results = self::has_shortcode_r( $shortcode[ 5 ], $tag ) ) {
1132
+					foreach ( $results as $result ) {
1133
+						$shortcodes[ ] = $result;
1134 1134
 					}
1135 1135
 				}
1136 1136
 			}
@@ -1274,7 +1274,7 @@  discard block
 block discarded – undo
1274 1274
 	public static function get_directory_fields( $post_id, $apply_filter = true ) {
1275 1275
 		$fields = get_post_meta( $post_id, '_gravityview_directory_fields', true );
1276 1276
 
1277
-		if( $apply_filter ) {
1277
+		if ( $apply_filter ) {
1278 1278
 			/**
1279 1279
 			 * @filter `gravityview/configuration/fields` Filter the View fields' configuration array
1280 1280
 			 * @since 1.6.5
@@ -1297,7 +1297,7 @@  discard block
 block discarded – undo
1297 1297
 	 * @return string         html
1298 1298
 	 */
1299 1299
 	public static function get_sortable_fields( $formid, $current = '' ) {
1300
-		$output = '<option value="" ' . selected( '', $current, false ).'>' . esc_html__( 'Default', 'gravityview' ) .'</option>';
1300
+		$output = '<option value="" ' . selected( '', $current, false ) . '>' . esc_html__( 'Default', 'gravityview' ) . '</option>';
1301 1301
 
1302 1302
 		if ( empty( $formid ) ) {
1303 1303
 			return $output;
@@ -1310,11 +1310,11 @@  discard block
 block discarded – undo
1310 1310
 			$blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', array( 'list', 'textarea' ), null );
1311 1311
 
1312 1312
 			foreach ( $fields as $id => $field ) {
1313
-				if ( in_array( $field['type'], $blacklist_field_types ) ) {
1313
+				if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
1314 1314
 					continue;
1315 1315
 				}
1316 1316
 
1317
-				$output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'>'. esc_attr( $field['label'] ) .'</option>';
1317
+				$output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . '>' . esc_attr( $field[ 'label' ] ) . '</option>';
1318 1318
 			}
1319 1319
 		}
1320 1320
 
@@ -1349,9 +1349,9 @@  discard block
 block discarded – undo
1349 1349
 		$blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL );
1350 1350
 
1351 1351
 		// TODO: Convert to using array_filter
1352
-		foreach( $fields as $id => $field ) {
1352
+		foreach ( $fields as $id => $field ) {
1353 1353
 
1354
-			if( in_array( $field['type'], $blacklist_field_types ) ) {
1354
+			if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
1355 1355
 				unset( $fields[ $id ] );
1356 1356
 			}
1357 1357
 		}
@@ -1392,14 +1392,14 @@  discard block
 block discarded – undo
1392 1392
 	 * @param  int|array  $field field key or field array
1393 1393
 	 * @return boolean
1394 1394
 	 */
1395
-	public static function is_field_numeric(  $form = null, $field = '' ) {
1395
+	public static function is_field_numeric( $form = null, $field = '' ) {
1396 1396
 
1397 1397
 		if ( ! is_array( $form ) && ! is_array( $field ) ) {
1398 1398
 			$form = self::get_form( $form );
1399 1399
 		}
1400 1400
 
1401 1401
 		// If entry meta, it's a string. Otherwise, numeric
1402
-		if( ! is_numeric( $field ) && is_string( $field ) ) {
1402
+		if ( ! is_numeric( $field ) && is_string( $field ) ) {
1403 1403
 			$type = $field;
1404 1404
 		} else {
1405 1405
 			$type = self::get_field_type( $form, $field );
@@ -1413,9 +1413,9 @@  discard block
 block discarded – undo
1413 1413
 		$numeric_types = apply_filters( 'gravityview/common/numeric_types', array( 'number', 'time' ) );
1414 1414
 
1415 1415
 		// Defer to GravityView_Field setting, if the field type is registered and `is_numeric` is true
1416
-		if( $gv_field = GravityView_Fields::get( $type ) ) {
1417
-			if( true === $gv_field->is_numeric ) {
1418
-				$numeric_types[] = $gv_field->is_numeric;
1416
+		if ( $gv_field = GravityView_Fields::get( $type ) ) {
1417
+			if ( true === $gv_field->is_numeric ) {
1418
+				$numeric_types[ ] = $gv_field->is_numeric;
1419 1419
 			}
1420 1420
 		}
1421 1421
 
@@ -1565,18 +1565,18 @@  discard block
 block discarded – undo
1565 1565
 		$final_atts = array_filter( $final_atts );
1566 1566
 
1567 1567
 		// If the href wasn't passed as an attribute, use the value passed to the function
1568
-		if ( empty( $final_atts['href'] ) && ! empty( $href ) ) {
1569
-			$final_atts['href'] = $href;
1568
+		if ( empty( $final_atts[ 'href' ] ) && ! empty( $href ) ) {
1569
+			$final_atts[ 'href' ] = $href;
1570 1570
 		}
1571 1571
 
1572
-		$final_atts['href'] = esc_url_raw( $href );
1572
+		$final_atts[ 'href' ] = esc_url_raw( $href );
1573 1573
 
1574 1574
 		/**
1575 1575
 		 * Fix potential security issue with target=_blank
1576 1576
 		 * @see https://dev.to/ben/the-targetblank-vulnerability-by-example
1577 1577
 		 */
1578
-		if( '_blank' === rgar( $final_atts, 'target' ) ) {
1579
-			$final_atts['rel'] = trim( rgar( $final_atts, 'rel', '' ) . ' noopener noreferrer' );
1578
+		if ( '_blank' === rgar( $final_atts, 'target' ) ) {
1579
+			$final_atts[ 'rel' ] = trim( rgar( $final_atts, 'rel', '' ) . ' noopener noreferrer' );
1580 1580
 		}
1581 1581
 
1582 1582
 		// Sort the attributes alphabetically, to help testing
@@ -1588,7 +1588,7 @@  discard block
 block discarded – undo
1588 1588
 			$output .= sprintf( ' %s="%s"', $attr, esc_attr( $value ) );
1589 1589
 		}
1590 1590
 
1591
-		if( '' !== $output ) {
1591
+		if ( '' !== $output ) {
1592 1592
 			$output = '<a' . $output . '>' . $anchor_text . '</a>';
1593 1593
 		}
1594 1594
 
@@ -1615,7 +1615,7 @@  discard block
 block discarded – undo
1615 1615
 			if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) {
1616 1616
 				$merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value );
1617 1617
 			} else if ( is_numeric( $key ) && isset( $merged[ $key ] ) ) {
1618
-				$merged[] = $value;
1618
+				$merged[ ] = $value;
1619 1619
 			} else {
1620 1620
 				$merged[ $key ] = $value;
1621 1621
 			}
@@ -1648,7 +1648,7 @@  discard block
 block discarded – undo
1648 1648
 		 * `$context` is where are we using this information (e.g. change_entry_creator, search_widget ..)
1649 1649
 		 * @param array $settings Settings array, with `number` key defining the # of users to display
1650 1650
 		 */
1651
-		$get_users_settings = apply_filters( 'gravityview/get_users/'. $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) );
1651
+		$get_users_settings = apply_filters( 'gravityview/get_users/' . $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) );
1652 1652
 
1653 1653
 		return get_users( $get_users_settings );
1654 1654
 	}
@@ -1668,11 +1668,11 @@  discard block
 block discarded – undo
1668 1668
     public static function generate_notice( $notice, $class = '', $cap = '', $object_id = null ) {
1669 1669
 
1670 1670
     	// If $cap is defined, only show notice if user has capability
1671
-    	if( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) {
1671
+    	if ( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) {
1672 1672
     		return '';
1673 1673
 	    }
1674 1674
 
1675
-        return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>';
1675
+        return '<div class="gv-notice ' . gravityview_sanitize_html_class( $class ) . '">' . $notice . '</div>';
1676 1676
     }
1677 1677
 
1678 1678
 	/**
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-approval.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 
23 23
 		$this->label = esc_attr__( 'Approve Entries', 'gravityview' );
24 24
 
25
-		$this->description =  esc_attr__( 'Approve and reject entries from the View.', 'gravityview' );
25
+		$this->description = esc_attr__( 'Approve and reject entries from the View.', 'gravityview' );
26 26
 
27 27
 		$this->add_hooks();
28 28
 
@@ -44,11 +44,11 @@  discard block
 block discarded – undo
44 44
 	 */
45 45
 	function field_options( $field_options, $template_id = '', $field_id = '', $context = '', $input_type = '' ) {
46 46
 
47
-		unset( $field_options['only_loggedin'] );
47
+		unset( $field_options[ 'only_loggedin' ] );
48 48
 
49
-		unset( $field_options['new_window'] );
49
+		unset( $field_options[ 'new_window' ] );
50 50
 
51
-		unset( $field_options['show_as_link'] );
51
+		unset( $field_options[ 'show_as_link' ] );
52 52
 
53 53
 		return $field_options;
54 54
 	}
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 
69 69
 		add_action( 'gravityview/field/approval/load_scripts', array( $this, 'enqueue_and_localize_script' ) );
70 70
 
71
-		add_action( 'gravityview_datatables_scripts_styles',  array( $this, 'enqueue_and_localize_script' ) );
71
+		add_action( 'gravityview_datatables_scripts_styles', array( $this, 'enqueue_and_localize_script' ) );
72 72
 
73 73
 		add_filter( 'gravityview_get_entries', array( $this, 'modify_search_parameters' ), 1000 );
74 74
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	public function maybe_prevent_field_render( $html, $args ) {
89 89
 
90 90
 		// If the field is `entry_approval` type but the user doesn't have the moderate entries cap, don't render.
91
-		if( $this->name === rgar( $args['field'], 'id' ) && ! GVCommon::has_cap('gravityview_moderate_entries') ) {
91
+		if ( $this->name === rgar( $args[ 'field' ], 'id' ) && ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
92 92
 			return '';
93 93
 		}
94 94
 
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
 	 */
105 105
 	public function modify_search_parameters( $parameters ) {
106 106
 
107
-		if( $this->name === rgars( $parameters, 'sorting/key' ) ) {
108
-			$parameters['sorting']['key'] = 'is_approved';
107
+		if ( $this->name === rgars( $parameters, 'sorting/key' ) ) {
108
+			$parameters[ 'sorting' ][ 'key' ] = 'is_approved';
109 109
 		}
110 110
 
111 111
 		return $parameters;
@@ -121,18 +121,18 @@  discard block
 block discarded – undo
121 121
 	function register_scripts_and_styles() {
122 122
 		$script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
123 123
 
124
-		wp_register_script( 'gravityview-field-approval', GRAVITYVIEW_URL . 'assets/js/field-approval'.$script_debug.'.js', array( 'jquery' ), GravityView_Plugin::version, true );
124
+		wp_register_script( 'gravityview-field-approval', GRAVITYVIEW_URL . 'assets/js/field-approval' . $script_debug . '.js', array( 'jquery' ), GravityView_Plugin::version, true );
125 125
 
126 126
 		$style_path = GRAVITYVIEW_DIR . 'templates/css/field-approval.css';
127 127
 
128
-		if( class_exists( 'GravityView_View' ) ) {
128
+		if ( class_exists( 'GravityView_View' ) ) {
129 129
 			/**
130 130
 			 * Override CSS file by placing in your theme's /gravityview/css/ sub-directory.
131 131
 			 */
132 132
 			$style_path = GravityView_View::getInstance()->locate_template( 'css/field-approval.css', false );
133 133
 		}
134 134
 
135
-		$style_url = plugins_url( 'css/field-approval.css', trailingslashit( dirname( $style_path ) )  );
135
+		$style_url = plugins_url( 'css/field-approval.css', trailingslashit( dirname( $style_path ) ) );
136 136
 
137 137
 		/**
138 138
 		 * @filter `gravityview/field/approval/css_url` URL to the Approval field CSS file.
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 		 */
142 142
 		$style_url = apply_filters( 'gravityview/field/approval/css_url', $style_url );
143 143
 
144
-		if( ! empty( $style_url ) ) {
144
+		if ( ! empty( $style_url ) ) {
145 145
 			wp_register_style( 'gravityview-field-approval', $style_url, array( 'dashicons' ), GravityView_Plugin::version, 'screen' );
146 146
 		}
147 147
 
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 	public function enqueue_and_localize_script() {
157 157
 
158 158
 		// The script is already registered and enqueued
159
-		if( wp_script_is( 'gravityview-field-approval', 'enqueued' ) ) {
159
+		if ( wp_script_is( 'gravityview-field-approval', 'enqueued' ) ) {
160 160
 			return;
161 161
 		}
162 162
 
@@ -166,9 +166,9 @@  discard block
 block discarded – undo
166 166
 
167 167
 		wp_localize_script( 'gravityview-field-approval', 'gvApproval', array(
168 168
 			'ajaxurl' => admin_url( 'admin-ajax.php' ),
169
-			'nonce' => wp_create_nonce('gravityview_entry_approval'),
169
+			'nonce' => wp_create_nonce( 'gravityview_entry_approval' ),
170 170
 			'status' => GravityView_Entry_Approval_Status::get_all(),
171
-		));
171
+		) );
172 172
 
173 173
 	}
174 174
 
@@ -185,8 +185,8 @@  discard block
 block discarded – undo
185 185
 	 */
186 186
 	public function filter_gravityview_entry_default_field( $entry_default_fields, $form, $context ) {
187 187
 
188
-		if ( ! isset( $entry_default_fields["{$this->name}"] ) && 'edit' !== $context ) {
189
-			$entry_default_fields["{$this->name}"] = array(
188
+		if ( ! isset( $entry_default_fields[ "{$this->name}" ] ) && 'edit' !== $context ) {
189
+			$entry_default_fields[ "{$this->name}" ] = array(
190 190
 				'label' => $this->label,
191 191
 				'desc'  => $this->description,
192 192
 				'type'  => $this->name,
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-address.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
 
59 59
 			if ( 'address' === rgar( $search_field, 'type' ) ) {
60 60
 
61
-				$field_id = intval( floor( $search_field['key'] ) );
62
-				$input_id = gravityview_get_input_id_from_id( $search_field['key'] );
61
+				$field_id = intval( floor( $search_field[ 'key' ] ) );
62
+				$input_id = gravityview_get_input_id_from_id( $search_field[ 'key' ] );
63 63
 				$form = GravityView_View::getInstance()->getForm();
64 64
 
65 65
 				/** @var GF_Field_Address $address_field */
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 				$choices = array();
69 69
 
70 70
 				$method_name = 'get_choices_' . self::get_input_type_from_input_id( $input_id );
71
-				if( method_exists( $this, $method_name ) ) {
71
+				if ( method_exists( $this, $method_name ) ) {
72 72
 					/**
73 73
 					 * @uses GravityView_Field_Address::get_choices_country()
74 74
 					 * @uses GravityView_Field_Address::get_choices_state()
@@ -76,12 +76,12 @@  discard block
 block discarded – undo
76 76
 					$choices = $this->{$method_name}( $address_field );
77 77
 				}
78 78
 
79
-				if( ! empty( $choices ) ) {
80
-					$search_field['choices'] = $choices;
81
-					$search_field['type'] = rgar( $search_field, 'input');
79
+				if ( ! empty( $choices ) ) {
80
+					$search_field[ 'choices' ] = $choices;
81
+					$search_field[ 'type' ] = rgar( $search_field, 'input' );
82 82
 				} else {
83
-					$search_field['type'] = 'text';
84
-					$search_field['input'] = 'input_text';
83
+					$search_field[ 'type' ] = 'text';
84
+					$search_field[ 'input' ] = 'input_text';
85 85
 				}
86 86
 			}
87 87
 		}
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 		$country_choices = array();
108 108
 
109 109
 		foreach ( $countries as $key => $country ) {
110
-			$country_choices[] = array(
110
+			$country_choices[ ] = array(
111 111
 				'value' => $country,
112 112
 				'text' => $country,
113 113
 			);
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 	 */
132 132
 	private function get_choices_state( $address_field ) {
133 133
 
134
-		$address_type = empty( $address_field->addressType ) ? $address_field->get_default_address_type( $form['id'] ) : $address_field->addressType;
134
+		$address_type = empty( $address_field->addressType ) ? $address_field->get_default_address_type( $form[ 'id' ] ) : $address_field->addressType;
135 135
 
136 136
 		$state_choices = array();
137 137
 
@@ -143,12 +143,12 @@  discard block
 block discarded – undo
143 143
 				$states = GFCommon::get_canadian_provinces();
144 144
 				break;
145 145
 			default:
146
-				$states = empty( $address_types[ $address_type ]['states'] ) ? array() : $address_types[ $address_type ]['states'];
146
+				$states = empty( $address_types[ $address_type ][ 'states' ] ) ? array() : $address_types[ $address_type ][ 'states' ];
147 147
 				break;
148 148
 		}
149 149
 
150 150
 		foreach ( $states as $key => $state ) {
151
-			$state_choices[] = array(
151
+			$state_choices[ ] = array(
152 152
 				'value' => $state,
153 153
 				'text' => $state,
154 154
 			);
@@ -171,13 +171,13 @@  discard block
 block discarded – undo
171 171
 		// Use the same inputs as the "text" input type allows
172 172
 		$text_inputs = rgar( $input_types, 'text' );
173 173
 
174
-		$input_types['street'] = $text_inputs;
175
-		$input_types['street2'] = $text_inputs;
176
-		$input_types['city'] = $text_inputs;
174
+		$input_types[ 'street' ] = $text_inputs;
175
+		$input_types[ 'street2' ] = $text_inputs;
176
+		$input_types[ 'city' ] = $text_inputs;
177 177
 
178
-		$input_types['state'] = array( 'select', 'radio', 'link' ) + $text_inputs;
179
-		$input_types['zip'] = array( 'input_text' );
180
-		$input_types['country'] = array( 'select', 'radio', 'link' ) + $text_inputs;
178
+		$input_types[ 'state' ] = array( 'select', 'radio', 'link' ) + $text_inputs;
179
+		$input_types[ 'zip' ] = array( 'input_text' );
180
+		$input_types[ 'country' ] = array( 'select', 'radio', 'link' ) + $text_inputs;
181 181
 
182 182
 		return $input_types;
183 183
 	}
@@ -198,10 +198,10 @@  discard block
 block discarded – undo
198 198
 		// Is this search field for an input (eg: 4.2) or the whole address field (eg: 4)?
199 199
 		$input_id = gravityview_get_input_id_from_id( $field_id );
200 200
 
201
-		if( 'address' === $field_type && $input_id ) {
201
+		if ( 'address' === $field_type && $input_id ) {
202 202
 
203 203
 			// If the input ID matches an expected address input, set to that. Otherwise, keep existing input type.
204
-			if( $address_field_name = self::get_input_type_from_input_id( $input_id ) ) {
204
+			if ( $address_field_name = self::get_input_type_from_input_id( $input_id ) ) {
205 205
 				$input_type = $address_field_name;
206 206
 			}
207 207
 		}
@@ -250,20 +250,20 @@  discard block
 block discarded – undo
250 250
 	function field_options( $field_options, $template_id = '', $field_id = '', $context = '', $input_type = '' ) {
251 251
 
252 252
 		// If this is NOT the full address field, return default options.
253
-		if( floor( $field_id ) !== floatval( $field_id ) ) {
253
+		if ( floor( $field_id ) !== floatval( $field_id ) ) {
254 254
 			return $field_options;
255 255
 		}
256 256
 
257
-		if( 'edit' === $context ) {
257
+		if ( 'edit' === $context ) {
258 258
 			return $field_options;
259 259
 		}
260 260
 
261 261
 		$add_options = array();
262 262
 
263
-		$add_options['show_map_link'] = array(
263
+		$add_options[ 'show_map_link' ] = array(
264 264
 			'type' => 'checkbox',
265 265
 			'label' => __( 'Show Map Link:', 'gravityview' ),
266
-			'desc' => __('Display a "Map It" link below the address', 'gravityview'),
266
+			'desc' => __( 'Display a "Map It" link below the address', 'gravityview' ),
267 267
 			'value' => true,
268 268
 			'merge_tags' => false,
269 269
 		);
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-transaction-id.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 
15 15
 	var $is_numeric = true;
16 16
 
17
-	var $search_operators = array( 'is', 'isnot', 'starts_with', 'ends_with'  );
17
+	var $search_operators = array( 'is', 'isnot', 'starts_with', 'ends_with' );
18 18
 
19 19
 	var $group = 'pricing';
20 20
 
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-checkbox.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
 		$field_options = parent::field_options( $field_options, $template_id, $field_id, $context, $input_type );
46 46
 
47 47
 		// It's not the parent field; it's an input
48
-		if( floor( $field_id ) !== floatval( $field_id ) ) {
48
+		if ( floor( $field_id ) !== floatval( $field_id ) ) {
49 49
 
50
-			if( $this->is_choice_value_enabled() ) {
50
+			if ( $this->is_choice_value_enabled() ) {
51 51
 
52 52
 				$desc = esc_html__( 'This input has a label and a value. What should be displayed?', 'gravityview' );
53 53
 				$default = 'value';
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 				);
66 66
 			}
67 67
 
68
-			$field_options['choice_display'] = array(
68
+			$field_options[ 'choice_display' ] = array(
69 69
 				'type'    => 'radio',
70 70
 				'class'   => 'vertical',
71 71
 				'label'   => __( 'What should be displayed:', 'gravityview' ),
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-product.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	function clear_product_info_cache( $form = array(), $entry_id = 0, $Edit_Entry_Render = null ) {
51 51
 
52
-		if( $this->should_hide_product_fields( $Edit_Entry_Render->entry ) ) {
52
+		if ( $this->should_hide_product_fields( $Edit_Entry_Render->entry ) ) {
53 53
 			return;
54 54
 		}
55 55
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 		 * @see GVCommon::entry_has_transaction_data()
102 102
 		 * @param boolean $hide_product_fields Whether to hide product fields in the editor. Uses $entry data to determine.
103 103
 		 */
104
-		$hide_product_fields = (bool) apply_filters( 'gravityview/edit_entry/hide-product-fields', $has_transaction_data );
104
+		$hide_product_fields = (bool)apply_filters( 'gravityview/edit_entry/hide-product-fields', $has_transaction_data );
105 105
 
106 106
 		return $hide_product_fields;
107 107
 	}
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -245,7 +245,7 @@
 block discarded – undo
245 245
 	 * @param bool $url_encode Whether to URL-encode output
246 246
 	 * @param bool $esc_html Whether to apply `esc_html()` to output
247 247
 	 *
248
-	 * @return mixed
248
+	 * @return string
249 249
 	 */
250 250
 	public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
251 251
 
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -134,17 +134,17 @@  discard block
 block discarded – undo
134 134
 
135 135
 		add_filter( 'gravityview/sortable/field_blacklist', array( $this, '_filter_sortable_fields' ), 1 );
136 136
 
137
-		if( $this->entry_meta_key ) {
137
+		if ( $this->entry_meta_key ) {
138 138
 			add_filter( 'gform_entry_meta', array( $this, 'add_entry_meta' ) );
139 139
 			add_filter( 'gravityview/common/sortable_fields', array( $this, 'add_sortable_field' ), 10, 2 );
140 140
 		}
141 141
 
142
-		if( $this->_custom_merge_tag ) {
142
+		if ( $this->_custom_merge_tag ) {
143 143
 			add_filter( 'gform_custom_merge_tags', array( $this, '_filter_gform_custom_merge_tags' ), 10, 4 );
144 144
 			add_filter( 'gform_replace_merge_tags', array( $this, '_filter_gform_replace_merge_tags' ), 10, 7 );
145 145
 		}
146 146
 
147
-		if( 'meta' === $this->group || '' !== $this->default_search_label ) {
147
+		if ( 'meta' === $this->group || '' !== $this->default_search_label ) {
148 148
 			add_filter( 'gravityview_search_field_label', array( $this, 'set_default_search_label' ), 10, 3 );
149 149
 		}
150 150
 
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 		 * Auto-assign label from Gravity Forms label, if exists
153 153
 		 * @since 1.20
154 154
 		 */
155
-		if( empty( $this->label ) && ! empty( $this->_gf_field_class_name ) && class_exists( $this->_gf_field_class_name ) ) {
155
+		if ( empty( $this->label ) && ! empty( $this->_gf_field_class_name ) && class_exists( $this->_gf_field_class_name ) ) {
156 156
 			$this->label = ucfirst( GF_Fields::get( $this->name )->get_form_editor_field_title() );
157 157
 		}
158 158
 
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 			'type'  => $this->name
176 176
 		);
177 177
 
178
-		$fields["{$this->entry_meta_key}"] = $added_field;
178
+		$fields[ "{$this->entry_meta_key}" ] = $added_field;
179 179
 
180 180
 		return $fields;
181 181
 	}
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	 */
196 196
 	function set_default_search_label( $label = '', $gf_field = null, $field = array() ) {
197 197
 
198
-		if( $this->name === $field['field'] && '' === $label ) {
198
+		if ( $this->name === $field[ 'field' ] && '' === $label ) {
199 199
 			$label = esc_html( $this->default_search_label );
200 200
 		}
201 201
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 	 *
217 217
 	 * @return string Original text if {_custom_merge_tag} isn't found. Otherwise, replaced text.
218 218
 	 */
219
-	public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false  ) {
219
+	public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
220 220
 
221 221
 		// Is there is field merge tag? Strip whitespace off the ned, too.
222 222
 		preg_match_all( '/{' . preg_quote( $this->_custom_merge_tag ) . ':?(.*?)(?:\s)?}/ism', $text, $matches, PREG_SET_ORDER );
@@ -247,19 +247,19 @@  discard block
 block discarded – undo
247 247
 	 */
248 248
 	public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
249 249
 
250
-		foreach( $matches as $match ) {
250
+		foreach ( $matches as $match ) {
251 251
 
252
-			$full_tag = $match[0];
252
+			$full_tag = $match[ 0 ];
253 253
 
254 254
 			// Strip the Merge Tags
255
-			$tag = str_replace( array( '{', '}'), '', $full_tag );
255
+			$tag = str_replace( array( '{', '}' ), '', $full_tag );
256 256
 
257 257
 			// Replace the value from the entry, if exists
258
-			if( isset( $entry[ $tag ] ) ) {
258
+			if ( isset( $entry[ $tag ] ) ) {
259 259
 
260 260
 				$value = $entry[ $tag ];
261 261
 
262
-				if( is_callable( array( $this, 'get_content') ) ) {
262
+				if ( is_callable( array( $this, 'get_content' ) ) ) {
263 263
 					$value = $this->get_content( $value );
264 264
 				}
265 265
 
@@ -332,8 +332,8 @@  discard block
 block discarded – undo
332 332
 	 */
333 333
 	public function _filter_sortable_fields( $not_sortable ) {
334 334
 
335
-		if( ! $this->is_sortable ) {
336
-			$not_sortable[] = $this->name;
335
+		if ( ! $this->is_sortable ) {
336
+			$not_sortable[ ] = $this->name;
337 337
 		}
338 338
 
339 339
 		return $not_sortable;
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 	 */
351 351
 	function add_entry_meta( $entry_meta ) {
352 352
 
353
-		if( ! isset( $entry_meta["{$this->entry_meta_key}"] ) ) {
353
+		if ( ! isset( $entry_meta[ "{$this->entry_meta_key}" ] ) ) {
354 354
 
355 355
 			$added_meta = array(
356 356
 				'label'             => $this->label,
@@ -359,13 +359,13 @@  discard block
 block discarded – undo
359 359
 			);
360 360
 
361 361
 			if ( $this->entry_meta_update_callback && is_callable( $this->entry_meta_update_callback ) ) {
362
-				$added_meta['update_entry_meta_callback'] = $this->entry_meta_update_callback;
362
+				$added_meta[ 'update_entry_meta_callback' ] = $this->entry_meta_update_callback;
363 363
 			}
364 364
 
365
-			$entry_meta["{$this->entry_meta_key}"] = $added_meta;
365
+			$entry_meta[ "{$this->entry_meta_key}" ] = $added_meta;
366 366
 
367 367
 		} else {
368
-			do_action( 'gravityview_log_error', __METHOD__ . ' Entry meta already set: ' . $this->entry_meta_key, $entry_meta["{$this->entry_meta_key}"] );
368
+			do_action( 'gravityview_log_error', __METHOD__ . ' Entry meta already set: ' . $this->entry_meta_key, $entry_meta[ "{$this->entry_meta_key}" ] );
369 369
 		}
370 370
 
371 371
 		return $entry_meta;
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 			'date_display' => array(
395 395
 				'type' => 'text',
396 396
 				'label' => __( 'Override Date Format', 'gravityview' ),
397
-				'desc' => sprintf( __( 'Define how the date is displayed (using %sthe PHP date format%s)', 'gravityview'), '<a href="https://codex.wordpress.org/Formatting_Date_and_Time">', '</a>' ),
397
+				'desc' => sprintf( __( 'Define how the date is displayed (using %sthe PHP date format%s)', 'gravityview' ), '<a href="https://codex.wordpress.org/Formatting_Date_and_Time">', '</a>' ),
398 398
 				/**
399 399
 				 * @filter `gravityview_date_format` Override the date format with a [PHP date format](https://codex.wordpress.org/Formatting_Date_and_Time)
400 400
 				 * @param[in,out] null|string $date_format Date Format (default: null)
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 
420 420
 		$options = $this->field_support_options();
421 421
 
422
-		if( isset( $options[ $key ] ) ) {
422
+		if ( isset( $options[ $key ] ) ) {
423 423
 			$field_options[ $key ] = $options[ $key ];
424 424
 		}
425 425
 
@@ -483,11 +483,11 @@  discard block
 block discarded – undo
483 483
 		$connected_form = rgpost( 'form_id' );
484 484
 
485 485
 		// Otherwise, get the Form ID from the Post page
486
-		if( empty( $connected_form ) ) {
486
+		if ( empty( $connected_form ) ) {
487 487
 			$connected_form = gravityview_get_form_id( get_the_ID() );
488 488
 		}
489 489
 
490
-		if( empty( $connected_form ) ) {
490
+		if ( empty( $connected_form ) ) {
491 491
 			do_action( 'gravityview_log_error', sprintf( '%s: Form not found for form ID "%s"', __METHOD__, $connected_form ) );
492 492
 			return false;
493 493
 		}
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-post-image.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -23,16 +23,16 @@  discard block
 block discarded – undo
23 23
 
24 24
 	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
25 25
 
26
-		unset ( $field_options['search_filter'] );
26
+		unset ( $field_options[ 'search_filter' ] );
27 27
 
28
-		if( 'edit' === $context ) {
28
+		if ( 'edit' === $context ) {
29 29
 			return $field_options;
30 30
 		}
31 31
 
32
-		$this->add_field_support('link_to_post', $field_options );
32
+		$this->add_field_support( 'link_to_post', $field_options );
33 33
 
34 34
 		// @since 1.5.4
35
-		$this->add_field_support('dynamic_data', $field_options );
35
+		$this->add_field_support( 'dynamic_data', $field_options );
36 36
 
37 37
 		return $field_options;
38 38
 	}
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 		$url = $title = $caption = $description = '';
60 60
 
61 61
 		// If there's a |:| match, process. Otherwise, empty array!
62
-		if( preg_match( '/\|\:\|/', $value ) ) {
62
+		if ( preg_match( '/\|\:\|/', $value ) ) {
63 63
 			list( $url, $title, $caption, $description ) = array_pad( explode( '|:|', $value ), 4, false );
64 64
 		}
65 65
 
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
 	 */
89 89
 	public function get_field_input( $form, $value = '', $entry = null, GF_Field_Post_Image $field ) {
90 90
 
91
-		$id = (int) $field->id;
92
-		$form_id = $form['id'];
91
+		$id = (int)$field->id;
92
+		$form_id = $form[ 'id' ];
93 93
 		$input_name = "input_{$id}";
94 94
 		$field_id = sprintf( 'input_%d_%d', $form_id, $id );
95 95
 		$img_name = null;
@@ -97,16 +97,16 @@  discard block
 block discarded – undo
97 97
 		// Convert |:| to associative array
98 98
 		$img_array = self::explode_value( $value );
99 99
 
100
-		if( ! empty( $img_array['url'] ) ) {
100
+		if ( ! empty( $img_array[ 'url' ] ) ) {
101 101
 
102
-			$img_name = basename( $img_array['url'] );
102
+			$img_name = basename( $img_array[ 'url' ] );
103 103
 
104 104
 			/**
105 105
 			 * Set the $uploaded_files value so that the .ginput_preview renders, and the file upload is hidden
106 106
 			 * @see GF_Field_Post_Image::get_field_input See the `<span class='ginput_preview'>` code
107 107
 			 * @see GFFormsModel::get_temp_filename See the `rgget( $input_name, self::$uploaded_files[ $form_id ] );` code
108 108
 			 */
109
-			if( empty( GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] ) ) {
109
+			if ( empty( GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] ) ) {
110 110
 				GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] = $img_name;
111 111
 			}
112 112
 		}
@@ -135,8 +135,8 @@  discard block
 block discarded – undo
135 135
 		 * @hack
136 136
 		 */
137 137
 		if ( null !== $img_name ) {
138
-			$current_file = sprintf( "<input name='%s' id='%s' type='hidden' value='%s' />", $input_name, $field_id, esc_url_raw( $img_array['url'] ) );
139
-			$gf_post_image_field_output = str_replace('<span class=\'ginput_preview\'>', '<span class=\'ginput_preview\'>'.$current_file, $gf_post_image_field_output );
138
+			$current_file = sprintf( "<input name='%s' id='%s' type='hidden' value='%s' />", $input_name, $field_id, esc_url_raw( $img_array[ 'url' ] ) );
139
+			$gf_post_image_field_output = str_replace( '<span class=\'ginput_preview\'>', '<span class=\'ginput_preview\'>' . $current_file, $gf_post_image_field_output );
140 140
 		}
141 141
 
142 142
 		return $gf_post_image_field_output;
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-multiselect.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
 	 * @see GFCommon::get_field_filter_settings Gravity Forms suggests checkboxes should just be "contains"
14 14
 	 * @var array
15 15
 	 */
16
-	var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains');
16
+	var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains' );
17 17
 
18 18
 	var $is_searchable = true;
19 19
 
Please login to merge, or discard this patch.