Completed
Pull Request — master (#778)
by Zack
07:56 queued 03:54
created
includes/admin/class-gravityview-admin-view-field.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -15,29 +15,29 @@
 block discarded – undo
15 15
 		$field_info_items = array();
16 16
 
17 17
 		// Fields with IDs, not like Source URL or Entry ID
18
-		if( is_numeric( $this->id ) ) {
18
+		if ( is_numeric( $this->id ) ) {
19 19
 
20
-			$field_type_title = GFCommon::get_field_type_title( $this->item['input_type'] );
20
+			$field_type_title = GFCommon::get_field_type_title( $this->item[ 'input_type' ] );
21 21
 
22
-			$field_info_items[] = array(
23
-				'value' => sprintf( __('Type: %s', 'gravityview'), $field_type_title )
22
+			$field_info_items[ ] = array(
23
+				'value' => sprintf( __( 'Type: %s', 'gravityview' ), $field_type_title )
24 24
 			);
25 25
 
26
-			$field_info_items[] = array(
27
-				'value' => sprintf( __('Field ID: %s', 'gravityview'), $this->id ),
26
+			$field_info_items[ ] = array(
27
+				'value' => sprintf( __( 'Field ID: %s', 'gravityview' ), $this->id ),
28 28
 			);
29 29
 
30 30
 		}
31 31
 
32
-		if( !empty( $this->item['desc'] ) ) {
33
-			$field_info_items[] = array(
34
-				'value' => $this->item['desc']
32
+		if ( ! empty( $this->item[ 'desc' ] ) ) {
33
+			$field_info_items[ ] = array(
34
+				'value' => $this->item[ 'desc' ]
35 35
 			);
36 36
 		}
37 37
 
38
-		if( !empty( $this->item['adminLabel'] ) ) {
39
-			$field_info_items[] = array(
40
-				'value' => sprintf( __('Admin Label: %s', 'gravityview' ), $this->item['adminLabel'] ),
38
+		if ( ! empty( $this->item[ 'adminLabel' ] ) ) {
39
+			$field_info_items[ ] = array(
40
+				'value' => sprintf( __( 'Admin Label: %s', 'gravityview' ), $this->item[ 'adminLabel' ] ),
41 41
 				'class'	=> 'gv-sublabel'
42 42
 			);
43 43
 		}
Please login to merge, or discard this patch.
includes/class-common.php 4 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 	 * Return array of fields' id and label, for a given Form ID
210 210
 	 *
211 211
 	 * @access public
212
-	 * @param string|array $form_id (default: '') or $form object
212
+	 * @param string|array $form (default: '') or $form object
213 213
 	 * @param bool $add_default_properties
214 214
 	 * @param bool $include_parent_field
215 215
 	 * @return array
@@ -850,7 +850,7 @@  discard block
 block discarded – undo
850 850
 	 *
851 851
 	 * @param array $form Gravity Forms form array
852 852
 	 * @param string $field_id ID of the field. If an input, full input ID (like `1.3`)
853
-	 * @param string|array $field_value Raw value of the field.
853
+	 * @param string $field_value Raw value of the field.
854 854
 	 * @return string
855 855
 	 */
856 856
 	public static function get_field_label( $form = array(), $field_id = '', $field_value = '' ) {
@@ -1503,9 +1503,9 @@  discard block
 block discarded – undo
1503 1503
 	 * @param string $message            Message body (required)
1504 1504
 	 * @param string $from_name          Displayed name of the sender
1505 1505
 	 * @param string $message_format     If "html", sent text as `text/html`. Otherwise, `text/plain`. Default: "html".
1506
-	 * @param string|array $attachments  Optional. Files to attach. {@see wp_mail()} for usage. Default: "".
1506
+	 * @param string $attachments  Optional. Files to attach. {@see wp_mail()} for usage. Default: "".
1507 1507
 	 * @param array|false $entry         Gravity Forms entry array, related to the email. Default: false.
1508
-	 * @param array|false $notification  Gravity Forms notification that triggered the email. {@see GFCommon::send_notification}. Default:false.
1508
+	 * @param boolean $notification  Gravity Forms notification that triggered the email. {@see GFCommon::send_notification}. Default:false.
1509 1509
 	 */
1510 1510
 	public static function send_email( $from, $to, $bcc, $reply_to, $subject, $message, $from_name = '', $message_format = 'html', $attachments = '', $entry = false, $notification = false ) {
1511 1511
 
Please login to merge, or discard this patch.
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -245,12 +245,12 @@  discard block
 block discarded – undo
245 245
 						}
246 246
 
247 247
 						/**
248
-                         * @hack
249
-                         * In case of email/email confirmation, the input for email has the same id as the parent field
250
-                         */
248
+						 * @hack
249
+						 * In case of email/email confirmation, the input for email has the same id as the parent field
250
+						 */
251 251
 						if( 'email' === $field->type && false === strpos( $input['id'], '.' ) ) {
252
-                            continue;
253
-                        }
252
+							continue;
253
+						}
254 254
 						$fields["{$input['id']}"] = array(
255 255
 							'label' => rgar( $input, 'label' ),
256 256
 							'customLabel' => rgar( $input, 'customLabel' ),
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 		} elseif ( 'delete' === RGForms::get( 'action' ) ) {
428 428
 			$criteria['context_view_id'] = isset( $_GET['view_id'] ) ? intval( $_GET['view_id'] ) : null;
429 429
 		} elseif( !isset( $criteria['context_view_id'] ) ) {
430
-            // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget)
430
+			// Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget)
431 431
 			$criteria['context_view_id'] = null;
432 432
 		}
433 433
 
@@ -1162,7 +1162,7 @@  discard block
 block discarded – undo
1162 1162
 			),
1163 1163
 		);
1164 1164
 
1165
-        $fields = $date_created + $fields;
1165
+		$fields = $date_created + $fields;
1166 1166
 
1167 1167
 		$blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL );
1168 1168
 
@@ -1174,13 +1174,13 @@  discard block
 block discarded – undo
1174 1174
 			}
1175 1175
 		}
1176 1176
 
1177
-        /**
1178
-         * @filter `gravityview/common/sortable_fields` Filter the sortable fields
1179
-         * @since 1.12
1180
-         * @param array $fields Sub-set of GF form fields that are sortable
1181
-         * @param int $formid The Gravity Forms form ID that the fields are from
1182
-         */
1183
-        $fields = apply_filters( 'gravityview/common/sortable_fields', $fields, $formid );
1177
+		/**
1178
+		 * @filter `gravityview/common/sortable_fields` Filter the sortable fields
1179
+		 * @since 1.12
1180
+		 * @param array $fields Sub-set of GF form fields that are sortable
1181
+		 * @param int $formid The Gravity Forms form ID that the fields are from
1182
+		 */
1183
+		$fields = apply_filters( 'gravityview/common/sortable_fields', $fields, $formid );
1184 1184
 
1185 1185
 		return $fields;
1186 1186
 	}
@@ -1472,17 +1472,17 @@  discard block
 block discarded – undo
1472 1472
 	}
1473 1473
 
1474 1474
 
1475
-    /**
1476
-     * Display updated/error notice
1477
-     *
1478
-     * @param string $notice text/HTML of notice
1479
-     * @param string $class CSS class for notice (`updated` or `error`)
1480
-     *
1481
-     * @return string
1482
-     */
1483
-    public static function generate_notice( $notice, $class = '' ) {
1484
-        return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>';
1485
-    }
1475
+	/**
1476
+	 * Display updated/error notice
1477
+	 *
1478
+	 * @param string $notice text/HTML of notice
1479
+	 * @param string $class CSS class for notice (`updated` or `error`)
1480
+	 *
1481
+	 * @return string
1482
+	 */
1483
+	public static function generate_notice( $notice, $class = '' ) {
1484
+		return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>';
1485
+	}
1486 1486
 
1487 1487
 	/**
1488 1488
 	 * 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.
Spacing   +100 added lines, -100 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 
125 125
 		$entry = self::get_entry( $entry_slug, true );
126 126
 
127
-		$form = self::get_form( $entry['form_id'] );
127
+		$form = self::get_form( $entry[ 'form_id' ] );
128 128
 
129 129
 		return $form;
130 130
 	}
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 
183 183
 		$results = GFAPI::get_entries( intval( $form_id ), $search_criteria, null, $paging );
184 184
 
185
-		$result = ( ! empty( $results ) && ! empty( $results[0]['id'] ) ) ? $results[0]['id'] : null;
185
+		$result = ( ! empty( $results ) && ! empty( $results[ 0 ][ 'id' ] ) ) ? $results[ 0 ][ 'id' ] : null;
186 186
 
187 187
 		return $result;
188 188
 	}
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	 *
198 198
 	 * @return array Empty array if GFAPI class isn't available or no forms. Otherwise, the array of Forms
199 199
 	 */
200
-	public static function get_forms(  $active = true, $trash = false ) {
200
+	public static function get_forms( $active = true, $trash = false ) {
201 201
 		$forms = array();
202 202
 		if ( class_exists( 'GFAPI' ) ) {
203 203
 			$forms = GFAPI::get_forms( $active, $trash );
@@ -225,9 +225,9 @@  discard block
 block discarded – undo
225 225
 		$has_post_fields = false;
226 226
 
227 227
 		if ( $form ) {
228
-			foreach ( $form['fields'] as $field ) {
229
-				if ( $include_parent_field || empty( $field['inputs'] ) ) {
230
-					$fields["{$field['id']}"] = array(
228
+			foreach ( $form[ 'fields' ] as $field ) {
229
+				if ( $include_parent_field || empty( $field[ 'inputs' ] ) ) {
230
+					$fields[ "{$field[ 'id' ]}" ] = array(
231 231
 						'label' => rgar( $field, 'label' ),
232 232
 						'parent' => null,
233 233
 						'type' => rgar( $field, 'type' ),
@@ -236,10 +236,10 @@  discard block
 block discarded – undo
236 236
 					);
237 237
 				}
238 238
 
239
-				if ( $add_default_properties && ! empty( $field['inputs'] ) ) {
240
-					foreach ( $field['inputs'] as $input ) {
239
+				if ( $add_default_properties && ! empty( $field[ 'inputs' ] ) ) {
240
+					foreach ( $field[ 'inputs' ] as $input ) {
241 241
 
242
-						if( ! empty( $input['isHidden'] ) ) {
242
+						if ( ! empty( $input[ 'isHidden' ] ) ) {
243 243
 							continue;
244 244
 						}
245 245
 
@@ -247,10 +247,10 @@  discard block
 block discarded – undo
247 247
                          * @hack
248 248
                          * In case of email/email confirmation, the input for email has the same id as the parent field
249 249
                          */
250
-						if( 'email' === $field['type'] && false === strpos( $input['id'], '.' ) ) {
250
+						if ( 'email' === $field[ 'type' ] && false === strpos( $input[ 'id' ], '.' ) ) {
251 251
                             continue;
252 252
                         }
253
-						$fields["{$input['id']}"] = array(
253
+						$fields[ "{$input[ 'id' ]}" ] = array(
254 254
 							'label' => rgar( $input, 'label' ),
255 255
 							'customLabel' => rgar( $input, 'customLabel' ),
256 256
 							'parent' => $field,
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 				}
263 263
 
264 264
 
265
-				if( GFCommon::is_product_field( $field['type'] ) ){
265
+				if ( GFCommon::is_product_field( $field[ 'type' ] ) ) {
266 266
 					$has_product_fields = true;
267 267
 				}
268 268
 
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 		 * @since 1.7
277 277
 		 */
278 278
 		if ( $has_post_fields ) {
279
-			$fields['post_id'] = array(
279
+			$fields[ 'post_id' ] = array(
280 280
 				'label' => __( 'Post ID', 'gravityview' ),
281 281
 				'type' => 'post_id',
282 282
 			);
@@ -287,10 +287,10 @@  discard block
 block discarded – undo
287 287
 			$payment_fields = GravityView_Fields::get_all( 'pricing' );
288 288
 
289 289
 			foreach ( $payment_fields as $payment_field ) {
290
-				if( isset( $fields["{$payment_field->name}"] ) ) {
290
+				if ( isset( $fields[ "{$payment_field->name}" ] ) ) {
291 291
 					continue;
292 292
 				}
293
-				$fields["{$payment_field->name}"] = array(
293
+				$fields[ "{$payment_field->name}" ] = array(
294 294
 					'label' => $payment_field->label,
295 295
 					'desc' => $payment_field->description,
296 296
 					'type' => $payment_field->name,
@@ -322,9 +322,9 @@  discard block
 block discarded – undo
322 322
 
323 323
 		$fields = array();
324 324
 
325
-		foreach ( $extra_fields as $key => $field ){
326
-			if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) {
327
-				$fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' );
325
+		foreach ( $extra_fields as $key => $field ) {
326
+			if ( ! empty( $only_default_column ) && ! empty( $field[ 'is_default_column' ] ) ) {
327
+				$fields[ $key ] = array( 'label' => $field[ 'label' ], 'type' => 'entry_meta' );
328 328
 			}
329 329
 		}
330 330
 
@@ -364,32 +364,32 @@  discard block
 block discarded – undo
364 364
 			'search_criteria' => null,
365 365
 			'sorting' => null,
366 366
 			'paging' => null,
367
-			'cache' => (isset( $passed_criteria['cache'] ) ? $passed_criteria['cache'] : true),
367
+			'cache' => ( isset( $passed_criteria[ 'cache' ] ) ? $passed_criteria[ 'cache' ] : true ),
368 368
 		);
369 369
 
370 370
 		$criteria = wp_parse_args( $passed_criteria, $search_criteria_defaults );
371 371
 
372
-		if ( ! empty( $criteria['search_criteria']['field_filters'] ) ) {
373
-			foreach ( $criteria['search_criteria']['field_filters'] as &$filter ) {
372
+		if ( ! empty( $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) {
373
+			foreach ( $criteria[ 'search_criteria' ][ 'field_filters' ] as &$filter ) {
374 374
 
375 375
 				if ( ! is_array( $filter ) ) {
376 376
 					continue;
377 377
 				}
378 378
 
379 379
 				// By default, we want searches to be wildcard for each field.
380
-				$filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator'];
380
+				$filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ];
381 381
 
382 382
 				/**
383 383
 				 * @filter `gravityview_search_operator` Modify the search operator for the field (contains, is, isnot, etc)
384 384
 				 * @param string $operator Existing search operator
385 385
 				 * @param array $filter array with `key`, `value`, `operator`, `type` keys
386 386
 				 */
387
-				$filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter );
387
+				$filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter );
388 388
 			}
389 389
 
390 390
 			// don't send just the [mode] without any field filter.
391
-			if( count( $criteria['search_criteria']['field_filters'] ) === 1 && array_key_exists( 'mode' , $criteria['search_criteria']['field_filters'] ) ) {
392
-				unset( $criteria['search_criteria']['field_filters']['mode'] );
391
+			if ( count( $criteria[ 'search_criteria' ][ 'field_filters' ] ) === 1 && array_key_exists( 'mode', $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) {
392
+				unset( $criteria[ 'search_criteria' ][ 'field_filters' ][ 'mode' ] );
393 393
 			}
394 394
 
395 395
 		}
@@ -400,21 +400,21 @@  discard block
 block discarded – undo
400 400
 		 * Prepare date formats to be in Gravity Forms DB format;
401 401
 		 * $passed_criteria may include date formats incompatible with Gravity Forms.
402 402
 		 */
403
-		foreach ( array('start_date', 'end_date' ) as $key ) {
403
+		foreach ( array( 'start_date', 'end_date' ) as $key ) {
404 404
 
405
-			if ( ! empty( $criteria['search_criteria'][ $key ] ) ) {
405
+			if ( ! empty( $criteria[ 'search_criteria' ][ $key ] ) ) {
406 406
 
407 407
 				// Use date_create instead of new DateTime so it returns false if invalid date format.
408
-				$date = date_create( $criteria['search_criteria'][ $key ] );
408
+				$date = date_create( $criteria[ 'search_criteria' ][ $key ] );
409 409
 
410 410
 				if ( $date ) {
411 411
 					// Gravity Forms wants dates in the `Y-m-d H:i:s` format.
412
-					$criteria['search_criteria'][ $key ] = $date->format( 'Y-m-d H:i:s' );
412
+					$criteria[ 'search_criteria' ][ $key ] = $date->format( 'Y-m-d H:i:s' );
413 413
 				} else {
414 414
 					// If it's an invalid date, unset it. Gravity Forms freaks out otherwise.
415
-					unset( $criteria['search_criteria'][ $key ] );
415
+					unset( $criteria[ 'search_criteria' ][ $key ] );
416 416
 
417
-					do_action( 'gravityview_log_error', '[filter_get_entries_criteria] '.$key.' Date format not valid:', $criteria['search_criteria'][ $key ] );
417
+					do_action( 'gravityview_log_error', '[filter_get_entries_criteria] ' . $key . ' Date format not valid:', $criteria[ 'search_criteria' ][ $key ] );
418 418
 				}
419 419
 			}
420 420
 		}
@@ -422,12 +422,12 @@  discard block
 block discarded – undo
422 422
 
423 423
 		// When multiple views are embedded, OR single entry, calculate the context view id and send it to the advanced filter
424 424
 		if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() || GravityView_frontend::getInstance()->getSingleEntry() ) {
425
-			$criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id();
425
+			$criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id();
426 426
 		} elseif ( 'delete' === RGForms::get( 'action' ) ) {
427
-			$criteria['context_view_id'] = isset( $_GET['view_id'] ) ? intval( $_GET['view_id'] ) : null;
428
-		} elseif( !isset( $criteria['context_view_id'] ) ) {
427
+			$criteria[ 'context_view_id' ] = isset( $_GET[ 'view_id' ] ) ? intval( $_GET[ 'view_id' ] ) : null;
428
+		} elseif ( ! isset( $criteria[ 'context_view_id' ] ) ) {
429 429
             // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget)
430
-			$criteria['context_view_id'] = null;
430
+			$criteria[ 'context_view_id' ] = null;
431 431
 		}
432 432
 
433 433
 		/**
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 		 * @param array $form_ids Forms to search
437 437
 		 * @param int $view_id ID of the view being used to search
438 438
 		 */
439
-		$criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria['context_view_id'] );
439
+		$criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria[ 'context_view_id' ] );
440 440
 
441 441
 		return (array)$criteria;
442 442
 
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
 		/** Reduce # of database calls */
468 468
 		add_filter( 'gform_is_encrypted_field', '__return_false' );
469 469
 
470
-		if ( ! empty( $criteria['cache'] ) ) {
470
+		if ( ! empty( $criteria[ 'cache' ] ) ) {
471 471
 
472 472
 			$Cache = new GravityView_Cache( $form_ids, $criteria );
473 473
 
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
 
476 476
 				// Still update the total count when using cached results
477 477
 				if ( ! is_null( $total ) ) {
478
-					$total = GFAPI::count_entries( $form_ids, $criteria['search_criteria'] );
478
+					$total = GFAPI::count_entries( $form_ids, $criteria[ 'search_criteria' ] );
479 479
 				}
480 480
 
481 481
 				$return = $entries;
@@ -495,9 +495,9 @@  discard block
 block discarded – undo
495 495
 			$entries = apply_filters( 'gravityview_before_get_entries', null, $criteria, $passed_criteria, $total );
496 496
 
497 497
 			// No entries returned from gravityview_before_get_entries
498
-			if( is_null( $entries ) ) {
498
+			if ( is_null( $entries ) ) {
499 499
 
500
-				$entries = GFAPI::get_entries( $form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total );
500
+				$entries = GFAPI::get_entries( $form_ids, $criteria[ 'search_criteria' ], $criteria[ 'sorting' ], $criteria[ 'paging' ], $total );
501 501
 
502 502
 				if ( is_wp_error( $entries ) ) {
503 503
 					do_action( 'gravityview_log_error', $entries->get_error_message(), $entries );
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
 				}
507 507
 			}
508 508
 
509
-			if ( ! empty( $criteria['cache'] ) && isset( $Cache ) ) {
509
+			if ( ! empty( $criteria[ 'cache' ] ) && isset( $Cache ) ) {
510 510
 
511 511
 				// Cache results
512 512
 				$Cache->set( $entries, 'entries' );
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
 			 */
594 594
 			$check_entry_display = apply_filters( 'gravityview/common/get_entry/check_entry_display', $check_entry_display, $entry );
595 595
 
596
-			if( $check_entry_display ) {
596
+			if ( $check_entry_display ) {
597 597
 				// Is the entry allowed
598 598
 				$entry = self::check_entry_display( $entry );
599 599
 			}
@@ -626,12 +626,12 @@  discard block
 block discarded – undo
626 626
 
627 627
 		$value = false;
628 628
 
629
-		if( 'context' === $val1 ) {
629
+		if ( 'context' === $val1 ) {
630 630
 
631 631
 			$matching_contexts = array( $val2 );
632 632
 
633 633
 			// We allow for non-standard contexts.
634
-			switch( $val2 ) {
634
+			switch ( $val2 ) {
635 635
 				// Check for either single or edit
636 636
 				case 'singular':
637 637
 					$matching_contexts = array( 'single', 'edit' );
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
 			return false;
692 692
 		}
693 693
 
694
-		if ( empty( $entry['form_id'] ) ) {
694
+		if ( empty( $entry[ 'form_id' ] ) ) {
695 695
 			do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry is empty! Entry:', $entry );
696 696
 			return false;
697 697
 		}
@@ -699,26 +699,26 @@  discard block
 block discarded – undo
699 699
 		$criteria = self::calculate_get_entries_criteria();
700 700
 
701 701
 		// Make sure the current View is connected to the same form as the Entry
702
-		if( ! empty( $criteria['context_view_id'] ) ) {
703
-			$context_view_id = intval( $criteria['context_view_id'] );
702
+		if ( ! empty( $criteria[ 'context_view_id' ] ) ) {
703
+			$context_view_id = intval( $criteria[ 'context_view_id' ] );
704 704
 			$context_form_id = gravityview_get_form_id( $context_view_id );
705
-			if( intval( $context_form_id ) !== intval( $entry['form_id'] ) ) {
706
-				do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry['form_id'] ), $criteria['context_view_id'] );
705
+			if ( intval( $context_form_id ) !== intval( $entry[ 'form_id' ] ) ) {
706
+				do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry[ 'form_id' ] ), $criteria[ 'context_view_id' ] );
707 707
 				return false;
708 708
 			}
709 709
 		}
710 710
 
711
-		if ( empty( $criteria['search_criteria'] ) || ! is_array( $criteria['search_criteria'] ) ) {
711
+		if ( empty( $criteria[ 'search_criteria' ] ) || ! is_array( $criteria[ 'search_criteria' ] ) ) {
712 712
 			do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No search criteria found:', $criteria );
713 713
 			return $entry;
714 714
 		}
715 715
 
716
-		$search_criteria = $criteria['search_criteria'];
716
+		$search_criteria = $criteria[ 'search_criteria' ];
717 717
 		unset( $criteria );
718 718
 
719 719
 		// check entry status
720
-		if ( array_key_exists( 'status', $search_criteria ) && $search_criteria['status'] != $entry['status'] ) {
721
-			do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry['status'] ), $search_criteria );
720
+		if ( array_key_exists( 'status', $search_criteria ) && $search_criteria[ 'status' ] != $entry[ 'status' ] ) {
721
+			do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry[ 'status' ] ), $search_criteria );
722 722
 			return false;
723 723
 		}
724 724
 
@@ -726,37 +726,37 @@  discard block
 block discarded – undo
726 726
 		// @todo: Does it make sense to apply the Date create filters to the single entry?
727 727
 
728 728
 		// field_filters
729
-		if ( empty( $search_criteria['field_filters'] ) || ! is_array( $search_criteria['field_filters'] ) ) {
729
+		if ( empty( $search_criteria[ 'field_filters' ] ) || ! is_array( $search_criteria[ 'field_filters' ] ) ) {
730 730
 			do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No field filters criteria found:', $search_criteria );
731 731
 			return $entry;
732 732
 		}
733 733
 
734
-		$filters = $search_criteria['field_filters'];
734
+		$filters = $search_criteria[ 'field_filters' ];
735 735
 		unset( $search_criteria );
736 736
 
737
-		$mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters['mode'] ) : 'all';
738
-		unset( $filters['mode'] );
737
+		$mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters[ 'mode' ] ) : 'all';
738
+		unset( $filters[ 'mode' ] );
739 739
 
740
-		$form = self::get_form( $entry['form_id'] );
740
+		$form = self::get_form( $entry[ 'form_id' ] );
741 741
 
742 742
 		foreach ( $filters as $filter ) {
743 743
 
744
-			if ( ! isset( $filter['key'] ) ) {
744
+			if ( ! isset( $filter[ 'key' ] ) ) {
745 745
 				continue;
746 746
 			}
747 747
 
748
-			$k = $filter['key'];
748
+			$k = $filter[ 'key' ];
749 749
 
750 750
 			if ( in_array( $k, array( 'created_by', 'payment_status' ) ) ) {
751 751
 				$field_value = $entry[ $k ];
752 752
 				$field = null;
753 753
 			} else {
754 754
 				$field = self::get_field( $form, $k );
755
-				$field_value  = GFFormsModel::get_lead_field_value( $entry, $field );
755
+				$field_value = GFFormsModel::get_lead_field_value( $entry, $field );
756 756
 			}
757 757
 
758
-			$operator = isset( $filter['operator'] ) ? strtolower( $filter['operator'] ) : 'is';
759
-			$is_value_match = GFFormsModel::is_value_match( $field_value, $filter['value'], $operator, $field );
758
+			$operator = isset( $filter[ 'operator' ] ) ? strtolower( $filter[ 'operator' ] ) : 'is';
759
+			$is_value_match = GFFormsModel::is_value_match( $field_value, $filter[ 'value' ], $operator, $field );
760 760
 
761 761
 			// verify if we are already free to go!
762 762
 			if ( ! $is_value_match && 'all' === $mode ) {
@@ -814,18 +814,18 @@  discard block
 block discarded – undo
814 814
 		 * Gravity Forms code to adjust date to locally-configured Time Zone
815 815
 		 * @see GFCommon::format_date() for original code
816 816
 		 */
817
-		$date_gmt_time   = mysql2date( 'G', $date_string );
817
+		$date_gmt_time = mysql2date( 'G', $date_string );
818 818
 		$date_local_timestamp = GFCommon::get_local_timestamp( $date_gmt_time );
819 819
 
820
-		$format  = rgar( $atts, 'format' );
821
-		$is_human  = ! empty( $atts['human'] );
822
-		$is_diff  = ! empty( $atts['diff'] );
823
-		$is_raw = ! empty( $atts['raw'] );
824
-		$is_timestamp = ! empty( $atts['timestamp'] );
825
-		$include_time = ! empty( $atts['time'] );
820
+		$format = rgar( $atts, 'format' );
821
+		$is_human = ! empty( $atts[ 'human' ] );
822
+		$is_diff = ! empty( $atts[ 'diff' ] );
823
+		$is_raw = ! empty( $atts[ 'raw' ] );
824
+		$is_timestamp = ! empty( $atts[ 'timestamp' ] );
825
+		$include_time = ! empty( $atts[ 'time' ] );
826 826
 
827 827
 		// If we're using time diff, we want to have a different default format
828
-		if( empty( $format ) ) {
828
+		if ( empty( $format ) ) {
829 829
 			/* translators: %s: relative time from now, used for generic date comparisons. "1 day ago", or "20 seconds ago" */
830 830
 			$format = $is_diff ? esc_html__( '%s ago', 'gravityview' ) : get_option( 'date_format' );
831 831
 		}
@@ -833,7 +833,7 @@  discard block
 block discarded – undo
833 833
 		// If raw was specified, don't modify the stored value
834 834
 		if ( $is_raw ) {
835 835
 			$formatted_date = $date_string;
836
-		} elseif( $is_timestamp ) {
836
+		} elseif ( $is_timestamp ) {
837 837
 			$formatted_date = $date_local_timestamp;
838 838
 		} elseif ( $is_diff ) {
839 839
 			$formatted_date = sprintf( $format, human_time_diff( $date_gmt_time ) );
@@ -867,7 +867,7 @@  discard block
 block discarded – undo
867 867
 
868 868
 		$label = rgar( $field, 'label' );
869 869
 
870
-		if( floor( $field_id ) !== floatval( $field_id ) ) {
870
+		if ( floor( $field_id ) !== floatval( $field_id ) ) {
871 871
 			$label = GFFormsModel::get_choice_text( $field, $field_value, $field_id );
872 872
 		}
873 873
 
@@ -888,7 +888,7 @@  discard block
 block discarded – undo
888 888
 	 * @return GF_Field|null Gravity Forms field object, or NULL: Gravity Forms GFFormsModel does not exist or field at $field_id doesn't exist.
889 889
 	 */
890 890
 	public static function get_field( $form, $field_id ) {
891
-		if ( class_exists( 'GFFormsModel' ) ){
891
+		if ( class_exists( 'GFFormsModel' ) ) {
892 892
 			return GFFormsModel::get_field( $form, $field_id );
893 893
 		} else {
894 894
 			return null;
@@ -935,19 +935,19 @@  discard block
 block discarded – undo
935 935
 			$shortcodes = array();
936 936
 
937 937
 			preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER );
938
-			if ( empty( $matches ) ){
938
+			if ( empty( $matches ) ) {
939 939
 				return false;
940 940
 			}
941 941
 
942 942
 			foreach ( $matches as $shortcode ) {
943
-				if ( $tag === $shortcode[2] ) {
943
+				if ( $tag === $shortcode[ 2 ] ) {
944 944
 
945 945
 					// Changed this to $shortcode instead of true so we get the parsed atts.
946
-					$shortcodes[] = $shortcode;
946
+					$shortcodes[ ] = $shortcode;
947 947
 
948
-				} else if ( isset( $shortcode[5] ) && $results = self::has_shortcode_r( $shortcode[5], $tag ) ) {
949
-					foreach( $results as $result ) {
950
-						$shortcodes[] = $result;
948
+				} else if ( isset( $shortcode[ 5 ] ) && $results = self::has_shortcode_r( $shortcode[ 5 ], $tag ) ) {
949
+					foreach ( $results as $result ) {
950
+						$shortcodes[ ] = $result;
951 951
 					}
952 952
 				}
953 953
 			}
@@ -1091,7 +1091,7 @@  discard block
 block discarded – undo
1091 1091
 	public static function get_directory_fields( $post_id, $apply_filter = true ) {
1092 1092
 		$fields = get_post_meta( $post_id, '_gravityview_directory_fields', true );
1093 1093
 
1094
-		if( $apply_filter ) {
1094
+		if ( $apply_filter ) {
1095 1095
 			/**
1096 1096
 			 * @filter `gravityview/configuration/fields` Filter the View fields' configuration array
1097 1097
 			 * @since 1.6.5
@@ -1114,7 +1114,7 @@  discard block
 block discarded – undo
1114 1114
 	 * @return string         html
1115 1115
 	 */
1116 1116
 	public static function get_sortable_fields( $formid, $current = '' ) {
1117
-		$output = '<option value="" ' . selected( '', $current, false ).'>' . esc_html__( 'Default', 'gravityview' ) .'</option>';
1117
+		$output = '<option value="" ' . selected( '', $current, false ) . '>' . esc_html__( 'Default', 'gravityview' ) . '</option>';
1118 1118
 
1119 1119
 		if ( empty( $formid ) ) {
1120 1120
 			return $output;
@@ -1127,11 +1127,11 @@  discard block
 block discarded – undo
1127 1127
 			$blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', array( 'list', 'textarea' ), null );
1128 1128
 
1129 1129
 			foreach ( $fields as $id => $field ) {
1130
-				if ( in_array( $field['type'], $blacklist_field_types ) ) {
1130
+				if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
1131 1131
 					continue;
1132 1132
 				}
1133 1133
 
1134
-				$output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'>'. esc_attr( $field['label'] ) .'</option>';
1134
+				$output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . '>' . esc_attr( $field[ 'label' ] ) . '</option>';
1135 1135
 			}
1136 1136
 		}
1137 1137
 
@@ -1166,9 +1166,9 @@  discard block
 block discarded – undo
1166 1166
 		$blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL );
1167 1167
 
1168 1168
 		// TODO: Convert to using array_filter
1169
-		foreach( $fields as $id => $field ) {
1169
+		foreach ( $fields as $id => $field ) {
1170 1170
 
1171
-			if( in_array( $field['type'], $blacklist_field_types ) ) {
1171
+			if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
1172 1172
 				unset( $fields[ $id ] );
1173 1173
 			}
1174 1174
 		}
@@ -1209,14 +1209,14 @@  discard block
 block discarded – undo
1209 1209
 	 * @param  int|array  $field field key or field array
1210 1210
 	 * @return boolean
1211 1211
 	 */
1212
-	public static function is_field_numeric(  $form = null, $field = '' ) {
1212
+	public static function is_field_numeric( $form = null, $field = '' ) {
1213 1213
 
1214 1214
 		if ( ! is_array( $form ) && ! is_array( $field ) ) {
1215 1215
 			$form = self::get_form( $form );
1216 1216
 		}
1217 1217
 
1218 1218
 		// If entry meta, it's a string. Otherwise, numeric
1219
-		if( ! is_numeric( $field ) && is_string( $field ) ) {
1219
+		if ( ! is_numeric( $field ) && is_string( $field ) ) {
1220 1220
 			$type = $field;
1221 1221
 		} else {
1222 1222
 			$type = self::get_field_type( $form, $field );
@@ -1230,9 +1230,9 @@  discard block
 block discarded – undo
1230 1230
 		$numeric_types = apply_filters( 'gravityview/common/numeric_types', array( 'number', 'time' ) );
1231 1231
 
1232 1232
 		// Defer to GravityView_Field setting, if the field type is registered and `is_numeric` is true
1233
-		if( $gv_field = GravityView_Fields::get( $type ) ) {
1234
-			if( true === $gv_field->is_numeric ) {
1235
-				$numeric_types[] = $gv_field->is_numeric;
1233
+		if ( $gv_field = GravityView_Fields::get( $type ) ) {
1234
+			if ( true === $gv_field->is_numeric ) {
1235
+				$numeric_types[ ] = $gv_field->is_numeric;
1236 1236
 			}
1237 1237
 		}
1238 1238
 
@@ -1382,18 +1382,18 @@  discard block
 block discarded – undo
1382 1382
 		$final_atts = array_filter( $final_atts );
1383 1383
 
1384 1384
 		// If the href wasn't passed as an attribute, use the value passed to the function
1385
-		if ( empty( $final_atts['href'] ) && ! empty( $href ) ) {
1386
-			$final_atts['href'] = $href;
1385
+		if ( empty( $final_atts[ 'href' ] ) && ! empty( $href ) ) {
1386
+			$final_atts[ 'href' ] = $href;
1387 1387
 		}
1388 1388
 
1389
-		$final_atts['href'] = esc_url_raw( $href );
1389
+		$final_atts[ 'href' ] = esc_url_raw( $href );
1390 1390
 
1391 1391
 		/**
1392 1392
 		 * Fix potential security issue with target=_blank
1393 1393
 		 * @see https://dev.to/ben/the-targetblank-vulnerability-by-example
1394 1394
 		 */
1395
-		if( '_blank' === rgar( $final_atts, 'target' ) ) {
1396
-			$final_atts['rel'] = trim( rgar( $final_atts, 'rel', '' ) . ' noopener noreferrer' );
1395
+		if ( '_blank' === rgar( $final_atts, 'target' ) ) {
1396
+			$final_atts[ 'rel' ] = trim( rgar( $final_atts, 'rel', '' ) . ' noopener noreferrer' );
1397 1397
 		}
1398 1398
 
1399 1399
 		// Sort the attributes alphabetically, to help testing
@@ -1405,7 +1405,7 @@  discard block
 block discarded – undo
1405 1405
 			$output .= sprintf( ' %s="%s"', $attr, esc_attr( $value ) );
1406 1406
 		}
1407 1407
 
1408
-		if( '' !== $output ) {
1408
+		if ( '' !== $output ) {
1409 1409
 			$output = '<a' . $output . '>' . $anchor_text . '</a>';
1410 1410
 		}
1411 1411
 
@@ -1432,7 +1432,7 @@  discard block
 block discarded – undo
1432 1432
 			if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) {
1433 1433
 				$merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value );
1434 1434
 			} else if ( is_numeric( $key ) && isset( $merged[ $key ] ) ) {
1435
-				$merged[] = $value;
1435
+				$merged[ ] = $value;
1436 1436
 			} else {
1437 1437
 				$merged[ $key ] = $value;
1438 1438
 			}
@@ -1465,7 +1465,7 @@  discard block
 block discarded – undo
1465 1465
 		 * `$context` is where are we using this information (e.g. change_entry_creator, search_widget ..)
1466 1466
 		 * @param array $settings Settings array, with `number` key defining the # of users to display
1467 1467
 		 */
1468
-		$get_users_settings = apply_filters( 'gravityview/get_users/'. $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) );
1468
+		$get_users_settings = apply_filters( 'gravityview/get_users/' . $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) );
1469 1469
 
1470 1470
 		return get_users( $get_users_settings );
1471 1471
 	}
@@ -1480,7 +1480,7 @@  discard block
 block discarded – undo
1480 1480
      * @return string
1481 1481
      */
1482 1482
     public static function generate_notice( $notice, $class = '' ) {
1483
-        return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>';
1483
+        return '<div class="gv-notice ' . gravityview_sanitize_html_class( $class ) . '">' . $notice . '</div>';
1484 1484
     }
1485 1485
 
1486 1486
 	/**
Please login to merge, or discard this patch.
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 				}
263 263
 
264 264
 
265
-				if( GFCommon::is_product_field( $field['type'] ) ){
265
+				if( GFCommon::is_product_field( $field['type'] ) ) {
266 266
 					$has_product_fields = true;
267 267
 				}
268 268
 
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 
323 323
 		$fields = array();
324 324
 
325
-		foreach ( $extra_fields as $key => $field ){
325
+		foreach ( $extra_fields as $key => $field ) {
326 326
 			if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) {
327 327
 				$fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' );
328 328
 			}
@@ -888,7 +888,7 @@  discard block
 block discarded – undo
888 888
 	 * @return GF_Field|null Gravity Forms field object, or NULL: Gravity Forms GFFormsModel does not exist or field at $field_id doesn't exist.
889 889
 	 */
890 890
 	public static function get_field( $form, $field_id ) {
891
-		if ( class_exists( 'GFFormsModel' ) ){
891
+		if ( class_exists( 'GFFormsModel' ) ) {
892 892
 			return GFFormsModel::get_field( $form, $field_id );
893 893
 		} else {
894 894
 			return null;
@@ -935,7 +935,7 @@  discard block
 block discarded – undo
935 935
 			$shortcodes = array();
936 936
 
937 937
 			preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER );
938
-			if ( empty( $matches ) ){
938
+			if ( empty( $matches ) ) {
939 939
 				return false;
940 940
 			}
941 941
 
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-workflow_step.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -47,11 +47,11 @@  discard block
 block discarded – undo
47 47
 	function modify_entry_value_workflow_step( $output, $entry, $field_settings, $field ) {
48 48
 
49 49
 		// If not set, the entry hasn't started a workflow
50
-		$has_workflow_step = isset( $entry['workflow_step'] );
50
+		$has_workflow_step = isset( $entry[ 'workflow_step' ] );
51 51
 
52
-		if( $has_workflow_step ) {
52
+		if ( $has_workflow_step ) {
53 53
 
54
-			$GFlow = new Gravity_Flow_API( $entry['form_id'] );
54
+			$GFlow = new Gravity_Flow_API( $entry[ 'form_id' ] );
55 55
 
56 56
 			if ( $current_step = $GFlow->get_current_step( $entry ) ) {
57 57
 				$output = esc_html( $current_step->get_name() );
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 		preg_match( '/workflow_step_status_(\d+)/', $key, $matches );
80 80
 
81 81
 		if ( ! empty( $matches ) ) {
82
-			$workflow_step_id = intval( $matches[1] );
82
+			$workflow_step_id = intval( $matches[ 1 ] );
83 83
 		}
84 84
 
85 85
 		return $workflow_step_id;
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 
99 99
 		$return = $label;
100 100
 
101
-		if ( '' === $label && $workflow_step_id = $this->get_step_id_from_key( $field['field'] ) ) {
101
+		if ( '' === $label && $workflow_step_id = $this->get_step_id_from_key( $field[ 'field' ] ) ) {
102 102
 
103 103
 			$step = $this->get_workflow_step( $workflow_step_id );
104 104
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 
129 129
 		$workflow_step = $GFlow->get_step( $workflow_step_id );
130 130
 
131
-		if( ! $GFlow || ! $workflow_step ) {
131
+		if ( ! $GFlow || ! $workflow_step ) {
132 132
 			return false;
133 133
 		}
134 134
 
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 		
151 151
 		foreach ( $search_fields as & $search_field ) {
152 152
 
153
-			if ( $this->name === $search_field['key'] ) {
153
+			if ( $this->name === $search_field[ 'key' ] ) {
154 154
 
155 155
 				$form_id = GravityView_View::getInstance()->getFormId();
156 156
 
@@ -159,21 +159,21 @@  discard block
 block discarded – undo
159 159
 				$choices = array();
160 160
 
161 161
 				foreach ( $workflow_steps as $step ) {
162
-					$choices[] = array(
162
+					$choices[ ] = array(
163 163
 						'text'   => $step->get_name(),
164 164
 						'value'   => $step->get_id(),
165 165
 					);
166 166
 				}
167 167
 
168
-				$search_field['choices'] = $choices;
168
+				$search_field[ 'choices' ] = $choices;
169 169
 			}
170 170
 
171 171
 			// Workflow Step Statuses
172
-			else if ( $workflow_step_id = $this->get_step_id_from_key( $search_field['key'] ) ) {
172
+			else if ( $workflow_step_id = $this->get_step_id_from_key( $search_field[ 'key' ] ) ) {
173 173
 
174 174
 				$status_key = sprintf( 'workflow_step_status_%d', $workflow_step_id );
175 175
 
176
-				$search_field['choices'] = GravityView_Plugin_Hooks_Gravity_Flow::get_status_options( null, $status_key );
176
+				$search_field[ 'choices' ] = GravityView_Plugin_Hooks_Gravity_Flow::get_status_options( null, $status_key );
177 177
 			}
178 178
 		}
179 179
 		
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-workflow_final_status.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 */
42 42
 	function modify_entry_value_workflow_final_status( $output, $entry, $field_settings, $field ) {
43 43
 
44
-		if( ! empty( $output ) ) {
44
+		if ( ! empty( $output ) ) {
45 45
 			$output = gravity_flow()->translate_status_label( $output );
46 46
 		}
47 47
 
@@ -59,8 +59,8 @@  discard block
 block discarded – undo
59 59
 	function modify_search_filters( $search_fields = array(), GravityView_Widget_Search $widget, $widget_args = array() ) {
60 60
 
61 61
 		foreach ( $search_fields as & $search_field ) {
62
-			if ( $this->name === $search_field['key'] ) {
63
-				$search_field['choices'] = GravityView_Plugin_Hooks_Gravity_Flow::get_status_options();
62
+			if ( $this->name === $search_field[ 'key' ] ) {
63
+				$search_field[ 'choices' ] = GravityView_Plugin_Hooks_Gravity_Flow::get_status_options();
64 64
 			}
65 65
 		}
66 66
 
Please login to merge, or discard this patch.
plugin-and-theme-hooks/class-gravityview-plugin-hooks-gravity-flow.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 
34 34
 		parent::add_hooks();
35 35
 
36
-		add_filter( 'gravityview/search/searchable_fields', array( $this, 'modify_search_bar_fields_dropdown'), 10, 2 );
36
+		add_filter( 'gravityview/search/searchable_fields', array( $this, 'modify_search_bar_fields_dropdown' ), 10, 2 );
37 37
 
38 38
 	}
39 39
 	
@@ -52,13 +52,13 @@  discard block
 block discarded – undo
52 52
 	 */
53 53
 	public static function get_status_options( $form_id = 0, $status_key = 'workflow_final_status' ) {
54 54
 
55
-		if( empty( $form_id ) ) {
55
+		if ( empty( $form_id ) ) {
56 56
 			$form_id = GravityView_View::getInstance()->getFormId();
57 57
 		}
58 58
 
59 59
 		$entry_meta = gravity_flow()->get_entry_meta( array(), $form_id );
60 60
 
61
-		return (array) rgars( $entry_meta, $status_key . '/filter/choices' );
61
+		return (array)rgars( $entry_meta, $status_key . '/filter/choices' );
62 62
 	}
63 63
 
64 64
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 
81 81
 		$workflow_steps = $GFlow->get_steps();
82 82
 
83
-		if( $workflow_steps ) {
83
+		if ( $workflow_steps ) {
84 84
 
85 85
 			foreach ( $workflow_steps as $step ) {
86 86
 
@@ -92,12 +92,12 @@  discard block
 block discarded – undo
92 92
 				);
93 93
 			}
94 94
 
95
-			$fields['workflow_step'] = array(
95
+			$fields[ 'workflow_step' ] = array(
96 96
 				'label' => esc_html__( 'Workflow Step', 'gravityview' ),
97 97
 				'type'  => 'select',
98 98
 			);
99 99
 
100
-			$fields['workflow_final_status'] = array(
100
+			$fields[ 'workflow_final_status' ] = array(
101 101
 				'label' => esc_html__( 'Workflow Status', 'gravityview' ),
102 102
 				'type'  => 'select',
103 103
 			);
Please login to merge, or discard this patch.
includes/admin/class-gravityview-admin-view-item.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
 	function __construct( $title = '', $item_id, $item = array(), $settings = array() ) {
43 43
 
44 44
 		// Backward compat
45
-		if ( ! empty( $item['type'] ) ) {
46
-			$item['input_type'] = $item['type'];
47
-			unset( $item['type'] );
45
+		if ( ! empty( $item[ 'type' ] ) ) {
46
+			$item[ 'input_type' ] = $item[ 'type' ];
47
+			unset( $item[ 'type' ] );
48 48
 		}
49 49
 
50 50
 		// Prevent items from not having index set
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 		$this->item       = $item;
65 65
 		$this->id         = $item_id;
66 66
 		$this->settings   = $settings;
67
-		$this->label_type = $item['label_type'];
67
+		$this->label_type = $item[ 'label_type' ];
68 68
 	}
69 69
 
70 70
 	/**
@@ -107,10 +107,10 @@  discard block
 block discarded – undo
107 107
 		if ( $html ) {
108 108
 
109 109
 			foreach ( $field_info_items as $item ) {
110
-				$class = isset( $item['class'] ) ? sanitize_html_class( $item['class'] ) . ' description' : 'description';
110
+				$class = isset( $item[ 'class' ] ) ? sanitize_html_class( $item[ 'class' ] ) . ' description' : 'description';
111 111
 				// Add the title in case the value's long, in which case, it'll be truncated by CSS.
112 112
 				$output .= '<span class="' . $class . '">';
113
-				$output .= esc_html( $item['value'] );
113
+				$output .= esc_html( $item[ 'value' ] );
114 114
 				$output .= '</span>';
115 115
 			}
116 116
 
@@ -138,29 +138,29 @@  discard block
 block discarded – undo
138 138
 
139 139
 		// $settings_html will just be hidden inputs if empty. Otherwise, it'll have an <ul>. Ugly hack, I know.
140 140
 		// TODO: Un-hack this
141
-		$hide_settings_link = ( empty( $this->item['settings_html'] ) || strpos( $this->item['settings_html'], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : '';
141
+		$hide_settings_link = ( empty( $this->item[ 'settings_html' ] ) || strpos( $this->item[ 'settings_html' ], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : '';
142 142
 		$settings_link      = sprintf( '<a href="#settings" class="dashicons-admin-generic dashicons %s" title="%s"></a>', $hide_settings_link, esc_attr( $settings_title ) );
143 143
 
144 144
 		// Should we show the icon that the field is being used as a link to single entry?
145
-		$hide_show_as_link_class = empty( $this->settings['show_as_link'] ) ? 'hide-if-js' : '';
145
+		$hide_show_as_link_class = empty( $this->settings[ 'show_as_link' ] ) ? 'hide-if-js' : '';
146 146
 		$show_as_link            = '<span class="dashicons dashicons-admin-links ' . $hide_show_as_link_class . '" title="' . esc_attr( $single_link_title ) . '"></span>';
147 147
 
148 148
 		// When a field label is empty, use the Field ID
149 149
 		$label = empty( $this->title ) ? sprintf( _x( 'Field #%s (No Label)', 'Label in field picker for empty label', 'gravityview' ), $this->id ) : $this->title;
150 150
 
151 151
 		// If there's a custom label, and show label is checked, use that as the field heading
152
-		if ( ! empty( $this->settings['custom_label'] ) && ! empty( $this->settings['show_label'] ) ) {
153
-			$label = $this->settings['custom_label'];
154
-		} else if ( ! empty( $this->item['customLabel'] ) ) {
155
-			$label = $this->item['customLabel'];
152
+		if ( ! empty( $this->settings[ 'custom_label' ] ) && ! empty( $this->settings[ 'show_label' ] ) ) {
153
+			$label = $this->settings[ 'custom_label' ];
154
+		} else if ( ! empty( $this->item[ 'customLabel' ] ) ) {
155
+			$label = $this->item[ 'customLabel' ];
156 156
 		}
157 157
 
158 158
 		$output = '<h5 class="selectable gfield field-id-' . esc_attr( $this->id ) . '">';
159 159
 
160 160
 		$label = esc_attr( $label );
161 161
 
162
-		if ( ! empty( $this->item['parent'] ) ) {
163
-			$label .= ' <small>(' . esc_attr( $this->item['parent']['label'] ) . ')</small>';
162
+		if ( ! empty( $this->item[ 'parent' ] ) ) {
163
+			$label .= ' <small>(' . esc_attr( $this->item[ 'parent' ][ 'label' ] ) . ')</small>';
164 164
 		}
165 165
 
166 166
 		// Name of field / widget
@@ -176,9 +176,9 @@  discard block
 block discarded – undo
176 176
 
177 177
 		$output .= '</h5>';
178 178
 
179
-		$container_class = ! empty( $this->item['parent'] ) ? ' gv-child-field' : '';
179
+		$container_class = ! empty( $this->item[ 'parent' ] ) ? ' gv-child-field' : '';
180 180
 
181
-		$output = '<div data-fieldid="' . esc_attr( $this->id ) . '" data-inputtype="' . esc_attr( $this->item['input_type'] ) . '" class="gv-fields' . $container_class . '">' . $output . $this->item['settings_html'] . '</div>';
181
+		$output = '<div data-fieldid="' . esc_attr( $this->id ) . '" data-inputtype="' . esc_attr( $this->item[ 'input_type' ] ) . '" class="gv-fields' . $container_class . '">' . $output . $this->item[ 'settings_html' ] . '</div>';
182 182
 
183 183
 		return $output;
184 184
 	}
Please login to merge, or discard this patch.
includes/widgets/class-gravityview-widget-page-links.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -11,35 +11,35 @@  discard block
 block discarded – undo
11 11
 
12 12
 	function __construct() {
13 13
 
14
-		$this->widget_description = __('Links to multiple pages of results.', 'gravityview' );
14
+		$this->widget_description = __( 'Links to multiple pages of results.', 'gravityview' );
15 15
 
16 16
 		$default_values = array( 'header' => 1, 'footer' => 1 );
17 17
 		$settings = array( 'show_all' => array(
18 18
 			'type' => 'checkbox',
19 19
 			'label' => __( 'Show each page number', 'gravityview' ),
20
-			'desc' => __('Show every page number instead of summary (eg: 1 2 3 ... 8 »)', 'gravityview'),
20
+			'desc' => __( 'Show every page number instead of summary (eg: 1 2 3 ... 8 »)', 'gravityview' ),
21 21
 			'value' => false
22
-		));
23
-		parent::__construct( __( 'Page Links', 'gravityview' ) , 'page_links', $default_values, $settings );
22
+		) );
23
+		parent::__construct( __( 'Page Links', 'gravityview' ), 'page_links', $default_values, $settings );
24 24
 
25 25
 	}
26 26
 
27
-	public function render_frontend( $widget_args, $content = '', $context = '') {
27
+	public function render_frontend( $widget_args, $content = '', $context = '' ) {
28 28
 		$gravityview_view = GravityView_View::getInstance();
29 29
 
30
-		if( !$this->pre_render_frontend() ) {
30
+		if ( ! $this->pre_render_frontend() ) {
31 31
 			return;
32 32
 		}
33 33
 
34 34
 		$atts = shortcode_atts( array(
35 35
 			'page_size' => rgar( $gravityview_view->paging, 'page_size' ),
36 36
 			'total' => $gravityview_view->total_entries,
37
-			'show_all' => !empty( $this->settings['show_all']['default'] ),
38
-			'current' => (int) rgar( $_GET, 'pagenum', 1 ),
37
+			'show_all' => ! empty( $this->settings[ 'show_all' ][ 'default' ] ),
38
+			'current' => (int)rgar( $_GET, 'pagenum', 1 ),
39 39
 		), $widget_args, 'gravityview_widget_page_links' );
40 40
 		
41 41
 		$page_link_args = array(
42
-			'base' => add_query_arg('pagenum','%#%', gv_directory_link() ),
42
+			'base' => add_query_arg( 'pagenum', '%#%', gv_directory_link() ),
43 43
 			'format' => '&pagenum=%#%',
44 44
 			'add_args' => array(), //
45 45
 			'prev_text' => '&laquo;',
@@ -47,9 +47,9 @@  discard block
 block discarded – undo
47 47
 			'type' => 'list',
48 48
 			'end_size' => 1,
49 49
 			'mid_size' => 2,
50
-			'total' => empty( $atts['page_size'] ) ? 0 : ceil( $atts['total'] / $atts['page_size'] ),
51
-			'current' => $atts['current'],
52
-			'show_all' => !empty( $atts['show_all'] ), // to be available at backoffice
50
+			'total' => empty( $atts[ 'page_size' ] ) ? 0 : ceil( $atts[ 'total' ] / $atts[ 'page_size' ] ),
51
+			'current' => $atts[ 'current' ],
52
+			'show_all' => ! empty( $atts[ 'show_all' ] ), // to be available at backoffice
53 53
 		);
54 54
 
55 55
 		/**
@@ -57,14 +57,14 @@  discard block
 block discarded – undo
57 57
 		 * @since 1.1.4
58 58
 		 * @param array  $page_link_args Array of arguments for the `paginate_links()` function. [Read more about `paginate_links()`](http://developer.wordpress.org/reference/functions/paginate_links/)
59 59
 		 */
60
-		$page_link_args = apply_filters('gravityview_page_links_args', $page_link_args );
60
+		$page_link_args = apply_filters( 'gravityview_page_links_args', $page_link_args );
61 61
 
62 62
 		$page_links = paginate_links( $page_link_args );
63 63
 
64
-		if( !empty( $page_links )) {
65
-			$class = !empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : '';
64
+		if ( ! empty( $page_links ) ) {
65
+			$class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : '';
66 66
 			$class = gravityview_sanitize_html_class( $class );
67
-			echo '<div class="gv-widget-page-links '.$class.'">'. $page_links .'</div>';
67
+			echo '<div class="gv-widget-page-links ' . $class . '">' . $page_links . '</div>';
68 68
 		} else {
69 69
 			do_action( 'gravityview_log_debug', 'GravityView_Widget_Page_Links[render_frontend] No page links; paginate_links() returned empty response.' );
70 70
 		}
Please login to merge, or discard this patch.
includes/admin/metaboxes/views/data-source.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 wp_nonce_field( 'gravityview_select_form', 'gravityview_select_form_nonce' );
12 12
 
13 13
 //current value
14
-$current_form = (int) rgar( (array) $_GET, 'form_id', gravityview_get_form_id( $post->ID ) );
14
+$current_form = (int)rgar( (array)$_GET, 'form_id', gravityview_get_form_id( $post->ID ) );
15 15
 
16 16
 // check for available gravity forms
17 17
 $forms = gravityview_get_forms();
@@ -26,24 +26,24 @@  discard block
 block discarded – undo
26 26
 		?>
27 27
 		<a class="button button-primary" href="#gv_start_fresh" title="<?php esc_attr_e( 'Start Fresh', 'gravityview' ); ?>"><?php esc_html_e( 'Start Fresh', 'gravityview' ); ?></a>
28 28
 
29
-		<?php if( !empty( $forms ) ) { ?>
29
+		<?php if ( ! empty( $forms ) ) { ?>
30 30
 			<span>&nbsp;<?php esc_html_e( 'or use an existing form', 'gravityview' ); ?>&nbsp;</span>
31 31
 		<?php }
32 32
 	}
33 33
 
34 34
 	// If there are no forms to select, show no forms.
35
-	if( !empty( $forms ) ) { ?>
35
+	if ( ! empty( $forms ) ) { ?>
36 36
 		<select name="gravityview_form_id" id="gravityview_form_id">
37 37
 			<option value="" <?php selected( '', $current_form, true ); ?>>&mdash; <?php esc_html_e( 'list of forms', 'gravityview' ); ?> &mdash;</option>
38
-			<?php foreach( $forms as $form ) { ?>
39
-				<option value="<?php echo $form['id']; ?>" <?php selected( $form['id'], $current_form, true ); ?>><?php echo esc_html( $form['title'] ); ?></option>
38
+			<?php foreach ( $forms as $form ) { ?>
39
+				<option value="<?php echo $form[ 'id' ]; ?>" <?php selected( $form[ 'id' ], $current_form, true ); ?>><?php echo esc_html( $form[ 'title' ] ); ?></option>
40 40
 			<?php } ?>
41 41
 		</select>
42 42
 	<?php } else { ?>
43 43
 		<select name="gravityview_form_id" id="gravityview_form_id" class="hidden"><option selected="selected" value=""></option></select>
44 44
 	<?php } ?>
45 45
 
46
-	&nbsp;<a class="button button-primary" <?php if( empty( $current_form ) ) { echo 'style="display:none;"'; } ?> id="gv_switch_view_button" href="#gv_switch_view" title="<?php esc_attr_e( 'Switch View', 'gravityview' ); ?>"><?php esc_html_e( 'Switch View Type', 'gravityview' ); ?></a>
46
+	&nbsp;<a class="button button-primary" <?php if ( empty( $current_form ) ) { echo 'style="display:none;"'; } ?> id="gv_switch_view_button" href="#gv_switch_view" title="<?php esc_attr_e( 'Switch View', 'gravityview' ); ?>"><?php esc_html_e( 'Switch View Type', 'gravityview' ); ?></a>
47 47
 </p>
48 48
 
49 49
 <?php // confirm dialog box ?>
Please login to merge, or discard this patch.
plugin-and-theme-hooks/class-gravityview-plugin-hooks-gravity-perks.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
 	function edit_entry_fix_hidden_fields( $fields ) {
48 48
 
49 49
 		/** @var GF_Field $field */
50
-		foreach( $fields as &$field ) {
50
+		foreach ( $fields as &$field ) {
51 51
 			if ( 'hidden' === $field->type ) {
52 52
 
53 53
 				// Replace GF_Field_Hidden with GF_Field_Text, copying all the data from $field
Please login to merge, or discard this patch.