Completed
Push — develop ( 61b96c...a55ed0 )
by Zack
16:44 queued 13:30
created
includes/fields/class-gravityview-field-custom.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@
 block discarded – undo
102 102
 				$field_data = array(
103 103
 					'label' => rgar( $edit_field, 'custom_label' ),
104 104
 					'customLabel' => rgar( $edit_field, 'custom_label' ),
105
-				    'content' => rgar( $edit_field, 'content' ),
105
+					'content' => rgar( $edit_field, 'content' ),
106 106
 				);
107 107
 
108 108
 				// Replace merge tags in the content
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 
41 41
 	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
42 42
 
43
-		unset ( $field_options['search_filter'], $field_options['show_as_link'] );
43
+		unset ( $field_options[ 'search_filter' ], $field_options[ 'show_as_link' ] );
44 44
 
45 45
 		$new_fields = array(
46 46
 			'content' => array(
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
 			),
61 61
 		);
62 62
 
63
-		if( 'edit' === $context ) {
64
-			unset( $field_options['custom_label'], $field_options['show_label'], $field_options['allow_edit_cap'], $new_fields['wpautop'] );
63
+		if ( 'edit' === $context ) {
64
+			unset( $field_options[ 'custom_label' ], $field_options[ 'show_label' ], $field_options[ 'allow_edit_cap' ], $new_fields[ 'wpautop' ] );
65 65
 		}
66 66
 
67 67
 		return $new_fields + $field_options;
@@ -95,9 +95,9 @@  discard block
 block discarded – undo
95 95
 
96 96
 		// Loop through the configured Edit Entry fields and add Custom Content fields if there are any
97 97
 		// TODO: Make this available to other custom GV field types
98
-		foreach ( (array) $edit_fields as $edit_field ) {
98
+		foreach ( (array)$edit_fields as $edit_field ) {
99 99
 
100
-			if( 'custom' === rgar( $edit_field, 'id') ) {
100
+			if ( 'custom' === rgar( $edit_field, 'id' ) ) {
101 101
 
102 102
 				$field_data = array(
103 103
 					'label' => rgar( $edit_field, 'custom_label' ),
@@ -110,13 +110,13 @@  discard block
 block discarded – undo
110 110
 					$field_data[ $key ] = GravityView_Merge_Tags::replace_variables( $field_datum, $form, $entry, false, false );
111 111
 				}
112 112
 
113
-				$field_data['cssClass'] = rgar( $edit_field, 'custom_class' );
113
+				$field_data[ 'cssClass' ] = rgar( $edit_field, 'custom_class' );
114 114
 
115
-				$new_fields[] = new GF_Field_HTML( $field_data );
115
+				$new_fields[ ] = new GF_Field_HTML( $field_data );
116 116
 
117 117
 			} else {
118
-				if( isset( $fields[ $i ] ) ) {
119
-					$new_fields[] =  $fields[ $i ];
118
+				if ( isset( $fields[ $i ] ) ) {
119
+					$new_fields[ ] = $fields[ $i ];
120 120
 				}
121 121
 				$i++;
122 122
 			}
Please login to merge, or discard this patch.
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   +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/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/class-gvlogic-shortcode.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -232,7 +232,7 @@
 block discarded – undo
232 232
 	 * Does the if and the comparison match?
233 233
 	 * @uses GVCommon::matches_operation
234 234
 	 *
235
-	 * @return boolean True: yep; false: nope
235
+	 * @return boolean|null True: yep; false: nope
236 236
 	 */
237 237
 	private function set_is_match() {
238 238
 		$this->is_match = GVCommon::matches_operation( $this->if, $this->comparison, $this->operation );
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 */
86 86
 	public static function get_instance() {
87 87
 
88
-		if( empty( self::$instance ) ) {
88
+		if ( empty( self::$instance ) ) {
89 89
 			self::$instance = new self;
90 90
 		}
91 91
 
@@ -118,9 +118,9 @@  discard block
 block discarded – undo
118 118
 
119 119
 		$operators = array_merge( self::$SUPPORTED_ARRAY_OPERATORS, self::$SUPPORTED_NUMERIC_OPERATORS, self::$SUPPORTED_SCALAR_OPERATORS, self::$SUPPORTED_CUSTOM_OPERATORS );
120 120
 
121
-		if( $with_values ) {
121
+		if ( $with_values ) {
122 122
 			$operators_with_values = array();
123
-			foreach( $operators as $key ) {
123
+			foreach ( $operators as $key ) {
124 124
 				$operators_with_values[ $key ] = '';
125 125
 			}
126 126
 			return $operators_with_values;
@@ -137,14 +137,14 @@  discard block
 block discarded – undo
137 137
 	 */
138 138
 	function set_operation( $operation = '' ) {
139 139
 
140
-		if( empty( $operation ) ) {
140
+		if ( empty( $operation ) ) {
141 141
 			return false;
142 142
 		}
143 143
 
144 144
 		$operators = $this->get_operators( false );
145 145
 
146
-		if( !in_array( $operation, $operators ) ) {
147
-			do_action( 'gravityview_log_debug', __METHOD__ .' Attempted to add invalid operation type.', $operation );
146
+		if ( ! in_array( $operation, $operators ) ) {
147
+			do_action( 'gravityview_log_debug', __METHOD__ . ' Attempted to add invalid operation type.', $operation );
148 148
 			return false;
149 149
 		}
150 150
 
@@ -164,11 +164,11 @@  discard block
 block discarded – undo
164 164
 	 */
165 165
 	private function setup_operation_and_comparison() {
166 166
 
167
-		foreach( $this->atts as $key => $value ) {
167
+		foreach ( $this->atts as $key => $value ) {
168 168
 
169 169
 			$valid = $this->set_operation( $key );
170 170
 
171
-			if( $valid ) {
171
+			if ( $valid ) {
172 172
 				$this->comparison = $value;
173 173
 				return true;
174 174
 			}
@@ -194,8 +194,8 @@  discard block
 block discarded – undo
194 194
 			return null;
195 195
 		}
196 196
 
197
-		if( empty( $atts ) ) {
198
-			do_action( 'gravityview_log_error', __METHOD__.' $atts are empty.', $atts );
197
+		if ( empty( $atts ) ) {
198
+			do_action( 'gravityview_log_error', __METHOD__ . ' $atts are empty.', $atts );
199 199
 			return null;
200 200
 		}
201 201
 
@@ -206,16 +206,16 @@  discard block
 block discarded – undo
206 206
 		$this->parse_atts();
207 207
 
208 208
 		// We need an "if"
209
-		if( false === $this->if ) {
210
-			do_action( 'gravityview_log_error', __METHOD__.' $atts->if is empty.', $this->passed_atts );
209
+		if ( false === $this->if ) {
210
+			do_action( 'gravityview_log_error', __METHOD__ . ' $atts->if is empty.', $this->passed_atts );
211 211
 			return null;
212 212
 		}
213 213
 
214 214
 		$setup = $this->setup_operation_and_comparison();
215 215
 
216 216
 		// We need an operation and comparison value
217
-		if( ! $setup ) {
218
-			do_action( 'gravityview_log_error', __METHOD__.' No valid operators were passed.', $this->atts );
217
+		if ( ! $setup ) {
218
+			do_action( 'gravityview_log_error', __METHOD__ . ' No valid operators were passed.', $this->atts );
219 219
 			return null;
220 220
 		}
221 221
 
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 	 */
249 249
 	private function get_output() {
250 250
 
251
-		if( $this->is_match ) {
251
+		if ( $this->is_match ) {
252 252
 			$output = $this->content;
253 253
 		} else {
254 254
 			$output = $this->else_content;
@@ -262,9 +262,9 @@  discard block
 block discarded – undo
262 262
 		 * @param string $output HTML/text output
263 263
 		 * @param GVLogic_Shortcode $this This class
264 264
 		 */
265
-		$output = apply_filters('gravityview/gvlogic/output', $output, $this );
265
+		$output = apply_filters( 'gravityview/gvlogic/output', $output, $this );
266 266
 
267
-		do_action( 'gravityview_log_debug', __METHOD__ .' Output: ', $output );
267
+		do_action( 'gravityview_log_debug', __METHOD__ . ' Output: ', $output );
268 268
 
269 269
 		return $output;
270 270
 	}
@@ -280,11 +280,11 @@  discard block
 block discarded – undo
280 280
 
281 281
 		$content = explode( '[else]', $this->passed_content );
282 282
 
283
-		$this->content = $content[0];
283
+		$this->content = $content[ 0 ];
284 284
 
285
-		$else_attr = isset( $this->atts['else'] ) ? $this->atts['else'] : NULL;
285
+		$else_attr = isset( $this->atts[ 'else' ] ) ? $this->atts[ 'else' ] : NULL;
286 286
 
287
-		$this->else_content = isset( $content[1] ) ? $content[1] : $else_attr;
287
+		$this->else_content = isset( $content[ 1 ] ) ? $content[ 1 ] : $else_attr;
288 288
 	}
289 289
 
290 290
 	/**
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 		$this->atts = function_exists( 'array_intersect_key' ) ? array_intersect_key( $this->passed_atts, $this->atts ) : $this->atts;
308 308
 
309 309
 		// Strip whitespace if it's not default false
310
-		$this->if = ( isset( $this->atts['if'] ) && is_string( $this->atts['if'] ) ) ? trim( $this->atts['if'] ) : false;
310
+		$this->if = ( isset( $this->atts[ 'if' ] ) && is_string( $this->atts[ 'if' ] ) ) ? trim( $this->atts[ 'if' ] ) : false;
311 311
 
312 312
 		/**
313 313
 		 * @action `gravityview/gvlogic/parse_atts/after` Modify shortcode attributes after it's been parsed
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 		do_action( 'gravityview/gvlogic/parse_atts/after', $this );
319 319
 
320 320
 		// Make sure the "if" isn't processed in self::setup_operation_and_comparison()
321
-		unset( $this->atts['if'] );
321
+		unset( $this->atts[ 'if' ] );
322 322
 	}
323 323
 }
324 324
 
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.