Completed
Pull Request — master (#753)
by Zack
15:21 queued 11:07
created
includes/admin/field-types/type_multiselect.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 		?>
9 9
 		<label for="<?php echo $this->get_field_id(); ?>" class="<?php echo $this->get_label_class(); ?>"><?php
10 10
 
11
-			echo '<span class="gv-label">'.$this->get_field_label().'</span>';
11
+			echo '<span class="gv-label">' . $this->get_field_label() . '</span>';
12 12
 
13 13
 			echo $this->get_tooltip() . $this->get_field_desc();
14 14
 
@@ -20,13 +20,13 @@  discard block
 block discarded – undo
20 20
 	}
21 21
 
22 22
 	function render_input( $override_input = null ) {
23
-		if( isset( $override_input ) ) {
23
+		if ( isset( $override_input ) ) {
24 24
 			echo $override_input;
25 25
 			return;
26 26
 		}
27 27
 		?>
28 28
 		<select name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>">
29
-			<?php foreach( $this->field['options'] as $value => $label ) : ?>
29
+			<?php foreach ( $this->field[ 'options' ] as $value => $label ) : ?>
30 30
 				<option value="<?php echo esc_attr( $value ); ?>" <?php selected( $value, $this->value, true ); ?>><?php echo esc_html( $label ); ?></option>
31 31
 			<?php endforeach; ?>
32 32
 		</select>
Please login to merge, or discard this patch.
includes/class-common.php 3 patches
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.
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.
Spacing   +96 added lines, -96 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,10 +225,10 @@  discard block
 block discarded – undo
225 225
 		$has_post_fields = false;
226 226
 
227 227
 		if ( $form ) {
228
-			foreach ( $form['fields'] as $field ) {
228
+			foreach ( $form[ 'fields' ] as $field ) {
229 229
 
230
-				if ( $include_parent_field || empty( $field['inputs'] ) ) {
231
-					$fields["{$field->id}"] = array(
230
+				if ( $include_parent_field || empty( $field[ 'inputs' ] ) ) {
231
+					$fields[ "{$field->id}" ] = array(
232 232
 						'label' => rgar( $field, 'label' ),
233 233
 						'parent' => null,
234 234
 						'type' => rgar( $field, 'type' ),
@@ -243,10 +243,10 @@  discard block
 block discarded – undo
243 243
                          * @hack
244 244
                          * In case of email/email confirmation, the input for email has the same id as the parent field
245 245
                          */
246
-						if( 'email' === $field->type && false === strpos( $input['id'], '.' ) ) {
246
+						if ( 'email' === $field->type && false === strpos( $input[ 'id' ], '.' ) ) {
247 247
                             continue;
248 248
                         }
249
-						$fields["{$input['id']}"] = array(
249
+						$fields[ "{$input[ 'id' ]}" ] = array(
250 250
 							'label' => rgar( $input, 'label' ),
251 251
 							'customLabel' => rgar( $input, 'customLabel' ),
252 252
 							'parent' => $field,
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 				}
259 259
 
260 260
 
261
-				if( GFCommon::is_product_field( $field->type ) ){
261
+				if ( GFCommon::is_product_field( $field->type ) ) {
262 262
 					$has_product_fields = true;
263 263
 				}
264 264
 
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 		 * @since 1.7
273 273
 		 */
274 274
 		if ( $has_post_fields ) {
275
-			$fields['post_id'] = array(
275
+			$fields[ 'post_id' ] = array(
276 276
 				'label' => __( 'Post ID', 'gravityview' ),
277 277
 				'type' => 'post_id',
278 278
 			);
@@ -283,10 +283,10 @@  discard block
 block discarded – undo
283 283
 			$payment_fields = GravityView_Fields::get_all( 'pricing' );
284 284
 
285 285
 			foreach ( $payment_fields as $payment_field ) {
286
-				if( isset( $fields["{$payment_field->name}"] ) ) {
286
+				if ( isset( $fields[ "{$payment_field->name}" ] ) ) {
287 287
 					continue;
288 288
 				}
289
-				$fields["{$payment_field->name}"] = array(
289
+				$fields[ "{$payment_field->name}" ] = array(
290 290
 					'label' => $payment_field->label,
291 291
 					'desc' => $payment_field->description,
292 292
 					'type' => $payment_field->name,
@@ -318,9 +318,9 @@  discard block
 block discarded – undo
318 318
 
319 319
 		$fields = array();
320 320
 
321
-		foreach ( $extra_fields as $key => $field ){
322
-			if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) {
323
-				$fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' );
321
+		foreach ( $extra_fields as $key => $field ) {
322
+			if ( ! empty( $only_default_column ) && ! empty( $field[ 'is_default_column' ] ) ) {
323
+				$fields[ $key ] = array( 'label' => $field[ 'label' ], 'type' => 'entry_meta' );
324 324
 			}
325 325
 		}
326 326
 
@@ -360,32 +360,32 @@  discard block
 block discarded – undo
360 360
 			'search_criteria' => null,
361 361
 			'sorting' => null,
362 362
 			'paging' => null,
363
-			'cache' => (isset( $passed_criteria['cache'] ) ? $passed_criteria['cache'] : true),
363
+			'cache' => ( isset( $passed_criteria[ 'cache' ] ) ? $passed_criteria[ 'cache' ] : true ),
364 364
 		);
365 365
 
366 366
 		$criteria = wp_parse_args( $passed_criteria, $search_criteria_defaults );
367 367
 
368
-		if ( ! empty( $criteria['search_criteria']['field_filters'] ) ) {
369
-			foreach ( $criteria['search_criteria']['field_filters'] as &$filter ) {
368
+		if ( ! empty( $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) {
369
+			foreach ( $criteria[ 'search_criteria' ][ 'field_filters' ] as &$filter ) {
370 370
 
371 371
 				if ( ! is_array( $filter ) ) {
372 372
 					continue;
373 373
 				}
374 374
 
375 375
 				// By default, we want searches to be wildcard for each field.
376
-				$filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator'];
376
+				$filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ];
377 377
 
378 378
 				/**
379 379
 				 * @filter `gravityview_search_operator` Modify the search operator for the field (contains, is, isnot, etc)
380 380
 				 * @param string $operator Existing search operator
381 381
 				 * @param array $filter array with `key`, `value`, `operator`, `type` keys
382 382
 				 */
383
-				$filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter );
383
+				$filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter );
384 384
 			}
385 385
 
386 386
 			// don't send just the [mode] without any field filter.
387
-			if( count( $criteria['search_criteria']['field_filters'] ) === 1 && array_key_exists( 'mode' , $criteria['search_criteria']['field_filters'] ) ) {
388
-				unset( $criteria['search_criteria']['field_filters']['mode'] );
387
+			if ( count( $criteria[ 'search_criteria' ][ 'field_filters' ] ) === 1 && array_key_exists( 'mode', $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) {
388
+				unset( $criteria[ 'search_criteria' ][ 'field_filters' ][ 'mode' ] );
389 389
 			}
390 390
 
391 391
 		}
@@ -396,21 +396,21 @@  discard block
 block discarded – undo
396 396
 		 * Prepare date formats to be in Gravity Forms DB format;
397 397
 		 * $passed_criteria may include date formats incompatible with Gravity Forms.
398 398
 		 */
399
-		foreach ( array('start_date', 'end_date' ) as $key ) {
399
+		foreach ( array( 'start_date', 'end_date' ) as $key ) {
400 400
 
401
-			if ( ! empty( $criteria['search_criteria'][ $key ] ) ) {
401
+			if ( ! empty( $criteria[ 'search_criteria' ][ $key ] ) ) {
402 402
 
403 403
 				// Use date_create instead of new DateTime so it returns false if invalid date format.
404
-				$date = date_create( $criteria['search_criteria'][ $key ] );
404
+				$date = date_create( $criteria[ 'search_criteria' ][ $key ] );
405 405
 
406 406
 				if ( $date ) {
407 407
 					// Gravity Forms wants dates in the `Y-m-d H:i:s` format.
408
-					$criteria['search_criteria'][ $key ] = $date->format( 'Y-m-d H:i:s' );
408
+					$criteria[ 'search_criteria' ][ $key ] = $date->format( 'Y-m-d H:i:s' );
409 409
 				} else {
410 410
 					// If it's an invalid date, unset it. Gravity Forms freaks out otherwise.
411
-					unset( $criteria['search_criteria'][ $key ] );
411
+					unset( $criteria[ 'search_criteria' ][ $key ] );
412 412
 
413
-					do_action( 'gravityview_log_error', '[filter_get_entries_criteria] '.$key.' Date format not valid:', $criteria['search_criteria'][ $key ] );
413
+					do_action( 'gravityview_log_error', '[filter_get_entries_criteria] ' . $key . ' Date format not valid:', $criteria[ 'search_criteria' ][ $key ] );
414 414
 				}
415 415
 			}
416 416
 		}
@@ -418,12 +418,12 @@  discard block
 block discarded – undo
418 418
 
419 419
 		// When multiple views are embedded, OR single entry, calculate the context view id and send it to the advanced filter
420 420
 		if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() || GravityView_frontend::getInstance()->getSingleEntry() ) {
421
-			$criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id();
421
+			$criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id();
422 422
 		} elseif ( 'delete' === RGForms::get( 'action' ) ) {
423
-			$criteria['context_view_id'] = isset( $_GET['view_id'] ) ? intval( $_GET['view_id'] ) : null;
424
-		} elseif( !isset( $criteria['context_view_id'] ) ) {
423
+			$criteria[ 'context_view_id' ] = isset( $_GET[ 'view_id' ] ) ? intval( $_GET[ 'view_id' ] ) : null;
424
+		} elseif ( ! isset( $criteria[ 'context_view_id' ] ) ) {
425 425
             // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget)
426
-			$criteria['context_view_id'] = null;
426
+			$criteria[ 'context_view_id' ] = null;
427 427
 		}
428 428
 
429 429
 		/**
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 		 * @param array $form_ids Forms to search
433 433
 		 * @param int $view_id ID of the view being used to search
434 434
 		 */
435
-		$criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria['context_view_id'] );
435
+		$criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria[ 'context_view_id' ] );
436 436
 
437 437
 		return (array)$criteria;
438 438
 
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
 		/** Reduce # of database calls */
464 464
 		add_filter( 'gform_is_encrypted_field', '__return_false' );
465 465
 
466
-		if ( ! empty( $criteria['cache'] ) ) {
466
+		if ( ! empty( $criteria[ 'cache' ] ) ) {
467 467
 
468 468
 			$Cache = new GravityView_Cache( $form_ids, $criteria );
469 469
 
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
 
472 472
 				// Still update the total count when using cached results
473 473
 				if ( ! is_null( $total ) ) {
474
-					$total = GFAPI::count_entries( $form_ids, $criteria['search_criteria'] );
474
+					$total = GFAPI::count_entries( $form_ids, $criteria[ 'search_criteria' ] );
475 475
 				}
476 476
 
477 477
 				$return = $entries;
@@ -491,9 +491,9 @@  discard block
 block discarded – undo
491 491
 			$entries = apply_filters( 'gravityview_before_get_entries', null, $criteria, $passed_criteria, $total );
492 492
 
493 493
 			// No entries returned from gravityview_before_get_entries
494
-			if( is_null( $entries ) ) {
494
+			if ( is_null( $entries ) ) {
495 495
 
496
-				$entries = GFAPI::get_entries( $form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total );
496
+				$entries = GFAPI::get_entries( $form_ids, $criteria[ 'search_criteria' ], $criteria[ 'sorting' ], $criteria[ 'paging' ], $total );
497 497
 
498 498
 				if ( is_wp_error( $entries ) ) {
499 499
 					do_action( 'gravityview_log_error', $entries->get_error_message(), $entries );
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
 				}
503 503
 			}
504 504
 
505
-			if ( ! empty( $criteria['cache'] ) && isset( $Cache ) ) {
505
+			if ( ! empty( $criteria[ 'cache' ] ) && isset( $Cache ) ) {
506 506
 
507 507
 				// Cache results
508 508
 				$Cache->set( $entries, 'entries' );
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
 			 */
590 590
 			$check_entry_display = apply_filters( 'gravityview/common/get_entry/check_entry_display', $check_entry_display, $entry );
591 591
 
592
-			if( $check_entry_display ) {
592
+			if ( $check_entry_display ) {
593 593
 				// Is the entry allowed
594 594
 				$entry = self::check_entry_display( $entry );
595 595
 			}
@@ -622,12 +622,12 @@  discard block
 block discarded – undo
622 622
 
623 623
 		$value = false;
624 624
 
625
-		if( 'context' === $val1 ) {
625
+		if ( 'context' === $val1 ) {
626 626
 
627 627
 			$matching_contexts = array( $val2 );
628 628
 
629 629
 			// We allow for non-standard contexts.
630
-			switch( $val2 ) {
630
+			switch ( $val2 ) {
631 631
 				// Check for either single or edit
632 632
 				case 'singular':
633 633
 					$matching_contexts = array( 'single', 'edit' );
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
 			return false;
688 688
 		}
689 689
 
690
-		if ( empty( $entry['form_id'] ) ) {
690
+		if ( empty( $entry[ 'form_id' ] ) ) {
691 691
 			do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry is empty! Entry:', $entry );
692 692
 			return false;
693 693
 		}
@@ -695,26 +695,26 @@  discard block
 block discarded – undo
695 695
 		$criteria = self::calculate_get_entries_criteria();
696 696
 
697 697
 		// Make sure the current View is connected to the same form as the Entry
698
-		if( ! empty( $criteria['context_view_id'] ) ) {
699
-			$context_view_id = intval( $criteria['context_view_id'] );
698
+		if ( ! empty( $criteria[ 'context_view_id' ] ) ) {
699
+			$context_view_id = intval( $criteria[ 'context_view_id' ] );
700 700
 			$context_form_id = gravityview_get_form_id( $context_view_id );
701
-			if( intval( $context_form_id ) !== intval( $entry['form_id'] ) ) {
702
-				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'] );
701
+			if ( intval( $context_form_id ) !== intval( $entry[ 'form_id' ] ) ) {
702
+				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' ] );
703 703
 				return false;
704 704
 			}
705 705
 		}
706 706
 
707
-		if ( empty( $criteria['search_criteria'] ) || ! is_array( $criteria['search_criteria'] ) ) {
707
+		if ( empty( $criteria[ 'search_criteria' ] ) || ! is_array( $criteria[ 'search_criteria' ] ) ) {
708 708
 			do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No search criteria found:', $criteria );
709 709
 			return $entry;
710 710
 		}
711 711
 
712
-		$search_criteria = $criteria['search_criteria'];
712
+		$search_criteria = $criteria[ 'search_criteria' ];
713 713
 		unset( $criteria );
714 714
 
715 715
 		// check entry status
716
-		if ( array_key_exists( 'status', $search_criteria ) && $search_criteria['status'] != $entry['status'] ) {
717
-			do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry['status'] ), $search_criteria );
716
+		if ( array_key_exists( 'status', $search_criteria ) && $search_criteria[ 'status' ] != $entry[ 'status' ] ) {
717
+			do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry[ 'status' ] ), $search_criteria );
718 718
 			return false;
719 719
 		}
720 720
 
@@ -722,37 +722,37 @@  discard block
 block discarded – undo
722 722
 		// @todo: Does it make sense to apply the Date create filters to the single entry?
723 723
 
724 724
 		// field_filters
725
-		if ( empty( $search_criteria['field_filters'] ) || ! is_array( $search_criteria['field_filters'] ) ) {
725
+		if ( empty( $search_criteria[ 'field_filters' ] ) || ! is_array( $search_criteria[ 'field_filters' ] ) ) {
726 726
 			do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No field filters criteria found:', $search_criteria );
727 727
 			return $entry;
728 728
 		}
729 729
 
730
-		$filters = $search_criteria['field_filters'];
730
+		$filters = $search_criteria[ 'field_filters' ];
731 731
 		unset( $search_criteria );
732 732
 
733
-		$mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters['mode'] ) : 'all';
734
-		unset( $filters['mode'] );
733
+		$mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters[ 'mode' ] ) : 'all';
734
+		unset( $filters[ 'mode' ] );
735 735
 
736
-		$form = self::get_form( $entry['form_id'] );
736
+		$form = self::get_form( $entry[ 'form_id' ] );
737 737
 
738 738
 		foreach ( $filters as $filter ) {
739 739
 
740
-			if ( ! isset( $filter['key'] ) ) {
740
+			if ( ! isset( $filter[ 'key' ] ) ) {
741 741
 				continue;
742 742
 			}
743 743
 
744
-			$k = $filter['key'];
744
+			$k = $filter[ 'key' ];
745 745
 
746 746
 			if ( in_array( $k, array( 'created_by', 'payment_status' ) ) ) {
747 747
 				$field_value = $entry[ $k ];
748 748
 				$field = null;
749 749
 			} else {
750 750
 				$field = self::get_field( $form, $k );
751
-				$field_value  = GFFormsModel::get_lead_field_value( $entry, $field );
751
+				$field_value = GFFormsModel::get_lead_field_value( $entry, $field );
752 752
 			}
753 753
 
754
-			$operator = isset( $filter['operator'] ) ? strtolower( $filter['operator'] ) : 'is';
755
-			$is_value_match = GFFormsModel::is_value_match( $field_value, $filter['value'], $operator, $field );
754
+			$operator = isset( $filter[ 'operator' ] ) ? strtolower( $filter[ 'operator' ] ) : 'is';
755
+			$is_value_match = GFFormsModel::is_value_match( $field_value, $filter[ 'value' ], $operator, $field );
756 756
 
757 757
 			// verify if we are already free to go!
758 758
 			if ( ! $is_value_match && 'all' === $mode ) {
@@ -810,18 +810,18 @@  discard block
 block discarded – undo
810 810
 		 * Gravity Forms code to adjust date to locally-configured Time Zone
811 811
 		 * @see GFCommon::format_date() for original code
812 812
 		 */
813
-		$date_gmt_time   = mysql2date( 'G', $date_string );
813
+		$date_gmt_time = mysql2date( 'G', $date_string );
814 814
 		$date_local_timestamp = GFCommon::get_local_timestamp( $date_gmt_time );
815 815
 
816
-		$format  = rgar( $atts, 'format' );
817
-		$is_human  = ! empty( $atts['human'] );
818
-		$is_diff  = ! empty( $atts['diff'] );
819
-		$is_raw = ! empty( $atts['raw'] );
820
-		$is_timestamp = ! empty( $atts['timestamp'] );
821
-		$include_time = ! empty( $atts['time'] );
816
+		$format = rgar( $atts, 'format' );
817
+		$is_human = ! empty( $atts[ 'human' ] );
818
+		$is_diff = ! empty( $atts[ 'diff' ] );
819
+		$is_raw = ! empty( $atts[ 'raw' ] );
820
+		$is_timestamp = ! empty( $atts[ 'timestamp' ] );
821
+		$include_time = ! empty( $atts[ 'time' ] );
822 822
 
823 823
 		// If we're using time diff, we want to have a different default format
824
-		if( empty( $format ) ) {
824
+		if ( empty( $format ) ) {
825 825
 			/* translators: %s: relative time from now, used for generic date comparisons. "1 day ago", or "20 seconds ago" */
826 826
 			$format = $is_diff ? esc_html__( '%s ago', 'gravityview' ) : get_option( 'date_format' );
827 827
 		}
@@ -829,7 +829,7 @@  discard block
 block discarded – undo
829 829
 		// If raw was specified, don't modify the stored value
830 830
 		if ( $is_raw ) {
831 831
 			$formatted_date = $date_string;
832
-		} elseif( $is_timestamp ) {
832
+		} elseif ( $is_timestamp ) {
833 833
 			$formatted_date = $date_local_timestamp;
834 834
 		} elseif ( $is_diff ) {
835 835
 			$formatted_date = sprintf( $format, human_time_diff( $date_gmt_time ) );
@@ -863,7 +863,7 @@  discard block
 block discarded – undo
863 863
 
864 864
 		$label = rgar( $field, 'label' );
865 865
 
866
-		if( floor( $field_id ) !== floatval( $field_id ) ) {
866
+		if ( floor( $field_id ) !== floatval( $field_id ) ) {
867 867
 			$label = GFFormsModel::get_choice_text( $field, $field_value, $field_id );
868 868
 		}
869 869
 
@@ -884,7 +884,7 @@  discard block
 block discarded – undo
884 884
 	 * @return GF_Field|null Gravity Forms field object, or NULL: Gravity Forms GFFormsModel does not exist or field at $field_id doesn't exist.
885 885
 	 */
886 886
 	public static function get_field( $form, $field_id ) {
887
-		if ( class_exists( 'GFFormsModel' ) ){
887
+		if ( class_exists( 'GFFormsModel' ) ) {
888 888
 			return GFFormsModel::get_field( $form, $field_id );
889 889
 		} else {
890 890
 			return null;
@@ -931,19 +931,19 @@  discard block
 block discarded – undo
931 931
 			$shortcodes = array();
932 932
 
933 933
 			preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER );
934
-			if ( empty( $matches ) ){
934
+			if ( empty( $matches ) ) {
935 935
 				return false;
936 936
 			}
937 937
 
938 938
 			foreach ( $matches as $shortcode ) {
939
-				if ( $tag === $shortcode[2] ) {
939
+				if ( $tag === $shortcode[ 2 ] ) {
940 940
 
941 941
 					// Changed this to $shortcode instead of true so we get the parsed atts.
942
-					$shortcodes[] = $shortcode;
942
+					$shortcodes[ ] = $shortcode;
943 943
 
944
-				} else if ( isset( $shortcode[5] ) && $results = self::has_shortcode_r( $shortcode[5], $tag ) ) {
945
-					foreach( $results as $result ) {
946
-						$shortcodes[] = $result;
944
+				} else if ( isset( $shortcode[ 5 ] ) && $results = self::has_shortcode_r( $shortcode[ 5 ], $tag ) ) {
945
+					foreach ( $results as $result ) {
946
+						$shortcodes[ ] = $result;
947 947
 					}
948 948
 				}
949 949
 			}
@@ -1104,7 +1104,7 @@  discard block
 block discarded – undo
1104 1104
 	 * @return string         html
1105 1105
 	 */
1106 1106
 	public static function get_sortable_fields( $formid, $current = '' ) {
1107
-		$output = '<option value="" ' . selected( '', $current, false ).'>' . esc_html__( 'Default', 'gravityview' ) .'</option>';
1107
+		$output = '<option value="" ' . selected( '', $current, false ) . '>' . esc_html__( 'Default', 'gravityview' ) . '</option>';
1108 1108
 
1109 1109
 		if ( empty( $formid ) ) {
1110 1110
 			return $output;
@@ -1117,11 +1117,11 @@  discard block
 block discarded – undo
1117 1117
 			$blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', array( 'list', 'textarea' ), null );
1118 1118
 
1119 1119
 			foreach ( $fields as $id => $field ) {
1120
-				if ( in_array( $field['type'], $blacklist_field_types ) ) {
1120
+				if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
1121 1121
 					continue;
1122 1122
 				}
1123 1123
 
1124
-				$output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'>'. esc_attr( $field['label'] ) .'</option>';
1124
+				$output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . '>' . esc_attr( $field[ 'label' ] ) . '</option>';
1125 1125
 			}
1126 1126
 		}
1127 1127
 
@@ -1156,9 +1156,9 @@  discard block
 block discarded – undo
1156 1156
 		$blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL );
1157 1157
 
1158 1158
 		// TODO: Convert to using array_filter
1159
-		foreach( $fields as $id => $field ) {
1159
+		foreach ( $fields as $id => $field ) {
1160 1160
 
1161
-			if( in_array( $field['type'], $blacklist_field_types ) ) {
1161
+			if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
1162 1162
 				unset( $fields[ $id ] );
1163 1163
 			}
1164 1164
 		}
@@ -1199,14 +1199,14 @@  discard block
 block discarded – undo
1199 1199
 	 * @param  int|array  $field field key or field array
1200 1200
 	 * @return boolean
1201 1201
 	 */
1202
-	public static function is_field_numeric(  $form = null, $field = '' ) {
1202
+	public static function is_field_numeric( $form = null, $field = '' ) {
1203 1203
 
1204 1204
 		if ( ! is_array( $form ) && ! is_array( $field ) ) {
1205 1205
 			$form = self::get_form( $form );
1206 1206
 		}
1207 1207
 
1208 1208
 		// If entry meta, it's a string. Otherwise, numeric
1209
-		if( ! is_numeric( $field ) && is_string( $field ) ) {
1209
+		if ( ! is_numeric( $field ) && is_string( $field ) ) {
1210 1210
 			$type = $field;
1211 1211
 		} else {
1212 1212
 			$type = self::get_field_type( $form, $field );
@@ -1220,9 +1220,9 @@  discard block
 block discarded – undo
1220 1220
 		$numeric_types = apply_filters( 'gravityview/common/numeric_types', array( 'number', 'time' ) );
1221 1221
 
1222 1222
 		// Defer to GravityView_Field setting, if the field type is registered and `is_numeric` is true
1223
-		if( $gv_field = GravityView_Fields::get( $type ) ) {
1224
-			if( true === $gv_field->is_numeric ) {
1225
-				$numeric_types[] = $gv_field->is_numeric;
1223
+		if ( $gv_field = GravityView_Fields::get( $type ) ) {
1224
+			if ( true === $gv_field->is_numeric ) {
1225
+				$numeric_types[ ] = $gv_field->is_numeric;
1226 1226
 			}
1227 1227
 		}
1228 1228
 
@@ -1372,18 +1372,18 @@  discard block
 block discarded – undo
1372 1372
 		$final_atts = array_filter( $final_atts );
1373 1373
 
1374 1374
 		// If the href wasn't passed as an attribute, use the value passed to the function
1375
-		if ( empty( $final_atts['href'] ) && ! empty( $href ) ) {
1376
-			$final_atts['href'] = $href;
1375
+		if ( empty( $final_atts[ 'href' ] ) && ! empty( $href ) ) {
1376
+			$final_atts[ 'href' ] = $href;
1377 1377
 		}
1378 1378
 
1379
-		$final_atts['href'] = esc_url_raw( $href );
1379
+		$final_atts[ 'href' ] = esc_url_raw( $href );
1380 1380
 
1381 1381
 		/**
1382 1382
 		 * Fix potential security issue with target=_blank
1383 1383
 		 * @see https://dev.to/ben/the-targetblank-vulnerability-by-example
1384 1384
 		 */
1385
-		if( '_blank' === rgar( $final_atts, 'target' ) ) {
1386
-			$final_atts['rel'] = trim( rgar( $final_atts, 'rel', '' ) . ' noopener noreferrer' );
1385
+		if ( '_blank' === rgar( $final_atts, 'target' ) ) {
1386
+			$final_atts[ 'rel' ] = trim( rgar( $final_atts, 'rel', '' ) . ' noopener noreferrer' );
1387 1387
 		}
1388 1388
 
1389 1389
 		// Sort the attributes alphabetically, to help testing
@@ -1395,7 +1395,7 @@  discard block
 block discarded – undo
1395 1395
 			$output .= sprintf( ' %s="%s"', $attr, esc_attr( $value ) );
1396 1396
 		}
1397 1397
 
1398
-		if( '' !== $output ) {
1398
+		if ( '' !== $output ) {
1399 1399
 			$output = '<a' . $output . '>' . $anchor_text . '</a>';
1400 1400
 		}
1401 1401
 
@@ -1422,7 +1422,7 @@  discard block
 block discarded – undo
1422 1422
 			if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) {
1423 1423
 				$merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value );
1424 1424
 			} else if ( is_numeric( $key ) && isset( $merged[ $key ] ) ) {
1425
-				$merged[] = $value;
1425
+				$merged[ ] = $value;
1426 1426
 			} else {
1427 1427
 				$merged[ $key ] = $value;
1428 1428
 			}
@@ -1455,7 +1455,7 @@  discard block
 block discarded – undo
1455 1455
 		 * `$context` is where are we using this information (e.g. change_entry_creator, search_widget ..)
1456 1456
 		 * @param array $settings Settings array, with `number` key defining the # of users to display
1457 1457
 		 */
1458
-		$get_users_settings = apply_filters( 'gravityview/get_users/'. $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) );
1458
+		$get_users_settings = apply_filters( 'gravityview/get_users/' . $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) );
1459 1459
 
1460 1460
 		return get_users( $get_users_settings );
1461 1461
 	}
@@ -1470,7 +1470,7 @@  discard block
 block discarded – undo
1470 1470
      * @return string
1471 1471
      */
1472 1472
     public static function generate_notice( $notice, $class = '' ) {
1473
-        return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>';
1473
+        return '<div class="gv-notice ' . gravityview_sanitize_html_class( $class ) . '">' . $notice . '</div>';
1474 1474
     }
1475 1475
 
1476 1476
 	/**
Please login to merge, or discard this patch.
includes/helper-functions.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -32,19 +32,19 @@  discard block
 block discarded – undo
32 32
 	// If there's an overriding CSS file in the current template folder, use it.
33 33
 	$template_css_path = trailingslashit( get_stylesheet_directory() ) . 'gravityview/css/' . $css_file;
34 34
 
35
-	if( file_exists( $template_css_path ) ) {
35
+	if ( file_exists( $template_css_path ) ) {
36 36
 		$path = trailingslashit( get_stylesheet_directory_uri() ) . 'gravityview/css/' . $css_file;
37
-		do_action( 'gravityview_log_debug', __FUNCTION__ . ': Stylesheet override ('. esc_attr( $css_file ) .')' );
37
+		do_action( 'gravityview_log_debug', __FUNCTION__ . ': Stylesheet override (' . esc_attr( $css_file ) . ')' );
38 38
 	} else {
39 39
 		// Default: use GravityView CSS file
40 40
 
41 41
 		// If no path is provided, assume default plugin templates CSS folder
42
-		if( '' === $dir_path ) {
42
+		if ( '' === $dir_path ) {
43 43
 			$dir_path = GRAVITYVIEW_DIR . 'templates/css/';
44 44
 		}
45 45
 		
46 46
 		// plugins_url() expects a path to a file, not directory. We append a file to be stripped.
47
-		$path = plugins_url( $css_file, trailingslashit( $dir_path )  . 'stripped-by-plugin_basename.php' );
47
+		$path = plugins_url( $css_file, trailingslashit( $dir_path ) . 'stripped-by-plugin_basename.php' );
48 48
 	}
49 49
 
50 50
 	return $path;
@@ -82,9 +82,9 @@  discard block
 block discarded – undo
82 82
 
83 83
 	$parsed_permalink = parse_url( get_permalink( $id ) );
84 84
 
85
-	$permalink_args =  isset( $parsed_permalink['query'] ) ? $parsed_permalink['query'] : false;
85
+	$permalink_args = isset( $parsed_permalink[ 'query' ] ) ? $parsed_permalink[ 'query' ] : false;
86 86
 
87
-	if( empty( $permalink_args ) ) {
87
+	if ( empty( $permalink_args ) ) {
88 88
 		return array();
89 89
 	}
90 90
 
@@ -109,15 +109,15 @@  discard block
 block discarded – undo
109 109
 function gv_selected( $value, $current, $echo = true, $type = 'selected' ) {
110 110
 
111 111
 	$output = '';
112
-	if( is_array( $current ) ) {
113
-		if( in_array( $value, $current ) ) {
112
+	if ( is_array( $current ) ) {
113
+		if ( in_array( $value, $current ) ) {
114 114
 			$output = __checked_selected_helper( true, true, false, $type );
115 115
 		}
116 116
 	} else {
117 117
 		$output = __checked_selected_helper( $value, $current, false, $type );
118 118
 	}
119 119
 
120
-	if( $echo ) {
120
+	if ( $echo ) {
121 121
 		echo $output;
122 122
 	}
123 123
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 }
126 126
 
127 127
 
128
-if( ! function_exists( 'gravityview_sanitize_html_class' ) ) {
128
+if ( ! function_exists( 'gravityview_sanitize_html_class' ) ) {
129 129
 
130 130
 	/**
131 131
 	 * sanitize_html_class doesn't handle spaces (multiple classes). We remedy that.
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
  */
172 172
 function gravityview_strip_whitespace( $string ) {
173 173
 	$string = normalize_whitespace( $string );
174
-	return preg_replace('/[\r\n\t ]+/', ' ', $string );
174
+	return preg_replace( '/[\r\n\t ]+/', ' ', $string );
175 175
 }
176 176
 
177 177
 /**
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
  * @return string Included file contents
186 186
  */
187 187
 function gravityview_ob_include( $file_path, $object = NULL ) {
188
-	if( ! file_exists( $file_path ) ) {
188
+	if ( ! file_exists( $file_path ) ) {
189 189
 		do_action( 'gravityview_log_error', __FUNCTION__ . ': File path does not exist. ', $file_path );
190 190
 		return '';
191 191
 	}
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 
204 204
 	$width = $height * 0.7586206897;
205 205
 
206
-	if( function_exists('is_rtl') && is_rtl() ) {
206
+	if ( function_exists( 'is_rtl' ) && is_rtl() ) {
207 207
 		$style = 'margin:10px 10px 10px 0;';
208 208
 		$class = 'alignright';
209 209
 	} else {
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 		$class = 'alignleft';
212 212
 	}
213 213
 
214
-	return '<img src="'.plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ).'" class="'.$class.'" height="'.intval( $height ).'" width="'.round( $width, 2 ).'" alt="The GravityView Astronaut Says:" style="'.$style.'" />';
214
+	return '<img src="' . plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ) . '" class="' . $class . '" height="' . intval( $height ) . '" width="' . round( $width, 2 ) . '" alt="The GravityView Astronaut Says:" style="' . $style . '" />';
215 215
 }
216 216
 
217 217
 /**
@@ -234,9 +234,9 @@  discard block
 block discarded – undo
234 234
 function gravityview_number_format( $number, $decimals = '' ) {
235 235
 	global $wp_locale;
236 236
 
237
-	if( '' === $decimals ) {
237
+	if ( '' === $decimals ) {
238 238
 
239
-		$decimal_point = isset( $wp_locale ) ? $wp_locale->number_format['decimal_point'] : '.';
239
+		$decimal_point = isset( $wp_locale ) ? $wp_locale->number_format[ 'decimal_point' ] : '.';
240 240
 
241 241
 		/**
242 242
 		 * Calculate the position of the decimal point in the number
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 	$parts = parse_url( $value );
266 266
 
267 267
 	// No domain? Strange...show the original text.
268
-	if( empty( $parts['host'] ) ) {
268
+	if ( empty( $parts[ 'host' ] ) ) {
269 269
 		return $value;
270 270
 	}
271 271
 
@@ -278,16 +278,16 @@  discard block
 block discarded – undo
278 278
 	 * @param boolean $enable Whether to strip the scheme. Return false to show scheme. (default: true)\n
279 279
 	 * If true: `http://example.com => example.com`
280 280
 	 */
281
-	if( false === apply_filters('gravityview_anchor_text_striphttp', true) ) {
281
+	if ( false === apply_filters( 'gravityview_anchor_text_striphttp', true ) ) {
282 282
 
283
-		if( isset( $parts['scheme'] ) ) {
284
-			$return .= $parts['scheme'];
283
+		if ( isset( $parts[ 'scheme' ] ) ) {
284
+			$return .= $parts[ 'scheme' ];
285 285
 		}
286 286
 
287 287
 	}
288 288
 
289 289
 	// The domain, which may contain a subdomain
290
-	$domain = $parts['host'];
290
+	$domain = $parts[ 'host' ];
291 291
 
292 292
 	/**
293 293
 	 * @filter `gravityview_anchor_text_stripwww` Strip www from the domain?
@@ -295,10 +295,10 @@  discard block
 block discarded – undo
295 295
 	 * @param boolean $enable Whether to strip www. Return false to show www. (default: true)\n
296 296
 	 * If true: `www.example.com => example.com`
297 297
 	 */
298
-	$strip_www = apply_filters('gravityview_anchor_text_stripwww', true );
298
+	$strip_www = apply_filters( 'gravityview_anchor_text_stripwww', true );
299 299
 
300
-	if( $strip_www ) {
301
-		$domain = str_replace('www.', '', $domain );
300
+	if ( $strip_www ) {
301
+		$domain = str_replace( 'www.', '', $domain );
302 302
 	}
303 303
 
304 304
 	/**
@@ -308,11 +308,11 @@  discard block
 block discarded – undo
308 308
 	 * If true: `http://demo.example.com => example.com` \n
309 309
 	 * If false: `http://demo.example.com => demo.example.com`
310 310
 	 */
311
-	$strip_subdomains = apply_filters('gravityview_anchor_text_nosubdomain', true);
311
+	$strip_subdomains = apply_filters( 'gravityview_anchor_text_nosubdomain', true );
312 312
 
313
-	if( $strip_subdomains ) {
313
+	if ( $strip_subdomains ) {
314 314
 
315
-		$domain = _gravityview_strip_subdomain( $parts['host'] );
315
+		$domain = _gravityview_strip_subdomain( $parts[ 'host' ] );
316 316
 
317 317
 	}
318 318
 
@@ -326,12 +326,12 @@  discard block
 block discarded – undo
326 326
 	 * If true: `http://example.com/sub/directory/page.html => example.com`  \n
327 327
 	 * If false: `http://example.com/sub/directory/page.html => example.com/sub/directory/page.html`
328 328
 	 */
329
-	$root_only = apply_filters('gravityview_anchor_text_rootonly', true);
329
+	$root_only = apply_filters( 'gravityview_anchor_text_rootonly', true );
330 330
 
331
-	if( empty( $root_only ) ) {
331
+	if ( empty( $root_only ) ) {
332 332
 
333
-		if( isset( $parts['path'] ) ) {
334
-			$return .= $parts['path'];
333
+		if ( isset( $parts[ 'path' ] ) ) {
334
+			$return .= $parts[ 'path' ];
335 335
 		}
336 336
 	}
337 337
 
@@ -341,12 +341,12 @@  discard block
 block discarded – undo
341 341
 	 * @param boolean $enable Whether to enable "root only". Return false to show full path. (default: true)\n
342 342
 	 * If true: `http://example.com/?query=example => example.com`
343 343
 	 */
344
-	$strip_query_string = apply_filters('gravityview_anchor_text_noquerystring', true );
344
+	$strip_query_string = apply_filters( 'gravityview_anchor_text_noquerystring', true );
345 345
 
346
-	if( empty( $strip_query_string ) ) {
346
+	if ( empty( $strip_query_string ) ) {
347 347
 
348
-		if( isset( $parts['query'] ) ) {
349
-			$return .= '?'.$parts['query'];
348
+		if ( isset( $parts[ 'query' ] ) ) {
349
+			$return .= '?' . $parts[ 'query' ];
350 350
 		}
351 351
 
352 352
 	}
@@ -363,8 +363,8 @@  discard block
 block discarded – undo
363 363
  */
364 364
 function _gravityview_strip_subdomain( $string_maybe_has_subdomain ) {
365 365
 
366
-	if( preg_match("/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.(?:com\.|co\.|net\.|org\.|firm\.|me\.|school\.|law\.|gov\.|mod\.|msk\.|irkutsks\.|sa\.|act\.|police\.|plc\.|ac\.|tm\.|asso\.|biz\.|pro\.|cg\.|telememo\.)?[a-z\.]{2,6})$/i", $string_maybe_has_subdomain, $matches ) ) {
367
-		return $matches['domain'];
366
+	if ( preg_match( "/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.(?:com\.|co\.|net\.|org\.|firm\.|me\.|school\.|law\.|gov\.|mod\.|msk\.|irkutsks\.|sa\.|act\.|police\.|plc\.|ac\.|tm\.|asso\.|biz\.|pro\.|cg\.|telememo\.)?[a-z\.]{2,6})$/i", $string_maybe_has_subdomain, $matches ) ) {
367
+		return $matches[ 'domain' ];
368 368
 	} else {
369 369
 		return $string_maybe_has_subdomain;
370 370
 	}
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
  */
386 386
 function gv_empty( $value, $zero_is_empty = true, $allow_string_booleans = true ) {
387 387
 
388
-	if(
388
+	if (
389 389
 		! isset( $value ) // If it's not set, it's empty!
390 390
 		|| false === $value
391 391
 		|| null === $value
@@ -396,20 +396,20 @@  discard block
 block discarded – undo
396 396
 		return true;
397 397
 	}
398 398
 
399
-	if( is_string( $value ) && $allow_string_booleans ) {
399
+	if ( is_string( $value ) && $allow_string_booleans ) {
400 400
 
401 401
 		$value = trim( $value );
402 402
 		$value = strtolower( $value );
403 403
 
404 404
 		if ( in_array( $value, array( 'yes', 'true' ), true ) ) {
405 405
 			$value = true;
406
-		} else if( in_array( $value, array( 'no', 'false' ), true ) ) {
406
+		} else if ( in_array( $value, array( 'no', 'false' ), true ) ) {
407 407
 			$value = false;
408 408
 		}
409 409
 	}
410 410
 
411 411
 	// If zero isn't empty, then if $value is a number and it's empty, it's zero. Thus, return false.
412
-	if( ! $zero_is_empty && is_numeric( $value ) && empty( $value ) ) {
412
+	if ( ! $zero_is_empty && is_numeric( $value ) && empty( $value ) ) {
413 413
 		return false;
414 414
 	}
415 415
 
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 
433 433
 	// Use the original function, if exists.
434 434
 	// Requires WP 4.4+
435
-	if( function_exists( 'map_deep') ) {
435
+	if ( function_exists( 'map_deep' ) ) {
436 436
 		return map_deep( $value, $callback );
437 437
 	}
438 438
 
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
 
498 498
 	$exploded = explode( '.', "{$field_id}" );
499 499
 
500
-	return isset( $exploded[1] ) ? intval( $exploded[1] ) : false;
500
+	return isset( $exploded[ 1 ] ) ? intval( $exploded[ 1 ] ) : false;
501 501
 }
502 502
 
503 503
 /**
@@ -538,13 +538,13 @@  discard block
 block discarded – undo
538 538
 	 */
539 539
 	$args = apply_filters( 'gravityview_get_terms_choices_args', $args );
540 540
 
541
-	$terms = get_terms( $args['taxonomy'], $args );
541
+	$terms = get_terms( $args[ 'taxonomy' ], $args );
542 542
 
543 543
 	$choices = array();
544 544
 
545 545
 	if ( is_array( $terms ) ) {
546 546
 		foreach ( $terms as $term_id => $term_name ) {
547
-			$choices[] = array(
547
+			$choices[ ] = array(
548 548
 				'text'  => $term_name,
549 549
 				'value' => $term_id
550 550
 			);
@@ -568,21 +568,21 @@  discard block
 block discarded – undo
568 568
 function _gravityview_process_posted_fields() {
569 569
 	$fields = array();
570 570
 
571
-	if( !empty( $_POST['gv_fields'] ) ) {
572
-		if ( ! is_array( $_POST['gv_fields'] ) ) {
571
+	if ( ! empty( $_POST[ 'gv_fields' ] ) ) {
572
+		if ( ! is_array( $_POST[ 'gv_fields' ] ) ) {
573 573
 
574 574
 			// We are not using parse_str() due to max_input_vars limitation with large View configurations
575 575
 			$fields_holder = array();
576
-			GVCommon::gv_parse_str( $_POST['gv_fields'], $fields_holder );
576
+			GVCommon::gv_parse_str( $_POST[ 'gv_fields' ], $fields_holder );
577 577
 
578
-			if ( isset( $fields_holder['fields'] ) ) {
579
-				$fields = $fields_holder['fields'];
578
+			if ( isset( $fields_holder[ 'fields' ] ) ) {
579
+				$fields = $fields_holder[ 'fields' ];
580 580
 			} else {
581 581
 				do_action( 'gravityview_log_error', '[save_postdata] No `fields` key was found after parsing $fields string', $fields_holder );
582 582
 			}
583 583
 
584 584
 		} else {
585
-			$fields = $_POST['gv_fields'];
585
+			$fields = $_POST[ 'gv_fields' ];
586 586
 		}
587 587
 	}
588 588
 
Please login to merge, or discard this patch.
includes/class-admin.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -4,10 +4,10 @@  discard block
 block discarded – undo
4 4
 
5 5
 	function __construct() {
6 6
 
7
-		if( ! is_admin() ) { return; }
7
+		if ( ! is_admin() ) { return; }
8 8
 
9 9
 		// If Gravity Forms isn't active or compatibile, stop loading
10
-		if( false === GravityView_Compatibility::is_valid() ) {
10
+		if ( false === GravityView_Compatibility::is_valid() ) {
11 11
 			return;
12 12
 		}
13 13
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 		require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-migrate.php' );
26 26
 
27 27
 		// Don't load tooltips if on Gravity Forms, otherwise it overrides translations
28
-		if( class_exists( 'GFCommon' ) && class_exists( 'GFForms' ) && !GFForms::is_gravity_page() ) {
28
+		if ( class_exists( 'GFCommon' ) && class_exists( 'GFForms' ) && ! GFForms::is_gravity_page() ) {
29 29
 			require_once( GFCommon::get_base_path() . '/tooltips.php' );
30 30
 		}
31 31
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 		add_filter( 'post_updated_messages', array( $this, 'post_updated_messages' ) );
54 54
 		add_filter( 'bulk_post_updated_messages', array( $this, 'post_updated_messages' ) );
55 55
 
56
-		add_filter( 'plugin_action_links_'. plugin_basename( GRAVITYVIEW_FILE ) , array( $this, 'plugin_action_links' ) );
56
+		add_filter( 'plugin_action_links_' . plugin_basename( GRAVITYVIEW_FILE ), array( $this, 'plugin_action_links' ) );
57 57
 
58 58
 		add_action( 'plugins_loaded', array( $this, 'backend_actions' ), 100 );
59 59
 
@@ -68,22 +68,22 @@  discard block
 block discarded – undo
68 68
 	public function backend_actions() {
69 69
 
70 70
 		/** @define "GRAVITYVIEW_DIR" "../" */
71
-		include_once( GRAVITYVIEW_DIR .'includes/admin/class.field.type.php' );
72
-		include_once( GRAVITYVIEW_DIR .'includes/admin/class.render.settings.php' );
73
-		include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-item.php' );
74
-		include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-field.php' );
75
-		include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-widget.php' );
76
-		include_once( GRAVITYVIEW_DIR .'includes/class-admin-views.php' );
77
-		include_once( GRAVITYVIEW_DIR .'includes/class-admin-welcome.php' );
78
-		include_once( GRAVITYVIEW_DIR .'includes/class-admin-add-shortcode.php' );
79
-		include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' );
71
+		include_once( GRAVITYVIEW_DIR . 'includes/admin/class.field.type.php' );
72
+		include_once( GRAVITYVIEW_DIR . 'includes/admin/class.render.settings.php' );
73
+		include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-item.php' );
74
+		include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-field.php' );
75
+		include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-widget.php' );
76
+		include_once( GRAVITYVIEW_DIR . 'includes/class-admin-views.php' );
77
+		include_once( GRAVITYVIEW_DIR . 'includes/class-admin-welcome.php' );
78
+		include_once( GRAVITYVIEW_DIR . 'includes/class-admin-add-shortcode.php' );
79
+		include_once( GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php' );
80 80
 
81 81
 		/**
82 82
 		 * @action `gravityview_include_backend_actions` Triggered after all GravityView admin files are loaded
83 83
 		 *
84 84
 		 * Nice place to insert extensions' backend stuff
85 85
 		 */
86
-		do_action('gravityview_include_backend_actions');
86
+		do_action( 'gravityview_include_backend_actions' );
87 87
 	}
88 88
 
89 89
 	/**
@@ -99,12 +99,12 @@  discard block
 block discarded – undo
99 99
 
100 100
 		$actions = array();
101 101
 
102
-		if( GVCommon::has_cap( 'gravityview_view_settings' ) ) {
103
-			$actions[] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) );
102
+		if ( GVCommon::has_cap( 'gravityview_view_settings' ) ) {
103
+			$actions[ ] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) );
104 104
 		}
105 105
 
106
-		if( GVCommon::has_cap( 'gravityview_support_port' ) ) {
107
-			$actions[] = '<a href="http://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>';
106
+		if ( GVCommon::has_cap( 'gravityview_support_port' ) ) {
107
+			$actions[ ] = '<a href="http://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>';
108 108
 		}
109 109
 
110 110
 		return array_merge( $actions, $links );
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 		// By default, there will only be one item being modified.
133 133
 		// When in the `bulk_post_updated_messages` filter, there will be passed a number
134 134
 		// of modified items that will override this array.
135
-		$bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1 , 'locked' => 1 , 'deleted' => 1 , 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts;
135
+		$bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1, 'locked' => 1, 'deleted' => 1, 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts;
136 136
 
137 137
 		// If we're starting fresh, a new form was created.
138 138
 		// We should let the user know this is the case.
@@ -140,60 +140,60 @@  discard block
 block discarded – undo
140 140
 
141 141
 		$new_form_text = '';
142 142
 
143
-		if( !empty( $start_fresh ) ) {
143
+		if ( ! empty( $start_fresh ) ) {
144 144
 
145 145
 			// Get the form that was created
146 146
 			$connected_form = gravityview_get_form_id( $post_id );
147 147
 
148
-			if( !empty( $connected_form ) ) {
148
+			if ( ! empty( $connected_form ) ) {
149 149
 				$form = gravityview_get_form( $connected_form );
150
-				$form_name = esc_attr( $form['title'] );
150
+				$form_name = esc_attr( $form[ 'title' ] );
151 151
 				$image = self::get_floaty();
152
-				$new_form_text .= '<h3>'.$image.sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ).'</h3>';
153
-				$new_form_text .=  sprintf( __( '%sThere are no entries for the new form, so the View will also be empty.%s To start collecting entries, you can add submissions through %sthe preview form%s and also embed the form on a post or page using this code: %s
152
+				$new_form_text .= '<h3>' . $image . sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ) . '</h3>';
153
+				$new_form_text .= sprintf( __( '%sThere are no entries for the new form, so the View will also be empty.%s To start collecting entries, you can add submissions through %sthe preview form%s and also embed the form on a post or page using this code: %s
154 154
 
155 155
 					You can %sedit the form%s in Gravity Forms and the updated fields will be available here. Don&rsquo;t forget to %scustomize the form settings%s.
156
-					', 'gravityview' ), '<strong>', '</strong>', '<a href="'.site_url( '?gf_page=preview&amp;id='.$connected_form ).'">', '</a>', '<code>[gravityform id="'.$connected_form.'" name="'.$form_name.'"]</code>', '<a href="'.admin_url( 'admin.php?page=gf_edit_forms&amp;id='.$connected_form ).'">', '</a>', '<a href="'.admin_url( 'admin.php?page=gf_edit_forms&amp;view=settings&amp;id='.$connected_form ).'">', '</a>');
156
+					', 'gravityview' ), '<strong>', '</strong>', '<a href="' . site_url( '?gf_page=preview&amp;id=' . $connected_form ) . '">', '</a>', '<code>[gravityform id="' . $connected_form . '" name="' . $form_name . '"]</code>', '<a href="' . admin_url( 'admin.php?page=gf_edit_forms&amp;id=' . $connected_form ) . '">', '</a>', '<a href="' . admin_url( 'admin.php?page=gf_edit_forms&amp;view=settings&amp;id=' . $connected_form ) . '">', '</a>' );
157 157
 				$new_form_text = wpautop( $new_form_text );
158 158
 
159 159
 				delete_post_meta( $post_id, '_gravityview_start_fresh' );
160 160
 			}
161 161
 		}
162 162
 
163
-		$messages['gravityview'] = array(
163
+		$messages[ 'gravityview' ] = array(
164 164
 			0  => '', // Unused. Messages start at index 1.
165 165
 			/* translators: %s and %s are HTML tags linking to the View on the website */
166
-			1  => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'),
166
+			1  => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ),
167 167
 			/* translators: %s and %s are HTML tags linking to the View on the website */
168
-			2  => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'),
168
+			2  => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ),
169 169
 			3  => __( 'View deleted.', 'gravityview' ),
170 170
 			/* translators: %s and %s are HTML tags linking to the View on the website */
171
-			4  => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'),
171
+			4  => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ),
172 172
 			/* translators: %s: date and time of the revision */
173
-			5  => isset( $_GET['revision'] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
173
+			5  => isset( $_GET[ 'revision' ] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int)$_GET[ 'revision' ], false ) ) : false,
174 174
 			/* translators: %s and %s are HTML tags linking to the View on the website */
175
-			6  => sprintf(__( 'View published. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text,
175
+			6  => sprintf( __( 'View published. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text,
176 176
 			/* translators: %s and %s are HTML tags linking to the View on the website */
177
-			7  => sprintf(__( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text,
177
+			7  => sprintf( __( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text,
178 178
 			8  => __( 'View submitted.', 'gravityview' ),
179 179
 			9  => sprintf(
180 180
 		        /* translators: Date and time the View is scheduled to be published */
181 181
 				__( 'View scheduled for: %1$s.', 'gravityview' ),
182 182
 				// translators: Publish box date format, see http://php.net/date
183
-				date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL )  ) )
183
+				date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) )
184 184
 			) . $new_form_text,
185 185
 			/* translators: %s and %s are HTML tags linking to the View on the website */
186
-			10  => sprintf(__( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'),
186
+			10  => sprintf( __( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ),
187 187
 
188 188
 			/**
189 189
 			 * These apply to `bulk_post_updated_messages`
190 190
 			 * @file wp-admin/edit.php
191 191
 			 */
192
-			'updated'   => _n( '%s View updated.', '%s Views updated.', $bulk_counts['updated'], 'gravityview' ),
193
-			'locked'    => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts['locked'], 'gravityview' ),
194
-			'deleted'   => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts['deleted'], 'gravityview' ),
195
-			'trashed'   => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts['trashed'], 'gravityview' ),
196
-			'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts['untrashed'], 'gravityview' ),
192
+			'updated'   => _n( '%s View updated.', '%s Views updated.', $bulk_counts[ 'updated' ], 'gravityview' ),
193
+			'locked'    => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts[ 'locked' ], 'gravityview' ),
194
+			'deleted'   => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts[ 'deleted' ], 'gravityview' ),
195
+			'trashed'   => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts[ 'trashed' ], 'gravityview' ),
196
+			'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts[ 'untrashed' ], 'gravityview' ),
197 197
 		);
198 198
 
199 199
 		return $messages;
@@ -253,29 +253,29 @@  discard block
 block discarded – undo
253 253
 	static function is_admin_page( $hook = '', $page = NULL ) {
254 254
 		global $current_screen, $plugin_page, $pagenow, $post;
255 255
 
256
-		if( ! is_admin() ) { return false; }
256
+		if ( ! is_admin() ) { return false; }
257 257
 
258 258
 		$is_page = false;
259 259
 
260
-		$is_gv_screen = (!empty($current_screen) && isset($current_screen->post_type) && $current_screen->post_type === 'gravityview');
260
+		$is_gv_screen = ( ! empty( $current_screen ) && isset( $current_screen->post_type ) && $current_screen->post_type === 'gravityview' );
261 261
 
262
-		$is_gv_post_type_get = (isset($_GET['post_type']) && $_GET['post_type'] === 'gravityview');
262
+		$is_gv_post_type_get = ( isset( $_GET[ 'post_type' ] ) && $_GET[ 'post_type' ] === 'gravityview' );
263 263
 
264
-		$is_gv_settings_get = isset( $_GET['page'] ) && $_GET['page'] === 'gravityview_settings';
264
+		$is_gv_settings_get = isset( $_GET[ 'page' ] ) && $_GET[ 'page' ] === 'gravityview_settings';
265 265
 
266
-		if( empty( $post ) && $pagenow === 'post.php' && !empty( $_GET['post'] ) ) {
267
-			$gv_post = get_post( intval( $_GET['post'] ) );
268
-			$is_gv_post_type = (!empty($gv_post) && !empty($gv_post->post_type) && $gv_post->post_type === 'gravityview');
266
+		if ( empty( $post ) && $pagenow === 'post.php' && ! empty( $_GET[ 'post' ] ) ) {
267
+			$gv_post = get_post( intval( $_GET[ 'post' ] ) );
268
+			$is_gv_post_type = ( ! empty( $gv_post ) && ! empty( $gv_post->post_type ) && $gv_post->post_type === 'gravityview' );
269 269
 		} else {
270
-			$is_gv_post_type = (!empty($post) && !empty($post->post_type) && $post->post_type === 'gravityview');
270
+			$is_gv_post_type = ( ! empty( $post ) && ! empty( $post->post_type ) && $post->post_type === 'gravityview' );
271 271
 		}
272 272
 
273
-		if( $is_gv_screen || $is_gv_post_type || $is_gv_post_type || $is_gv_post_type_get || $is_gv_settings_get ) {
273
+		if ( $is_gv_screen || $is_gv_post_type || $is_gv_post_type || $is_gv_post_type_get || $is_gv_settings_get ) {
274 274
 
275 275
 			// $_GET `post_type` variable
276
-			if(in_array($pagenow, array( 'post.php' , 'post-new.php' )) ) {
276
+			if ( in_array( $pagenow, array( 'post.php', 'post-new.php' ) ) ) {
277 277
 				$is_page = 'single';
278
-			} else if ( in_array( $plugin_page, array( 'gravityview_settings', 'gravityview_page_gravityview_settings' ) ) || ( !empty( $_GET['page'] ) && $_GET['page'] === 'gravityview_settings' ) ) {
278
+			} else if ( in_array( $plugin_page, array( 'gravityview_settings', 'gravityview_page_gravityview_settings' ) ) || ( ! empty( $_GET[ 'page' ] ) && $_GET[ 'page' ] === 'gravityview_settings' ) ) {
279 279
 				$is_page = 'settings';
280 280
 			} else {
281 281
 				$is_page = 'views';
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 		$is_page = apply_filters( 'gravityview_is_admin_page', $is_page, $hook );
291 291
 
292 292
 		// If the current page is the same as the compared page
293
-		if( !empty( $page ) ) {
293
+		if ( ! empty( $page ) ) {
294 294
 			return $is_page === $page;
295 295
 		}
296 296
 
@@ -311,6 +311,6 @@  discard block
 block discarded – undo
311 311
  *
312 312
  * @return bool|string|void If `false`, not a GravityView page. `true` if $page is passed and is the same as current page. Otherwise, the name of the page (`single`, `settings`, or `views`)
313 313
  */
314
-function gravityview_is_admin_page($hook = '', $page = NULL) {
314
+function gravityview_is_admin_page( $hook = '', $page = NULL ) {
315 315
 	return GravityView_Admin::is_admin_page( $hook, $page );
316 316
 }
Please login to merge, or discard this patch.
includes/admin/class-gravityview-admin-view-widget.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@
 block discarded – undo
12 12
 
13 13
 		$field_info_items = array();
14 14
 
15
-		if( !empty( $this->item['description'] ) ) {
15
+		if ( ! empty( $this->item[ 'description' ] ) ) {
16 16
 
17
-			$field_info_items[] = array(
18
-				'value' => $this->item['description']
17
+			$field_info_items[ ] = array(
18
+				'value' => $this->item[ 'description' ]
19 19
 			);
20 20
 
21 21
 		}
Please login to merge, or discard this patch.
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/admin/class-gravityview-admin-view-item.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -19,9 +19,9 @@  discard block
 block discarded – undo
19 19
 	function __construct( $title = '', $item_id, $item = array(), $settings = array() ) {
20 20
 
21 21
 		// Backward compat
22
-		if( !empty( $item['type'] ) ) {
23
-			$item['input_type'] = $item['type'];
24
-			unset( $item['type'] );
22
+		if ( ! empty( $item[ 'type' ] ) ) {
23
+			$item[ 'input_type' ] = $item[ 'type' ];
24
+			unset( $item[ 'type' ] );
25 25
 		}
26 26
 
27 27
 		// Prevent items from not having index set
@@ -35,13 +35,13 @@  discard block
 block discarded – undo
35 35
 			'adminLabel' => NULL,
36 36
 			'adminOnly' => NULL,
37 37
 			'subtitle' => NULL,
38
-		));
38
+		) );
39 39
 
40 40
 		$this->title = $title;
41 41
 		$this->item = $item;
42 42
 		$this->id = $item_id;
43 43
 		$this->settings = $settings;
44
-		$this->label_type = $item['label_type'];
44
+		$this->label_type = $item[ 'label_type' ];
45 45
 	}
46 46
 
47 47
 	/**
@@ -80,13 +80,13 @@  discard block
 block discarded – undo
80 80
 		 */
81 81
 		$field_info_items = apply_filters( 'gravityview_admin_label_item_info', $field_info_items, $this );
82 82
 
83
-		if( $html ) {
83
+		if ( $html ) {
84 84
 
85 85
 			foreach ( $field_info_items as $item ) {
86
-				$class = isset($item['class']) ? sanitize_html_class( $item['class'] ).' description' : 'description';
86
+				$class = isset( $item[ 'class' ] ) ? sanitize_html_class( $item[ 'class' ] ) . ' description' : 'description';
87 87
 				// Add the title in case the value's long, in which case, it'll be truncated by CSS.
88
-				$output .= '<span class="'.$class.'">';
89
-				$output .= esc_html( $item['value'] );
88
+				$output .= '<span class="' . $class . '">';
89
+				$output .= esc_html( $item[ 'value' ] );
90 90
 				$output .= '</span>';
91 91
 			}
92 92
 
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 
95 95
 			$values = wp_list_pluck( $field_info_items, 'value' );
96 96
 
97
-			$output = esc_html( implode(', ', $values) );
97
+			$output = esc_html( implode( ', ', $values ) );
98 98
 
99 99
 		}
100 100
 
@@ -109,53 +109,53 @@  discard block
 block discarded – undo
109 109
 	 */
110 110
 	function getOutput() {
111 111
 
112
-		$settings_title = sprintf(__('Configure %s Settings', 'gravityview'), ucfirst($this->label_type));
113
-		$delete_title = sprintf(__('Remove %s', 'gravityview'), ucfirst($this->label_type));
114
-		$single_link_title = __('This field links to the Single Entry', 'gravityview');
112
+		$settings_title = sprintf( __( 'Configure %s Settings', 'gravityview' ), ucfirst( $this->label_type ) );
113
+		$delete_title = sprintf( __( 'Remove %s', 'gravityview' ), ucfirst( $this->label_type ) );
114
+		$single_link_title = __( 'This field links to the Single Entry', 'gravityview' );
115 115
 
116 116
 		// $settings_html will just be hidden inputs if empty. Otherwise, it'll have an <ul>. Ugly hack, I know.
117 117
 		// TODO: Un-hack this
118
-		$hide_settings_link = ( empty( $this->item['settings_html'] ) || strpos( $this->item['settings_html'], '<!-- No Options -->') > 0 ) ? 'hide-if-js' : '';
118
+		$hide_settings_link = ( empty( $this->item[ 'settings_html' ] ) || strpos( $this->item[ 'settings_html' ], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : '';
119 119
 		$settings_link = sprintf( '<a href="#settings" class="dashicons-admin-generic dashicons %s" title="%s"></a>', $hide_settings_link, esc_attr( $settings_title ) );
120 120
 
121 121
 		// Should we show the icon that the field is being used as a link to single entry?
122
-		$hide_show_as_link_class = empty( $this->settings['show_as_link'] ) ? 'hide-if-js' : '';
123
-		$show_as_link = '<span class="dashicons dashicons-admin-links '.$hide_show_as_link_class.'" title="'.esc_attr( $single_link_title ).'"></span>';
122
+		$hide_show_as_link_class = empty( $this->settings[ 'show_as_link' ] ) ? 'hide-if-js' : '';
123
+		$show_as_link = '<span class="dashicons dashicons-admin-links ' . $hide_show_as_link_class . '" title="' . esc_attr( $single_link_title ) . '"></span>';
124 124
 
125 125
 		// When a field label is empty, use the Field ID
126
-		$label = empty( $this->title ) ? sprintf( _x('Field #%s (No Label)', 'Label in field picker for empty label', 'gravityview'), $this->id ) : $this->title;
126
+		$label = empty( $this->title ) ? sprintf( _x( 'Field #%s (No Label)', 'Label in field picker for empty label', 'gravityview' ), $this->id ) : $this->title;
127 127
 
128 128
 		// If there's a custom label, and show label is checked, use that as the field heading
129
-		if( !empty( $this->settings['custom_label'] ) && !empty( $this->settings['show_label'] ) ) {
130
-			$label = $this->settings['custom_label'];
131
-		} else if( !empty( $this->item['customLabel'] ) ) {
132
-			$label = $this->item['customLabel'];
129
+		if ( ! empty( $this->settings[ 'custom_label' ] ) && ! empty( $this->settings[ 'show_label' ] ) ) {
130
+			$label = $this->settings[ 'custom_label' ];
131
+		} else if ( ! empty( $this->item[ 'customLabel' ] ) ) {
132
+			$label = $this->item[ 'customLabel' ];
133 133
 		}
134 134
 
135
-		$output = '<h5 class="selectable gfield field-id-'.esc_attr($this->id).'">';
135
+		$output = '<h5 class="selectable gfield field-id-' . esc_attr( $this->id ) . '">';
136 136
 
137 137
 		$label = esc_attr( $label );
138 138
 
139
-		if( !empty( $this->item['parent'] ) ) {
140
-			$label .= ' <small>('.esc_attr( $this->item['parent']['label'] ) .')</small>';
139
+		if ( ! empty( $this->item[ 'parent' ] ) ) {
140
+			$label .= ' <small>(' . esc_attr( $this->item[ 'parent' ][ 'label' ] ) . ')</small>';
141 141
 		}
142 142
 
143 143
 		// Name of field / widget
144
-		$output .= '<span class="gv-field-label" data-original-title="'.esc_attr( $label ).'" title="'. $this->get_item_info( false ) .'">'. $label . '</span>';
144
+		$output .= '<span class="gv-field-label" data-original-title="' . esc_attr( $label ) . '" title="' . $this->get_item_info( false ) . '">' . $label . '</span>';
145 145
 
146 146
 
147
-		$output .= '<span class="gv-field-controls">'.$settings_link.$show_as_link.'<a href="#remove" class="dashicons-dismiss dashicons" title="'.esc_attr( $delete_title ) .'"></a></span>';
147
+		$output .= '<span class="gv-field-controls">' . $settings_link . $show_as_link . '<a href="#remove" class="dashicons-dismiss dashicons" title="' . esc_attr( $delete_title ) . '"></a></span>';
148 148
 
149 149
 		// Displays only in the field/widget picker.
150
-		if( $field_info = $this->get_item_info() ) {
151
-			$output .= '<span class="gv-field-info">'.$field_info.'</span>';
150
+		if ( $field_info = $this->get_item_info() ) {
151
+			$output .= '<span class="gv-field-info">' . $field_info . '</span>';
152 152
 		}
153 153
 
154 154
 		$output .= '</h5>';
155 155
 
156
-		$container_class = !empty( $this->item['parent'] ) ? ' gv-child-field' : '';
156
+		$container_class = ! empty( $this->item[ 'parent' ] ) ? ' gv-child-field' : '';
157 157
 
158
-		$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>';
158
+		$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>';
159 159
 
160 160
 		return $output;
161 161
 	}
Please login to merge, or discard this patch.
includes/connector-functions.php 1 patch
Doc Comments   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
  *
57 57
  * @see GVCommon::get_form_fields()
58 58
  * @access public
59
- * @param string|array $form_id (default: '') or $form object
59
+ * @param string|array $form (default: '') or $form object
60 60
  * @return array
61 61
  */
62 62
 function gravityview_get_form_fields( $form = '', $add_default_properties = false, $include_parent_field = true ) {
@@ -94,6 +94,7 @@  discard block
 block discarded – undo
94 94
  * @param int|array $form_ids The ID of the form or an array IDs of the Forms. Zero for all forms.
95 95
  * @param mixed $passed_criteria (default: null)
96 96
  * @param mixed &$total (default: null)
97
+ * @param integer $total
97 98
  * @return mixed False: Error fetching entries. Array: Multi-dimensional array of Gravity Forms entry arrays
98 99
  */
99 100
 function gravityview_get_entries( $form_ids = null, $passed_criteria = null, &$total = null ) {
@@ -106,7 +107,6 @@  discard block
 block discarded – undo
106 107
  * Since 1.4, supports custom entry slugs. The way that GravityView fetches an entry based on the custom slug is by searching `gravityview_unique_id` meta. The `$entry_slug` is fetched by getting the current query var set by `is_single_entry()`
107 108
  *
108 109
  * @access public
109
- * @param mixed $entry_id
110 110
  * @param boolean $force_allow_ids Force the get_entry() method to allow passed entry IDs, even if the `gravityview_custom_entry_slug_allow_id` filter returns false.
111 111
  * @param boolean $check_entry_display Check whether the entry is visible for the current View configuration. Default: true {@since 1.14}
112 112
  * @return array|boolean
@@ -193,7 +193,6 @@  discard block
 block discarded – undo
193 193
  *
194 194
  * @see GravityView_Template::template_id
195 195
  *
196
- * @param int $view_id The ID of the View to get the layout of
197 196
  *
198 197
  * @return string GravityView_Template::template_id value. Empty string if not.
199 198
  */
Please login to merge, or discard this patch.
includes/class-admin-add-shortcode.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -20,12 +20,12 @@  discard block
 block discarded – undo
20 20
 
21 21
 	function __construct() {
22 22
 
23
-			add_action( 'media_buttons', array( $this, 'add_shortcode_button'), 30);
23
+			add_action( 'media_buttons', array( $this, 'add_shortcode_button' ), 30 );
24 24
 
25
-			add_action( 'admin_footer',	array( $this, 'add_shortcode_popup') );
25
+			add_action( 'admin_footer', array( $this, 'add_shortcode_popup' ) );
26 26
 
27 27
 			// adding styles and scripts
28
-			add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles') );
28
+			add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ) );
29 29
 
30 30
 			// ajax - populate sort fields based on the selected view
31 31
 			add_action( 'wp_ajax_gv_sortable_fields', array( $this, 'get_sortable_fields' ) );
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	 */
41 41
 	function is_post_editor_screen() {
42 42
 		global $current_screen, $pagenow;
43
-		return !empty( $current_screen->post_type ) && 'gravityview' != $current_screen->post_type && in_array( $pagenow , array( 'post.php' , 'post-new.php' ) );
43
+		return ! empty( $current_screen->post_type ) && 'gravityview' != $current_screen->post_type && in_array( $pagenow, array( 'post.php', 'post-new.php' ) );
44 44
 	}
45 45
 
46 46
 
@@ -55,15 +55,15 @@  discard block
 block discarded – undo
55 55
 		/**
56 56
 		 * @since 1.15.3
57 57
 		 */
58
-		if( ! GVCommon::has_cap( array( 'publish_gravityviews' ) ) ) {
58
+		if ( ! GVCommon::has_cap( array( 'publish_gravityviews' ) ) ) {
59 59
 			return;
60 60
 		}
61 61
 
62
-		if( !$this->is_post_editor_screen() ) {
62
+		if ( ! $this->is_post_editor_screen() ) {
63 63
 			return;
64 64
 		}
65 65
 		?>
66
-		<a href="#TB_inline?width=600&amp;height=800&amp;inlineId=select_gravityview_view" class="thickbox hide-if-no-js button gform_media_link" id="add_gravityview" title="<?php esc_attr_e("Insert View", 'gravityview'); ?>"><span class="icon gv-icon-astronaut-head"></span><?php esc_html_e( 'Add View', 'gravityview' ); ?></a>
66
+		<a href="#TB_inline?width=600&amp;height=800&amp;inlineId=select_gravityview_view" class="thickbox hide-if-no-js button gform_media_link" id="add_gravityview" title="<?php esc_attr_e( "Insert View", 'gravityview' ); ?>"><span class="icon gv-icon-astronaut-head"></span><?php esc_html_e( 'Add View', 'gravityview' ); ?></a>
67 67
 		<?php
68 68
 
69 69
 	}
@@ -79,17 +79,17 @@  discard block
 block discarded – undo
79 79
 	function add_shortcode_popup() {
80 80
 		global $post;
81 81
 
82
-		if( !$this->is_post_editor_screen() ) {
82
+		if ( ! $this->is_post_editor_screen() ) {
83 83
 			return;
84 84
 		}
85 85
 
86
-		$post_type = get_post_type_object($post->post_type);
86
+		$post_type = get_post_type_object( $post->post_type );
87 87
 
88
-		$views = get_posts( array('post_type' => 'gravityview', 'posts_per_page' => -1 ) );
88
+		$views = get_posts( array( 'post_type' => 'gravityview', 'posts_per_page' => -1 ) );
89 89
 
90 90
 		// If there are no views set up yet, we get outta here.
91
-		if( empty( $views ) ) {
92
-			echo '<div id="select_gravityview_view"><div class="wrap">'. GravityView_Post_Types::no_views_text() .'</div></div>';
91
+		if ( empty( $views ) ) {
92
+			echo '<div id="select_gravityview_view"><div class="wrap">' . GravityView_Post_Types::no_views_text() . '</div></div>';
93 93
 			return;
94 94
 		}
95 95
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 				<div class="wrap">
100 100
 
101 101
 					<h2 class=""><?php esc_html_e( 'Embed a View', 'gravityview' ); ?></h2>
102
-					<p class="subtitle"><?php printf( esc_attr ( __( 'Use this form to embed a View into this %s. %sLearn more about using shortcodes.%s', 'gravityview') ), $post_type->labels->singular_name, '<a href="http://docs.gravityview.co/article/73-using-the-shortcode" target="_blank" rel="noopener noreferrer">', '</a>' ); ?></p>
102
+					<p class="subtitle"><?php printf( esc_attr( __( 'Use this form to embed a View into this %s. %sLearn more about using shortcodes.%s', 'gravityview' ) ), $post_type->labels->singular_name, '<a href="http://docs.gravityview.co/article/73-using-the-shortcode" target="_blank" rel="noopener noreferrer">', '</a>' ); ?></p>
103 103
 
104 104
 					<div>
105 105
 						<h3><label for="gravityview_id"><?php esc_html_e( 'Select a View', 'gravityview' ); ?></label></h3>
@@ -107,9 +107,9 @@  discard block
 block discarded – undo
107 107
 						<select name="gravityview_id" id="gravityview_id">
108 108
 							<option value=""><?php esc_html_e( '&mdash; Select a View to Insert &mdash;', 'gravityview' ); ?></option>
109 109
 							<?php
110
-							foreach( $views as $view ) {
111
-								$title = empty( $view->post_title ) ? __('(no title)', 'gravityview') : $view->post_title;
112
-								echo '<option value="'. $view->ID .'">'. esc_html( sprintf('%s #%d', $title, $view->ID ) ) .'</option>';
110
+							foreach ( $views as $view ) {
111
+								$title = empty( $view->post_title ) ? __( '(no title)', 'gravityview' ) : $view->post_title;
112
+								echo '<option value="' . $view->ID . '">' . esc_html( sprintf( '%s #%d', $title, $view->ID ) ) . '</option>';
113 113
 							}
114 114
 							?>
115 115
 						</select>
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 
126 126
 						foreach ( $settings as $key => $setting ) {
127 127
 
128
-							if( empty( $setting['show_in_shortcode'] ) ) { continue; }
128
+							if ( empty( $setting[ 'show_in_shortcode' ] ) ) { continue; }
129 129
 
130 130
 							GravityView_Render_Settings::render_setting_row( $key, array(), NULL, 'gravityview_%s', 'gravityview_%s' );
131 131
 						}
@@ -134,8 +134,8 @@  discard block
 block discarded – undo
134 134
 					</table>
135 135
 
136 136
 					<div class="submit">
137
-						<input type="submit" class="button button-primary button-large alignleft hide-if-js" value="<?php esc_attr_e('Insert View', 'gravityview' ); ?>" id="insert_gravityview_view" />
138
-						<input class="button button-secondary alignright" type="submit" onclick="tb_remove(); return false;" value="<?php esc_attr_e("Cancel", 'gravityview'); ?>" />
137
+						<input type="submit" class="button button-primary button-large alignleft hide-if-js" value="<?php esc_attr_e( 'Insert View', 'gravityview' ); ?>" id="insert_gravityview_view" />
138
+						<input class="button button-secondary alignright" type="submit" onclick="tb_remove(); return false;" value="<?php esc_attr_e( "Cancel", 'gravityview' ); ?>" />
139 139
 					</div>
140 140
 
141 141
 				</div>
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 	 */
157 157
 	function add_scripts_and_styles() {
158 158
 
159
-		if( ! $this->is_post_editor_screen() ) {
159
+		if ( ! $this->is_post_editor_screen() ) {
160 160
 			return;
161 161
 		}
162 162
 
@@ -167,22 +167,22 @@  discard block
 block discarded – undo
167 167
 
168 168
 		$protocol = is_ssl() ? 'https://' : 'http://';
169 169
 
170
-		wp_enqueue_style( 'jquery-ui-datepicker', $protocol.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css', array(), GravityView_Plugin::version );
170
+		wp_enqueue_style( 'jquery-ui-datepicker', $protocol . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css', array(), GravityView_Plugin::version );
171 171
 
172 172
 		//enqueue styles
173
-		wp_register_style( 'gravityview_postedit_styles', plugins_url('assets/css/admin-post-edit.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version );
173
+		wp_register_style( 'gravityview_postedit_styles', plugins_url( 'assets/css/admin-post-edit.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version );
174 174
 		wp_enqueue_style( 'gravityview_postedit_styles' );
175 175
 
176
-		$script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
176
+		$script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
177 177
 
178 178
 		// custom js
179
-		wp_register_script( 'gravityview_postedit_scripts',  plugins_url('assets/js/admin-post-edit'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery', 'jquery-ui-datepicker' ), GravityView_Plugin::version );
179
+		wp_register_script( 'gravityview_postedit_scripts', plugins_url( 'assets/js/admin-post-edit' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery', 'jquery-ui-datepicker' ), GravityView_Plugin::version );
180 180
 		wp_enqueue_script( 'gravityview_postedit_scripts' );
181
-		wp_localize_script('gravityview_postedit_scripts', 'gvGlobals', array(
182
-			'nonce' => wp_create_nonce( 'gravityview_ajaxaddshortcode'),
181
+		wp_localize_script( 'gravityview_postedit_scripts', 'gvGlobals', array(
182
+			'nonce' => wp_create_nonce( 'gravityview_ajaxaddshortcode' ),
183 183
 			'loading_text' => esc_html__( 'Loading&hellip;', 'gravityview' ),
184
-			'alert_1' => esc_html__( 'Please select a View', 'gravityview'),
185
-		));
184
+			'alert_1' => esc_html__( 'Please select a View', 'gravityview' ),
185
+		) );
186 186
 
187 187
 	}
188 188
 
@@ -198,16 +198,16 @@  discard block
 block discarded – undo
198 198
 	function get_sortable_fields() {
199 199
 
200 200
 		// Not properly formatted request
201
-		if ( empty( $_POST['viewid'] ) || !is_numeric( $_POST['viewid'] ) ) {
201
+		if ( empty( $_POST[ 'viewid' ] ) || ! is_numeric( $_POST[ 'viewid' ] ) ) {
202 202
 			exit( false );
203 203
 		}
204 204
 
205 205
 		// Not valid request
206
-		if( empty( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxaddshortcode' ) ) {
206
+		if ( empty( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxaddshortcode' ) ) {
207 207
 			exit( false );
208 208
 		}
209 209
 
210
-		$viewid = (int)$_POST['viewid'];
210
+		$viewid = (int)$_POST[ 'viewid' ];
211 211
 
212 212
 		// fetch form id assigned to the view
213 213
 		$formid = gravityview_get_form_id( $viewid );
Please login to merge, or discard this patch.