Completed
Push — develop ( d6e54c...488d60 )
by Zack
17:10
created
includes/class-common.php 3 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   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -305,12 +305,12 @@  discard block
 block discarded – undo
305 305
 						}
306 306
 
307 307
 						/**
308
-                         * @hack
309
-                         * In case of email/email confirmation, the input for email has the same id as the parent field
310
-                         */
308
+						 * @hack
309
+						 * In case of email/email confirmation, the input for email has the same id as the parent field
310
+						 */
311 311
 						if( 'email' === $field['type'] && false === strpos( $input['id'], '.' ) ) {
312
-                            continue;
313
-                        }
312
+							continue;
313
+						}
314 314
 						$fields["{$input['id']}"] = array(
315 315
 							'label' => \GV\Utils::get( $input, 'label' ),
316 316
 							'customLabel' => \GV\Utils::get( $input, 'customLabel' ),
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
 		} elseif ( 'delete' === GFForms::get( 'action' ) ) {
496 496
 			$criteria['context_view_id'] = isset( $_GET['view_id'] ) ? intval( $_GET['view_id'] ) : null;
497 497
 		} elseif( !isset( $criteria['context_view_id'] ) ) {
498
-            // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget)
498
+			// Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget)
499 499
 			$criteria['context_view_id'] = null;
500 500
 		}
501 501
 
@@ -1354,7 +1354,7 @@  discard block
 block discarded – undo
1354 1354
 			),
1355 1355
 		);
1356 1356
 
1357
-        $fields = $date_created + $fields;
1357
+		$fields = $date_created + $fields;
1358 1358
 
1359 1359
 		$blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL );
1360 1360
 
@@ -1366,13 +1366,13 @@  discard block
 block discarded – undo
1366 1366
 			}
1367 1367
 		}
1368 1368
 
1369
-        /**
1370
-         * @filter `gravityview/common/sortable_fields` Filter the sortable fields
1371
-         * @since 1.12
1372
-         * @param array $fields Sub-set of GF form fields that are sortable
1373
-         * @param int $formid The Gravity Forms form ID that the fields are from
1374
-         */
1375
-        $fields = apply_filters( 'gravityview/common/sortable_fields', $fields, $formid );
1369
+		/**
1370
+		 * @filter `gravityview/common/sortable_fields` Filter the sortable fields
1371
+		 * @since 1.12
1372
+		 * @param array $fields Sub-set of GF form fields that are sortable
1373
+		 * @param int $formid The Gravity Forms form ID that the fields are from
1374
+		 */
1375
+		$fields = apply_filters( 'gravityview/common/sortable_fields', $fields, $formid );
1376 1376
 
1377 1377
 		return $fields;
1378 1378
 	}
@@ -1664,26 +1664,26 @@  discard block
 block discarded – undo
1664 1664
 	}
1665 1665
 
1666 1666
 
1667
-    /**
1668
-     * Display updated/error notice
1669
-     *
1670
-     * @since 1.19.2 Added $cap and $object_id parameters
1671
-     *
1672
-     * @param string $notice text/HTML of notice
1673
-     * @param string $class CSS class for notice (`updated` or `error`)
1674
-     * @param string $cap [Optional] Define a capability required to show a notice. If not set, displays to all caps.
1675
-     *
1676
-     * @return string
1677
-     */
1678
-    public static function generate_notice( $notice, $class = '', $cap = '', $object_id = null ) {
1679
-
1680
-    	// If $cap is defined, only show notice if user has capability
1681
-    	if( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) {
1682
-    		return '';
1683
-	    }
1684
-
1685
-        return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>';
1686
-    }
1667
+	/**
1668
+	 * Display updated/error notice
1669
+	 *
1670
+	 * @since 1.19.2 Added $cap and $object_id parameters
1671
+	 *
1672
+	 * @param string $notice text/HTML of notice
1673
+	 * @param string $class CSS class for notice (`updated` or `error`)
1674
+	 * @param string $cap [Optional] Define a capability required to show a notice. If not set, displays to all caps.
1675
+	 *
1676
+	 * @return string
1677
+	 */
1678
+	public static function generate_notice( $notice, $class = '', $cap = '', $object_id = null ) {
1679
+
1680
+		// If $cap is defined, only show notice if user has capability
1681
+		if( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) {
1682
+			return '';
1683
+		}
1684
+
1685
+		return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>';
1686
+	}
1687 1687
 
1688 1688
 	/**
1689 1689
 	 * 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   +113 added lines, -113 removed lines patch added patch discarded remove patch
@@ -125,8 +125,8 @@  discard block
 block discarded – undo
125 125
 
126 126
 		$form = false;
127 127
 
128
-		if( $entry ) {
129
-			$form = GFAPI::get_form( $entry['form_id'] );
128
+		if ( $entry ) {
129
+			$form = GFAPI::get_form( $entry[ 'form_id' ] );
130 130
 		}
131 131
 
132 132
 		return $form;
@@ -192,12 +192,12 @@  discard block
 block discarded – undo
192 192
 
193 193
 			$has_transaction_data = \GV\Utils::get( $entry, $meta, false );
194 194
 
195
-			if( ! empty( $has_transaction_data ) ) {
195
+			if ( ! empty( $has_transaction_data ) ) {
196 196
 				break;
197 197
 			}
198 198
 		}
199 199
 
200
-		return (bool) $has_transaction_data;
200
+		return (bool)$has_transaction_data;
201 201
 	}
202 202
 
203 203
 	/**
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 
236 236
 		$results = GFAPI::get_entries( intval( $form_id ), $search_criteria, null, $paging );
237 237
 
238
-		$result = ( ! empty( $results ) && ! empty( $results[0]['id'] ) ) ? $results[0]['id'] : null;
238
+		$result = ( ! empty( $results ) && ! empty( $results[ 0 ][ 'id' ] ) ) ? $results[ 0 ][ 'id' ] : null;
239 239
 
240 240
 		return $result;
241 241
 	}
@@ -252,10 +252,10 @@  discard block
 block discarded – undo
252 252
 	 *
253 253
 	 * @return array Empty array if GFAPI class isn't available or no forms. Otherwise, the array of Forms
254 254
 	 */
255
-	public static function get_forms(  $active = true, $trash = false ) {
255
+	public static function get_forms( $active = true, $trash = false ) {
256 256
 		$forms = array();
257 257
 		if ( class_exists( 'GFAPI' ) ) {
258
-			if( 'any' === $active ) {
258
+			if ( 'any' === $active ) {
259 259
 				$active_forms = GFAPI::get_forms( true, $trash );
260 260
 				$inactive_forms = GFAPI::get_forms( false, $trash );
261 261
 				$forms = array_merge( array_filter( $active_forms ), array_filter( $inactive_forms ) );
@@ -286,9 +286,9 @@  discard block
 block discarded – undo
286 286
 		$has_post_fields = false;
287 287
 
288 288
 		if ( $form ) {
289
-			foreach ( $form['fields'] as $field ) {
290
-				if ( $include_parent_field || empty( $field['inputs'] ) ) {
291
-					$fields["{$field['id']}"] = array(
289
+			foreach ( $form[ 'fields' ] as $field ) {
290
+				if ( $include_parent_field || empty( $field[ 'inputs' ] ) ) {
291
+					$fields[ "{$field[ 'id' ]}" ] = array(
292 292
 						'label' => \GV\Utils::get( $field, 'label' ),
293 293
 						'parent' => null,
294 294
 						'type' => \GV\Utils::get( $field, 'type' ),
@@ -297,10 +297,10 @@  discard block
 block discarded – undo
297 297
 					);
298 298
 				}
299 299
 
300
-				if ( $add_default_properties && ! empty( $field['inputs'] ) ) {
301
-					foreach ( $field['inputs'] as $input ) {
300
+				if ( $add_default_properties && ! empty( $field[ 'inputs' ] ) ) {
301
+					foreach ( $field[ 'inputs' ] as $input ) {
302 302
 
303
-						if( ! empty( $input['isHidden'] ) ) {
303
+						if ( ! empty( $input[ 'isHidden' ] ) ) {
304 304
 							continue;
305 305
 						}
306 306
 
@@ -308,10 +308,10 @@  discard block
 block discarded – undo
308 308
                          * @hack
309 309
                          * In case of email/email confirmation, the input for email has the same id as the parent field
310 310
                          */
311
-						if( 'email' === $field['type'] && false === strpos( $input['id'], '.' ) ) {
311
+						if ( 'email' === $field[ 'type' ] && false === strpos( $input[ 'id' ], '.' ) ) {
312 312
                             continue;
313 313
                         }
314
-						$fields["{$input['id']}"] = array(
314
+						$fields[ "{$input[ 'id' ]}" ] = array(
315 315
 							'label' => \GV\Utils::get( $input, 'label' ),
316 316
 							'customLabel' => \GV\Utils::get( $input, 'customLabel' ),
317 317
 							'parent' => $field,
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 				}
324 324
 
325 325
 
326
-				if( GFCommon::is_product_field( $field['type'] ) ){
326
+				if ( GFCommon::is_product_field( $field[ 'type' ] ) ) {
327 327
 					$has_product_fields = true;
328 328
 				}
329 329
 
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 		 * @since 1.7
338 338
 		 */
339 339
 		if ( $has_post_fields ) {
340
-			$fields['post_id'] = array(
340
+			$fields[ 'post_id' ] = array(
341 341
 				'label' => __( 'Post ID', 'gravityview' ),
342 342
 				'type' => 'post_id',
343 343
 			);
@@ -350,11 +350,11 @@  discard block
 block discarded – undo
350 350
 			foreach ( $payment_fields as $payment_field ) {
351 351
 
352 352
 				// Either the field exists ($fields['shipping']) or the form explicitly contains a `shipping` field with numeric key
353
-				if( isset( $fields["{$payment_field->name}"] ) || GFCommon::get_fields_by_type( $form, $payment_field->name ) ) {
353
+				if ( isset( $fields[ "{$payment_field->name}" ] ) || GFCommon::get_fields_by_type( $form, $payment_field->name ) ) {
354 354
 					continue;
355 355
 				}
356 356
 
357
-				$fields["{$payment_field->name}"] = array(
357
+				$fields[ "{$payment_field->name}" ] = array(
358 358
 					'label' => $payment_field->label,
359 359
 					'desc' => $payment_field->description,
360 360
 					'type' => $payment_field->name,
@@ -386,9 +386,9 @@  discard block
 block discarded – undo
386 386
 
387 387
 		$fields = array();
388 388
 
389
-		foreach ( $extra_fields as $key => $field ){
390
-			if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) {
391
-				$fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' );
389
+		foreach ( $extra_fields as $key => $field ) {
390
+			if ( ! empty( $only_default_column ) && ! empty( $field[ 'is_default_column' ] ) ) {
391
+				$fields[ $key ] = array( 'label' => $field[ 'label' ], 'type' => 'entry_meta' );
392 392
 			}
393 393
 		}
394 394
 
@@ -428,32 +428,32 @@  discard block
 block discarded – undo
428 428
 			'search_criteria' => null,
429 429
 			'sorting' => null,
430 430
 			'paging' => null,
431
-			'cache' => (isset( $passed_criteria['cache'] ) ? (bool) $passed_criteria['cache'] : true),
431
+			'cache' => ( isset( $passed_criteria[ 'cache' ] ) ? (bool)$passed_criteria[ 'cache' ] : true ),
432 432
 		);
433 433
 
434 434
 		$criteria = wp_parse_args( $passed_criteria, $search_criteria_defaults );
435 435
 
436
-		if ( ! empty( $criteria['search_criteria']['field_filters'] ) ) {
437
-			foreach ( $criteria['search_criteria']['field_filters'] as &$filter ) {
436
+		if ( ! empty( $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) {
437
+			foreach ( $criteria[ 'search_criteria' ][ 'field_filters' ] as &$filter ) {
438 438
 
439 439
 				if ( ! is_array( $filter ) ) {
440 440
 					continue;
441 441
 				}
442 442
 
443 443
 				// By default, we want searches to be wildcard for each field.
444
-				$filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator'];
444
+				$filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ];
445 445
 
446 446
 				/**
447 447
 				 * @filter `gravityview_search_operator` Modify the search operator for the field (contains, is, isnot, etc)
448 448
 				 * @param string $operator Existing search operator
449 449
 				 * @param array $filter array with `key`, `value`, `operator`, `type` keys
450 450
 				 */
451
-				$filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter );
451
+				$filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter );
452 452
 			}
453 453
 
454 454
 			// don't send just the [mode] without any field filter.
455
-			if( count( $criteria['search_criteria']['field_filters'] ) === 1 && array_key_exists( 'mode' , $criteria['search_criteria']['field_filters'] ) ) {
456
-				unset( $criteria['search_criteria']['field_filters']['mode'] );
455
+			if ( count( $criteria[ 'search_criteria' ][ 'field_filters' ] ) === 1 && array_key_exists( 'mode', $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) {
456
+				unset( $criteria[ 'search_criteria' ][ 'field_filters' ][ 'mode' ] );
457 457
 			}
458 458
 
459 459
 		}
@@ -464,21 +464,21 @@  discard block
 block discarded – undo
464 464
 		 * Prepare date formats to be in Gravity Forms DB format;
465 465
 		 * $passed_criteria may include date formats incompatible with Gravity Forms.
466 466
 		 */
467
-		foreach ( array('start_date', 'end_date' ) as $key ) {
467
+		foreach ( array( 'start_date', 'end_date' ) as $key ) {
468 468
 
469
-			if ( ! empty( $criteria['search_criteria'][ $key ] ) ) {
469
+			if ( ! empty( $criteria[ 'search_criteria' ][ $key ] ) ) {
470 470
 
471 471
 				// Use date_create instead of new DateTime so it returns false if invalid date format.
472
-				$date = date_create( $criteria['search_criteria'][ $key ] );
472
+				$date = date_create( $criteria[ 'search_criteria' ][ $key ] );
473 473
 
474 474
 				if ( $date ) {
475 475
 					// Gravity Forms wants dates in the `Y-m-d H:i:s` format.
476
-					$criteria['search_criteria'][ $key ] = $date->format( 'Y-m-d H:i:s' );
476
+					$criteria[ 'search_criteria' ][ $key ] = $date->format( 'Y-m-d H:i:s' );
477 477
 				} else {
478
-					gravityview()->log->error( '{key} Date format not valid:', array( 'key' => $key, $criteria['search_criteria'][ $key ] ) );
478
+					gravityview()->log->error( '{key} Date format not valid:', array( 'key' => $key, $criteria[ 'search_criteria' ][ $key ] ) );
479 479
 
480 480
 					// If it's an invalid date, unset it. Gravity Forms freaks out otherwise.
481
-					unset( $criteria['search_criteria'][ $key ] );
481
+					unset( $criteria[ 'search_criteria' ][ $key ] );
482 482
 				}
483 483
 			}
484 484
 		}
@@ -489,14 +489,14 @@  discard block
 block discarded – undo
489 489
 
490 490
 		// Calculate the context view id and send it to the advanced filter
491 491
 		if ( GravityView_frontend::getInstance()->getSingleEntry() ) {
492
-			$criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id();
492
+			$criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id();
493 493
 		} elseif ( $multiple_original ) {
494
-			$criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id();
494
+			$criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id();
495 495
 		} elseif ( 'delete' === GFForms::get( 'action' ) ) {
496
-			$criteria['context_view_id'] = isset( $_GET['view_id'] ) ? intval( $_GET['view_id'] ) : null;
497
-		} elseif( !isset( $criteria['context_view_id'] ) ) {
496
+			$criteria[ 'context_view_id' ] = isset( $_GET[ 'view_id' ] ) ? intval( $_GET[ 'view_id' ] ) : null;
497
+		} elseif ( ! isset( $criteria[ 'context_view_id' ] ) ) {
498 498
             // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget)
499
-			$criteria['context_view_id'] = null;
499
+			$criteria[ 'context_view_id' ] = null;
500 500
 		}
501 501
 
502 502
 		/**
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
 		 * @param array $form_ids Forms to search
506 506
 		 * @param int $view_id ID of the view being used to search
507 507
 		 */
508
-		$criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria['context_view_id'] );
508
+		$criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria[ 'context_view_id' ] );
509 509
 
510 510
 		return (array)$criteria;
511 511
 	}
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
 		/** Reduce # of database calls */
536 536
 		add_filter( 'gform_is_encrypted_field', '__return_false' );
537 537
 
538
-		if ( ! empty( $criteria['cache'] ) ) {
538
+		if ( ! empty( $criteria[ 'cache' ] ) ) {
539 539
 
540 540
 			$Cache = new GravityView_Cache( $form_ids, $criteria );
541 541
 
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
 
544 544
 				// Still update the total count when using cached results
545 545
 				if ( ! is_null( $total ) ) {
546
-					$total = GFAPI::count_entries( $form_ids, $criteria['search_criteria'] );
546
+					$total = GFAPI::count_entries( $form_ids, $criteria[ 'search_criteria' ] );
547 547
 				}
548 548
 
549 549
 				$return = $entries;
@@ -564,9 +564,9 @@  discard block
 block discarded – undo
564 564
 			$entries = apply_filters( 'gravityview_before_get_entries', null, $criteria, $passed_criteria, $total );
565 565
 
566 566
 			// No entries returned from gravityview_before_get_entries
567
-			if( is_null( $entries ) ) {
567
+			if ( is_null( $entries ) ) {
568 568
 
569
-				$entries = GFAPI::get_entries( $form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total );
569
+				$entries = GFAPI::get_entries( $form_ids, $criteria[ 'search_criteria' ], $criteria[ 'sorting' ], $criteria[ 'paging' ], $total );
570 570
 
571 571
 				if ( is_wp_error( $entries ) ) {
572 572
 					gravityview()->log->error( '{error}', array( 'error' => $entries->get_error_message(), 'data' => $entries ) );
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
 				}
578 578
 			}
579 579
 
580
-			if ( ! empty( $criteria['cache'] ) && isset( $Cache ) ) {
580
+			if ( ! empty( $criteria[ 'cache' ] ) && isset( $Cache ) ) {
581 581
 
582 582
 				// Cache results
583 583
 				$Cache->set( $entries, 'entries' );
@@ -682,12 +682,12 @@  discard block
 block discarded – undo
682 682
 			 */
683 683
 			$check_entry_display = apply_filters( 'gravityview/common/get_entry/check_entry_display', $check_entry_display, $entry );
684 684
 
685
-			if( $check_entry_display ) {
685
+			if ( $check_entry_display ) {
686 686
 				// Is the entry allowed
687 687
 				$entry = self::check_entry_display( $entry );
688 688
 			}
689 689
 
690
-			if( is_wp_error( $entry ) ) {
690
+			if ( is_wp_error( $entry ) ) {
691 691
 				gravityview()->log->error( '{error}', array( 'error' => $entry->get_error_message() ) );
692 692
 				return false;
693 693
 			}
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
 	 */
719 719
 	public static function matches_operation( $val1, $val2, $operation ) {
720 720
 
721
-		$json_function = function_exists('wp_json_encode') ? 'wp_json_encode' : 'json_encode';
721
+		$json_function = function_exists( 'wp_json_encode' ) ? 'wp_json_encode' : 'json_encode';
722 722
 
723 723
 		// Only process strings
724 724
 		$val1 = ! is_string( $val1 ) ? $json_function( $val1 ) : $val1;
@@ -726,12 +726,12 @@  discard block
 block discarded – undo
726 726
 
727 727
 		$value = false;
728 728
 
729
-		if( 'context' === $val1 ) {
729
+		if ( 'context' === $val1 ) {
730 730
 
731 731
 			$matching_contexts = array( $val2 );
732 732
 
733 733
 			// We allow for non-standard contexts.
734
-			switch( $val2 ) {
734
+			switch ( $val2 ) {
735 735
 				// Check for either single or edit
736 736
 				case 'singular':
737 737
 					$matching_contexts = array( 'single', 'edit' );
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
 				$json_val_1 = json_decode( $val1, true );
775 775
 				$json_val_2 = json_decode( $val2, true );
776 776
 
777
-				if( ! empty( $json_val_1 ) || ! empty( $json_val_2 ) ) {
777
+				if ( ! empty( $json_val_1 ) || ! empty( $json_val_2 ) ) {
778 778
 
779 779
 					$json_in = false;
780 780
 					$json_val_1 = $json_val_1 ? $json_val_1 : array( $val1 );
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
 						foreach ( $json_val_2 as $item_2 ) {
786 786
 							$json_in = self::matches_operation( $item_1, $item_2, 'is' );
787 787
 
788
-							if( $json_in ) {
788
+							if ( $json_in ) {
789 789
 								break 2;
790 790
 							}
791 791
 						}
@@ -833,62 +833,62 @@  discard block
 block discarded – undo
833 833
 	public static function check_entry_display( $entry ) {
834 834
 
835 835
 		if ( ! $entry || is_wp_error( $entry ) ) {
836
-			return new WP_Error('entry_not_found', 'Entry was not found.', $entry );
836
+			return new WP_Error( 'entry_not_found', 'Entry was not found.', $entry );
837 837
 		}
838 838
 
839
-		if ( empty( $entry['form_id'] ) ) {
839
+		if ( empty( $entry[ 'form_id' ] ) ) {
840 840
 			return new WP_Error( 'form_id_not_set', '[apply_filters_to_entry] Entry is empty!', $entry );
841 841
 		}
842 842
 
843 843
 		$criteria = self::calculate_get_entries_criteria();
844 844
 
845
-		if ( empty( $criteria['search_criteria'] ) || ! is_array( $criteria['search_criteria'] ) ) {
845
+		if ( empty( $criteria[ 'search_criteria' ] ) || ! is_array( $criteria[ 'search_criteria' ] ) ) {
846 846
 			gravityview()->log->debug( '[apply_filters_to_entry] Entry approved! No search criteria found:', array( 'data' => $criteria ) );
847 847
 			return $entry;
848 848
 		}
849 849
 
850 850
 		// Make sure the current View is connected to the same form as the Entry
851
-		if( ! empty( $criteria['context_view_id'] ) ) {
852
-			$context_view_id = intval( $criteria['context_view_id'] );
851
+		if ( ! empty( $criteria[ 'context_view_id' ] ) ) {
852
+			$context_view_id = intval( $criteria[ 'context_view_id' ] );
853 853
 			$context_form_id = gravityview_get_form_id( $context_view_id );
854
-			if( intval( $context_form_id ) !== intval( $entry['form_id'] ) ) {
855
-				return new WP_Error( 'view_id_not_match', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry['form_id'] ), $criteria['context_view_id'] );
854
+			if ( intval( $context_form_id ) !== intval( $entry[ 'form_id' ] ) ) {
855
+				return new WP_Error( 'view_id_not_match', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry[ 'form_id' ] ), $criteria[ 'context_view_id' ] );
856 856
 			}
857 857
 		}
858 858
 
859
-		$search_criteria = $criteria['search_criteria'];
859
+		$search_criteria = $criteria[ 'search_criteria' ];
860 860
 
861 861
 		// check entry status
862
-		if ( array_key_exists( 'status', $search_criteria ) && $search_criteria['status'] != $entry['status'] ) {
863
-			return new WP_Error( 'status_not_valid', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry['status'] ), $search_criteria );
862
+		if ( array_key_exists( 'status', $search_criteria ) && $search_criteria[ 'status' ] != $entry[ 'status' ] ) {
863
+			return new WP_Error( 'status_not_valid', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry[ 'status' ] ), $search_criteria );
864 864
 		}
865 865
 
866 866
 		// check entry date
867 867
 		// @todo: Does it make sense to apply the Date create filters to the single entry?
868 868
 
869 869
 		// field_filters
870
-		if ( empty( $search_criteria['field_filters'] ) || ! is_array( $search_criteria['field_filters'] ) ) {
870
+		if ( empty( $search_criteria[ 'field_filters' ] ) || ! is_array( $search_criteria[ 'field_filters' ] ) ) {
871 871
 			gravityview()->log->debug( '[apply_filters_to_entry] Entry approved! No field filters criteria found:', array( 'data' => $search_criteria ) );
872 872
 			return $entry;
873 873
 		}
874 874
 
875
-		$filters = $search_criteria['field_filters'];
875
+		$filters = $search_criteria[ 'field_filters' ];
876 876
 
877
-		$mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters['mode'] ) : 'all';
877
+		$mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters[ 'mode' ] ) : 'all';
878 878
 
879 879
 		// Prevent the mode from being processed below
880
-		unset( $filters['mode'] );
880
+		unset( $filters[ 'mode' ] );
881 881
 
882
-		$form = self::get_form( $entry['form_id'] );
882
+		$form = self::get_form( $entry[ 'form_id' ] );
883 883
 
884 884
 		foreach ( $filters as $filter ) {
885 885
 
886
-			if ( ! isset( $filter['key'] ) ) {
886
+			if ( ! isset( $filter[ 'key' ] ) ) {
887 887
 				gravityview()->log->debug( '[apply_filters_to_entry] Filter key not set: {filter}', array( 'filter' => $filter ) );
888 888
 				continue;
889 889
 			}
890 890
 
891
-			$k = $filter['key'];
891
+			$k = $filter[ 'key' ];
892 892
 
893 893
 			$field = self::get_field( $form, $k );
894 894
 
@@ -896,14 +896,14 @@  discard block
 block discarded – undo
896 896
 				$field_value = isset( $entry[ $k ] ) ? $entry[ $k ] : null;
897 897
 				$field = $k;
898 898
 			} else {
899
-				$field_value  = GFFormsModel::get_lead_field_value( $entry, $field );
899
+				$field_value = GFFormsModel::get_lead_field_value( $entry, $field );
900 900
 				 // If it's a complex field, then fetch the input's value, if exists at the current key. Otherwise, let GF handle it
901 901
 				$field_value = ( is_array( $field_value ) && isset( $field_value[ $k ] ) ) ? \GV\Utils::get( $field_value, $k ) : $field_value;
902 902
 			}
903 903
 
904
-			$operator = isset( $filter['operator'] ) ? strtolower( $filter['operator'] ) : 'is';
904
+			$operator = isset( $filter[ 'operator' ] ) ? strtolower( $filter[ 'operator' ] ) : 'is';
905 905
 
906
-			$is_value_match = GravityView_GFFormsModel::is_value_match( $field_value, $filter['value'], $operator, $field );
906
+			$is_value_match = GravityView_GFFormsModel::is_value_match( $field_value, $filter[ 'value' ], $operator, $field );
907 907
 
908 908
 			// Any match is all we need to know
909 909
 			if ( $is_value_match && 'any' === $mode ) {
@@ -912,7 +912,7 @@  discard block
 block discarded – undo
912 912
 
913 913
 			// Any failed match is a total fail
914 914
 			if ( ! $is_value_match && 'all' === $mode ) {
915
-				return new WP_Error('failed_criteria', '[apply_filters_to_entry] Entry cannot be displayed. Failed a criterium for ALL mode', $filter );
915
+				return new WP_Error( 'failed_criteria', '[apply_filters_to_entry] Entry cannot be displayed. Failed a criterium for ALL mode', $filter );
916 916
 			}
917 917
 		}
918 918
 
@@ -922,7 +922,7 @@  discard block
 block discarded – undo
922 922
 			gravityview()->log->debug( '[apply_filters_to_entry] Entry approved: all conditions were met' );
923 923
 			return $entry;
924 924
 		} else {
925
-			return new WP_Error('failed_any_criteria', '[apply_filters_to_entry] Entry cannot be displayed. Failed all the criteria for ANY mode', $filters );
925
+			return new WP_Error( 'failed_any_criteria', '[apply_filters_to_entry] Entry cannot be displayed. Failed all the criteria for ANY mode', $filters );
926 926
 		}
927 927
 
928 928
 	}
@@ -963,18 +963,18 @@  discard block
 block discarded – undo
963 963
 		 * Gravity Forms code to adjust date to locally-configured Time Zone
964 964
 		 * @see GFCommon::format_date() for original code
965 965
 		 */
966
-		$date_gmt_time   = mysql2date( 'G', $date_string );
966
+		$date_gmt_time = mysql2date( 'G', $date_string );
967 967
 		$date_local_timestamp = GFCommon::get_local_timestamp( $date_gmt_time );
968 968
 
969
-		$format  = \GV\Utils::get( $atts, 'format' );
970
-		$is_human  = ! empty( $atts['human'] );
971
-		$is_diff  = ! empty( $atts['diff'] );
972
-		$is_raw = ! empty( $atts['raw'] );
973
-		$is_timestamp = ! empty( $atts['timestamp'] );
974
-		$include_time = ! empty( $atts['time'] );
969
+		$format = \GV\Utils::get( $atts, 'format' );
970
+		$is_human = ! empty( $atts[ 'human' ] );
971
+		$is_diff = ! empty( $atts[ 'diff' ] );
972
+		$is_raw = ! empty( $atts[ 'raw' ] );
973
+		$is_timestamp = ! empty( $atts[ 'timestamp' ] );
974
+		$include_time = ! empty( $atts[ 'time' ] );
975 975
 
976 976
 		// If we're using time diff, we want to have a different default format
977
-		if( empty( $format ) ) {
977
+		if ( empty( $format ) ) {
978 978
 			/* translators: %s: relative time from now, used for generic date comparisons. "1 day ago", or "20 seconds ago" */
979 979
 			$format = $is_diff ? esc_html__( '%s ago', 'gravityview' ) : get_option( 'date_format' );
980 980
 		}
@@ -982,7 +982,7 @@  discard block
 block discarded – undo
982 982
 		// If raw was specified, don't modify the stored value
983 983
 		if ( $is_raw ) {
984 984
 			$formatted_date = $date_string;
985
-		} elseif( $is_timestamp ) {
985
+		} elseif ( $is_timestamp ) {
986 986
 			$formatted_date = $date_local_timestamp;
987 987
 		} elseif ( $is_diff ) {
988 988
 			$formatted_date = sprintf( $format, human_time_diff( $date_gmt_time ) );
@@ -1016,7 +1016,7 @@  discard block
 block discarded – undo
1016 1016
 
1017 1017
 		$label = \GV\Utils::get( $field, 'label' );
1018 1018
 
1019
-		if( floor( $field_id ) !== floatval( $field_id ) ) {
1019
+		if ( floor( $field_id ) !== floatval( $field_id ) ) {
1020 1020
 			$label = GFFormsModel::get_choice_text( $field, $field_value, $field_id );
1021 1021
 		}
1022 1022
 
@@ -1044,7 +1044,7 @@  discard block
 block discarded – undo
1044 1044
 			$form = GFAPI::get_form( $form );
1045 1045
 		}
1046 1046
 
1047
-		if ( class_exists( 'GFFormsModel' ) ){
1047
+		if ( class_exists( 'GFFormsModel' ) ) {
1048 1048
 			return GFFormsModel::get_field( $form, $field_id );
1049 1049
 		} else {
1050 1050
 			return null;
@@ -1091,19 +1091,19 @@  discard block
 block discarded – undo
1091 1091
 			$shortcodes = array();
1092 1092
 
1093 1093
 			preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER );
1094
-			if ( empty( $matches ) ){
1094
+			if ( empty( $matches ) ) {
1095 1095
 				return false;
1096 1096
 			}
1097 1097
 
1098 1098
 			foreach ( $matches as $shortcode ) {
1099
-				if ( $tag === $shortcode[2] ) {
1099
+				if ( $tag === $shortcode[ 2 ] ) {
1100 1100
 
1101 1101
 					// Changed this to $shortcode instead of true so we get the parsed atts.
1102
-					$shortcodes[] = $shortcode;
1102
+					$shortcodes[ ] = $shortcode;
1103 1103
 
1104
-				} else if ( isset( $shortcode[5] ) && $results = self::has_shortcode_r( $shortcode[5], $tag ) ) {
1105
-					foreach( $results as $result ) {
1106
-						$shortcodes[] = $result;
1104
+				} else if ( isset( $shortcode[ 5 ] ) && $results = self::has_shortcode_r( $shortcode[ 5 ], $tag ) ) {
1105
+					foreach ( $results as $result ) {
1106
+						$shortcodes[ ] = $result;
1107 1107
 					}
1108 1108
 				}
1109 1109
 			}
@@ -1291,7 +1291,7 @@  discard block
 block discarded – undo
1291 1291
 
1292 1292
 		$directory_widgets = wp_parse_args( $view_widgets, $defaults );
1293 1293
 
1294
-		if( $json_decode ) {
1294
+		if ( $json_decode ) {
1295 1295
 			$directory_widgets = gv_map_deep( $directory_widgets, 'gv_maybe_json_decode' );
1296 1296
 		}
1297 1297
 
@@ -1307,7 +1307,7 @@  discard block
 block discarded – undo
1307 1307
 	 * @return string         html
1308 1308
 	 */
1309 1309
 	public static function get_sortable_fields( $formid, $current = '' ) {
1310
-		$output = '<option value="" ' . selected( '', $current, false ).'>' . esc_html__( 'Default', 'gravityview' ) .'</option>';
1310
+		$output = '<option value="" ' . selected( '', $current, false ) . '>' . esc_html__( 'Default', 'gravityview' ) . '</option>';
1311 1311
 
1312 1312
 		if ( empty( $formid ) ) {
1313 1313
 			return $output;
@@ -1320,11 +1320,11 @@  discard block
 block discarded – undo
1320 1320
 			$blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', array( 'list', 'textarea' ), null );
1321 1321
 
1322 1322
 			foreach ( $fields as $id => $field ) {
1323
-				if ( in_array( $field['type'], $blacklist_field_types ) ) {
1323
+				if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
1324 1324
 					continue;
1325 1325
 				}
1326 1326
 
1327
-				$output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'>'. esc_attr( $field['label'] ) .'</option>';
1327
+				$output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . '>' . esc_attr( $field[ 'label' ] ) . '</option>';
1328 1328
 			}
1329 1329
 		}
1330 1330
 
@@ -1359,9 +1359,9 @@  discard block
 block discarded – undo
1359 1359
 		$blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL );
1360 1360
 
1361 1361
 		// TODO: Convert to using array_filter
1362
-		foreach( $fields as $id => $field ) {
1362
+		foreach ( $fields as $id => $field ) {
1363 1363
 
1364
-			if( in_array( $field['type'], $blacklist_field_types ) ) {
1364
+			if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
1365 1365
 				unset( $fields[ $id ] );
1366 1366
 			}
1367 1367
 		}
@@ -1402,14 +1402,14 @@  discard block
 block discarded – undo
1402 1402
 	 * @param  int|array  $field field key or field array
1403 1403
 	 * @return boolean
1404 1404
 	 */
1405
-	public static function is_field_numeric(  $form = null, $field = '' ) {
1405
+	public static function is_field_numeric( $form = null, $field = '' ) {
1406 1406
 
1407 1407
 		if ( ! is_array( $form ) && ! is_array( $field ) ) {
1408 1408
 			$form = self::get_form( $form );
1409 1409
 		}
1410 1410
 
1411 1411
 		// If entry meta, it's a string. Otherwise, numeric
1412
-		if( ! is_numeric( $field ) && is_string( $field ) ) {
1412
+		if ( ! is_numeric( $field ) && is_string( $field ) ) {
1413 1413
 			$type = $field;
1414 1414
 		} else {
1415 1415
 			$type = self::get_field_type( $form, $field );
@@ -1423,9 +1423,9 @@  discard block
 block discarded – undo
1423 1423
 		$numeric_types = apply_filters( 'gravityview/common/numeric_types', array( 'number', 'time' ) );
1424 1424
 
1425 1425
 		// Defer to GravityView_Field setting, if the field type is registered and `is_numeric` is true
1426
-		if( $gv_field = GravityView_Fields::get( $type ) ) {
1427
-			if( true === $gv_field->is_numeric ) {
1428
-				$numeric_types[] = $gv_field->is_numeric;
1426
+		if ( $gv_field = GravityView_Fields::get( $type ) ) {
1427
+			if ( true === $gv_field->is_numeric ) {
1428
+				$numeric_types[ ] = $gv_field->is_numeric;
1429 1429
 			}
1430 1430
 		}
1431 1431
 
@@ -1575,18 +1575,18 @@  discard block
 block discarded – undo
1575 1575
 		$final_atts = array_filter( $final_atts );
1576 1576
 
1577 1577
 		// If the href wasn't passed as an attribute, use the value passed to the function
1578
-		if ( empty( $final_atts['href'] ) && ! empty( $href ) ) {
1579
-			$final_atts['href'] = $href;
1578
+		if ( empty( $final_atts[ 'href' ] ) && ! empty( $href ) ) {
1579
+			$final_atts[ 'href' ] = $href;
1580 1580
 		}
1581 1581
 
1582
-		$final_atts['href'] = esc_url_raw( $href );
1582
+		$final_atts[ 'href' ] = esc_url_raw( $href );
1583 1583
 
1584 1584
 		/**
1585 1585
 		 * Fix potential security issue with target=_blank
1586 1586
 		 * @see https://dev.to/ben/the-targetblank-vulnerability-by-example
1587 1587
 		 */
1588
-		if( '_blank' === \GV\Utils::get( $final_atts, 'target' ) ) {
1589
-			$final_atts['rel'] = trim( \GV\Utils::get( $final_atts, 'rel', '' ) . ' noopener noreferrer' );
1588
+		if ( '_blank' === \GV\Utils::get( $final_atts, 'target' ) ) {
1589
+			$final_atts[ 'rel' ] = trim( \GV\Utils::get( $final_atts, 'rel', '' ) . ' noopener noreferrer' );
1590 1590
 		}
1591 1591
 
1592 1592
 		// Sort the attributes alphabetically, to help testing
@@ -1598,7 +1598,7 @@  discard block
 block discarded – undo
1598 1598
 			$output .= sprintf( ' %s="%s"', $attr, esc_attr( $value ) );
1599 1599
 		}
1600 1600
 
1601
-		if( '' !== $output ) {
1601
+		if ( '' !== $output ) {
1602 1602
 			$output = '<a' . $output . '>' . $anchor_text . '</a>';
1603 1603
 		}
1604 1604
 
@@ -1625,7 +1625,7 @@  discard block
 block discarded – undo
1625 1625
 			if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) {
1626 1626
 				$merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value );
1627 1627
 			} else if ( is_numeric( $key ) && isset( $merged[ $key ] ) ) {
1628
-				$merged[] = $value;
1628
+				$merged[ ] = $value;
1629 1629
 			} else {
1630 1630
 				$merged[ $key ] = $value;
1631 1631
 			}
@@ -1658,7 +1658,7 @@  discard block
 block discarded – undo
1658 1658
 		 * `$context` is where are we using this information (e.g. change_entry_creator, search_widget ..)
1659 1659
 		 * @param array $settings Settings array, with `number` key defining the # of users to display
1660 1660
 		 */
1661
-		$get_users_settings = apply_filters( 'gravityview/get_users/'. $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) );
1661
+		$get_users_settings = apply_filters( 'gravityview/get_users/' . $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) );
1662 1662
 
1663 1663
 		return get_users( $get_users_settings );
1664 1664
 	}
@@ -1678,11 +1678,11 @@  discard block
 block discarded – undo
1678 1678
     public static function generate_notice( $notice, $class = '', $cap = '', $object_id = null ) {
1679 1679
 
1680 1680
     	// If $cap is defined, only show notice if user has capability
1681
-    	if( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) {
1681
+    	if ( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) {
1682 1682
     		return '';
1683 1683
 	    }
1684 1684
 
1685
-        return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>';
1685
+        return '<div class="gv-notice ' . gravityview_sanitize_html_class( $class ) . '">' . $notice . '</div>';
1686 1686
     }
1687 1687
 
1688 1688
 	/**
Please login to merge, or discard this patch.
future/_mocks.php 2 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -10,6 +10,7 @@  discard block
 block discarded – undo
10 10
  * @internal
11 11
  * @since 2.0
12 12
  *
13
+ * @param \GravityView_View_Data $_this
13 14
  * @return array|false The old array data, or false on error.
14 15
  */
15 16
 function GravityView_View_Data_add_view( $view_id, $atts, $_this ) {
@@ -62,6 +63,8 @@  discard block
 block discarded – undo
62 63
  * @internal
63 64
  * @since 2.0
64 65
  *
66
+ * @param integer $form_id
67
+ * @param integer $count
65 68
  * @return array The old associative array data as returned by
66 69
  *  \GravityView_frontend::get_view_entries(), the paging parameters
67 70
  *  and a total count of all entries.
@@ -155,6 +158,7 @@  discard block
 block discarded – undo
155 158
  * @internal
156 159
  * @since 2.0
157 160
  *
161
+ * @param string $format
158 162
  * @return null|string The value of a field in an entry.
159 163
  */
160 164
 function GravityView_API_field_value( $entry, $field_settings, $format ) {
Please login to merge, or discard this patch.
Spacing   +49 added lines, -51 removed lines patch added patch discarded remove patch
@@ -96,18 +96,18 @@  discard block
 block discarded – undo
96 96
 		$paging = \GV\Utils::get( $parameters, 'paging' );
97 97
 	} else {
98 98
 		$entries = $form->entries
99
-			->filter( \GV\GF_Entry_Filter::from_search_criteria( $criteria['search_criteria'] ) )
100
-			->offset( $args['offset'] )
101
-			->limit( $criteria['paging']['page_size'] );
99
+			->filter( \GV\GF_Entry_Filter::from_search_criteria( $criteria[ 'search_criteria' ] ) )
100
+			->offset( $args[ 'offset' ] )
101
+			->limit( $criteria[ 'paging' ][ 'page_size' ] );
102 102
 
103
-		if ( $criteria['paging']['page_size'] ) {
104
-			$entries = $entries->page( ( ( $criteria['paging']['offset'] - $args['offset'] ) / $criteria['paging']['page_size'] ) + 1 );
103
+		if ( $criteria[ 'paging' ][ 'page_size' ] ) {
104
+			$entries = $entries->page( ( ( $criteria[ 'paging' ][ 'offset' ] - $args[ 'offset' ] ) / $criteria[ 'paging' ][ 'page_size' ] ) + 1 );
105 105
 		}
106 106
 
107
-		if ( ! empty( $criteria['sorting'] ) ) {
107
+		if ( ! empty( $criteria[ 'sorting' ] ) ) {
108 108
 			$field = new \GV\Field();
109
-			$field->ID = $criteria['sorting']['key'];
110
-			switch( strtolower( $criteria['sorting']['direction'] ) ) {
109
+			$field->ID = $criteria[ 'sorting' ][ 'key' ];
110
+			switch ( strtolower( $criteria[ 'sorting' ][ 'direction' ] ) ) {
111 111
 				case 'asc':
112 112
 					$direction = \GV\Entry_Sort::ASC;
113 113
 					break;
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 					break;
121 121
 			}
122 122
 
123
-			$mode = $criteria['sorting']['is_numeric'] ? \GV\Entry_Sort::NUMERIC : \GV\Entry_Sort::ALPHA;
123
+			$mode = $criteria[ 'sorting' ][ 'is_numeric' ] ? \GV\Entry_Sort::NUMERIC : \GV\Entry_Sort::ALPHA;
124 124
 			$entries = $entries->sort( new \GV\Entry_Sort( $field, $direction, $mode ) );
125 125
 		}
126 126
 
@@ -158,16 +158,16 @@  discard block
 block discarded – undo
158 158
  * @return null|string The value of a field in an entry.
159 159
  */
160 160
 function GravityView_API_field_value( $entry, $field_settings, $format ) {
161
-	if ( empty( $entry['form_id'] ) || empty( $field_settings['id'] ) ) {
161
+	if ( empty( $entry[ 'form_id' ] ) || empty( $field_settings[ 'id' ] ) ) {
162 162
 		gravityview()->log->error( 'No entry or field_settings[id] supplied', array( 'data' => array( func_get_args() ) ) );
163 163
 		return null;
164 164
 	}
165 165
 
166
-	if ( ! empty( $entry['_multi'] ) && ! empty( $field_settings['form_id'] ) && ! empty( $entry['_multi'][ $field_settings['form_id'] ] ) ) {
167
-		$entry = $entry['_multi'][ $field_settings['form_id'] ];
166
+	if ( ! empty( $entry[ '_multi' ] ) && ! empty( $field_settings[ 'form_id' ] ) && ! empty( $entry[ '_multi' ][ $field_settings[ 'form_id' ] ] ) ) {
167
+		$entry = $entry[ '_multi' ][ $field_settings[ 'form_id' ] ];
168 168
 	}
169 169
 
170
-	if ( empty( $entry['id'] ) || ! $entry = \GV\GF_Entry::by_id( $entry['id'] ) ) {
170
+	if ( empty( $entry[ 'id' ] ) || ! $entry = \GV\GF_Entry::by_id( $entry[ 'id' ] ) ) {
171 171
 		gravityview()->log->error( 'Invalid \GV\GF_Entry supplied', array( 'data' => $entry ) );
172 172
 		return null;
173 173
 	}
@@ -177,18 +177,18 @@  discard block
 block discarded – undo
177 177
 	 *
178 178
 	 * Fields with a numeric ID are Gravity Forms ones.
179 179
 	 */
180
-	$source = is_numeric( $field_settings['id'] ) ? \GV\Source::BACKEND_GRAVITYFORMS : \GV\Source::BACKEND_INTERNAL;;
180
+	$source = is_numeric( $field_settings[ 'id' ] ) ? \GV\Source::BACKEND_GRAVITYFORMS : \GV\Source::BACKEND_INTERNAL; ;
181 181
 
182 182
 	/** Initialize the future field. */
183 183
 	switch ( $source ):
184 184
 		/** The Gravity Forms backend. */
185 185
 		case \GV\Source::BACKEND_GRAVITYFORMS:
186
-			if ( ! $form = \GV\GF_Form::by_id( $entry['form_id'] ) ) {
186
+			if ( ! $form = \GV\GF_Form::by_id( $entry[ 'form_id' ] ) ) {
187 187
 				gravityview()->log->error( 'No form Gravity Form found for entry', array( 'data' => $entry ) );
188 188
 				return null;
189 189
 			}
190 190
 
191
-			if ( ! $field = $form::get_field( $form, $field_settings['id'] ) ) {
191
+			if ( ! $field = $form::get_field( $form, $field_settings[ 'id' ] ) ) {
192 192
 				return null;
193 193
 			}
194 194
 
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 
197 197
 		/** Our internal backend. */
198 198
 		case \GV\Source::BACKEND_INTERNAL:
199
-			if ( ! $field = \GV\Internal_Source::get_field( $field_settings['id'] ) ) {
199
+			if ( ! $field = \GV\Internal_Source::get_field( $field_settings[ 'id' ] ) ) {
200 200
 				return null;
201 201
 			}
202 202
 
@@ -230,13 +230,13 @@  discard block
 block discarded – undo
230 230
 
231 231
 	/** A bail condition. */
232 232
 	$bail = function( $label, $field_settings, $entry, $force_show_label, $form ) {
233
-		if ( ! empty( $field_settings['show_label'] ) || $force_show_label ) {
233
+		if ( ! empty( $field_settings[ 'show_label' ] ) || $force_show_label ) {
234 234
 
235
-			$label = isset( $field_settings['label'] ) ? $field_settings['label'] : '';
235
+			$label = isset( $field_settings[ 'label' ] ) ? $field_settings[ 'label' ] : '';
236 236
 
237 237
 			// Use Gravity Forms label by default, but if a custom label is defined in GV, use it.
238
-			if ( ! empty( $field_settings['custom_label'] ) ) {
239
-				$label = \GravityView_API::replace_variables( $field_settings['custom_label'], $form, $entry );
238
+			if ( ! empty( $field_settings[ 'custom_label' ] ) ) {
239
+				$label = \GravityView_API::replace_variables( $field_settings[ 'custom_label' ], $form, $entry );
240 240
 			}
241 241
 
242 242
 			/**
@@ -262,19 +262,19 @@  discard block
 block discarded – undo
262 262
 
263 263
 	$label = '';
264 264
 
265
-	if ( ! empty( $entry['_multi'] ) && ! empty( $field_settings['form_id'] ) && ! empty( $entry['_multi'][ $field_settings['form_id'] ] ) ) {
266
-		$entry = $entry['_multi'][ $field_settings['form_id'] ];
267
-		if ( $_form = \GV\GF_Form::by_id( $field_settings['form_id'] ) ) {
265
+	if ( ! empty( $entry[ '_multi' ] ) && ! empty( $field_settings[ 'form_id' ] ) && ! empty( $entry[ '_multi' ][ $field_settings[ 'form_id' ] ] ) ) {
266
+		$entry = $entry[ '_multi' ][ $field_settings[ 'form_id' ] ];
267
+		if ( $_form = \GV\GF_Form::by_id( $field_settings[ 'form_id' ] ) ) {
268 268
 			$form = $_form->form;
269 269
 		}
270 270
 	}
271 271
 
272
-	if ( empty( $entry['form_id'] ) || empty( $field_settings['id'] ) ) {
272
+	if ( empty( $entry[ 'form_id' ] ) || empty( $field_settings[ 'id' ] ) ) {
273 273
 		gravityview()->log->error( 'No entry or field_settings[id] supplied', array( 'data' => array( func_get_args() ) ) );
274 274
 		return $bail( $label, $field_settings, $entry, $force_show_label, $form );
275 275
 	}
276 276
 
277
-	if ( empty( $entry['id'] ) || ! $gv_entry = \GV\GF_Entry::by_id( $entry['id'] ) ) {
277
+	if ( empty( $entry[ 'id' ] ) || ! $gv_entry = \GV\GF_Entry::by_id( $entry[ 'id' ] ) ) {
278 278
 		gravityview()->log->error( 'Invalid \GV\GF_Entry supplied', array( 'data' => $entry ) );
279 279
 		return $bail( $label, $field_settings, $entry, $force_show_label, $form );
280 280
 	}
@@ -286,31 +286,31 @@  discard block
 block discarded – undo
286 286
 	 *
287 287
 	 * Fields with a numeric ID are Gravity Forms ones.
288 288
 	 */
289
-	$source = is_numeric( $field_settings['id'] ) ? \GV\Source::BACKEND_GRAVITYFORMS : \GV\Source::BACKEND_INTERNAL;
289
+	$source = is_numeric( $field_settings[ 'id' ] ) ? \GV\Source::BACKEND_GRAVITYFORMS : \GV\Source::BACKEND_INTERNAL;
290 290
 
291 291
 	/** Initialize the future field. */
292 292
 	switch ( $source ):
293 293
 		/** The Gravity Forms backend. */
294 294
 		case \GV\Source::BACKEND_GRAVITYFORMS:
295
-			if ( ! $gf_form = \GV\GF_Form::by_id( $entry['form_id'] ) ) {
295
+			if ( ! $gf_form = \GV\GF_Form::by_id( $entry[ 'form_id' ] ) ) {
296 296
 				gravityview()->log->error( 'No form Gravity Form found for entry', array( 'data' => $entry ) );
297 297
 				return $bail( $label, $field_settings, $entry->as_entry(), $force_show_label, $form );
298 298
 			}
299 299
 
300
-			if ( ! $field = $gf_form::get_field( $gf_form, $field_settings['id'] ) ) {
301
-				gravityview()->log->error( 'No field found for specified form and field ID #{field_id}', array( 'field_id' => $field_settings['id'], 'data' => $form ) );
300
+			if ( ! $field = $gf_form::get_field( $gf_form, $field_settings[ 'id' ] ) ) {
301
+				gravityview()->log->error( 'No field found for specified form and field ID #{field_id}', array( 'field_id' => $field_settings[ 'id' ], 'data' => $form ) );
302 302
 				return $bail( $label, $field_settings, $entry->as_entry(), $force_show_label, $gf_form->form );
303 303
 			}
304
-			if ( empty( $field_settings['show_label'] ) ) {
304
+			if ( empty( $field_settings[ 'show_label' ] ) ) {
305 305
 				/** The label never wins... */
306
-				$field_settings['label'] = '';
306
+				$field_settings[ 'label' ] = '';
307 307
 			}
308 308
 
309 309
 			break;
310 310
 
311 311
 		/** Our internal backend. */
312 312
 		case \GV\Source::BACKEND_INTERNAL:
313
-			if ( ! $field = \GV\Internal_Source::get_field( $field_settings['id'] ) ) {
313
+			if ( ! $field = \GV\Internal_Source::get_field( $field_settings[ 'id' ] ) ) {
314 314
 				return $bail( $label, $field_settings, $entry->as_entry(), $force_show_label, $form );
315 315
 			}
316 316
 			break;
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 			'\GravityView_frontend::entry' => \GravityView_frontend::getInstance()->getEntry(),
454 454
 			'\GravityView_View::_current_entry' => \GravityView_View::getInstance()->getCurrentEntry(),
455 455
 			'\GravityView_View::fields' => \GravityView_View::getInstance()->getFields(),
456
-			'wp_actions[loop_start]' => empty( $wp_actions['loop_start'] ) ? 0 : $wp_actions['loop_start'],
456
+			'wp_actions[loop_start]' => empty( $wp_actions[ 'loop_start' ] ) ? 0 : $wp_actions[ 'loop_start' ],
457 457
 			'wp_query::in_the_loop' => $wp_query->in_the_loop,
458 458
 		);
459 459
 	}
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
 					break;
536 536
 				case 'wp_actions[loop_start]':
537 537
 					global $wp_actions;
538
-					$wp_actions['loop_start'] = $value;
538
+					$wp_actions[ 'loop_start' ] = $value;
539 539
 					break;
540 540
 				case 'wp_query::in_the_loop':
541 541
 					global $wp_query;
@@ -613,9 +613,7 @@  discard block
 block discarded – undo
613 613
 				case 'request':
614 614
 					self::thaw( array(
615 615
 						'\GravityView_View::context' => (
616
-							$value->is_entry() ? 'single' :
617
-								( $value->is_edit_entry() ? 'edit' :
618
-									( $value->is_view() ? 'directory': null )
616
+							$value->is_entry() ? 'single' : ( $value->is_edit_entry() ? 'edit' : ( $value->is_view() ? 'directory' : null )
619 617
 								)
620 618
 						),
621 619
 						'\GravityView_frontend::is_search' => $value->is_search(),
@@ -669,14 +667,14 @@  discard block
 block discarded – undo
669 667
 		global $wp_query, $wp_actions;
670 668
 
671 669
 		$wp_query->in_the_loop = false;
672
-		$wp_actions['loop_start'] = 0;
670
+		$wp_actions[ 'loop_start' ] = 0;
673 671
 	}
674 672
 }
675 673
 
676 674
 
677 675
 /** Add some global fix for field capability discrepancies. */
678 676
 add_filter( 'gravityview/configuration/fields', function( $fields ) {
679
-	if ( empty( $fields  ) ) {
677
+	if ( empty( $fields ) ) {
680 678
 		return $fields;
681 679
 	}
682 680
 
@@ -703,11 +701,11 @@  discard block
 block discarded – undo
703 701
 		}
704 702
 
705 703
 		foreach ( $_fields as $uid => &$_field ) {
706
-			if ( ! isset( $_field['only_loggedin'] ) ) {
704
+			if ( ! isset( $_field[ 'only_loggedin' ] ) ) {
707 705
 				continue;
708 706
 			}
709 707
 			/** If we do not require login, we don't require a cap. */
710
-			$_field['only_loggedin'] != '1' && ( $_field['only_loggedin_cap'] = '' );
708
+			$_field[ 'only_loggedin' ] != '1' && ( $_field[ 'only_loggedin_cap' ] = '' );
711 709
 		}
712 710
 	}
713 711
 	return $fields;
@@ -738,8 +736,8 @@  discard block
 block discarded – undo
738 736
 		}
739 737
 
740 738
 		foreach ( $_fields as $uid => &$_field ) {
741
-			if ( ! empty( $_field['id'] ) && is_numeric( $_field['id'] ) && empty( $_field['form_id'] ) ) {
742
-				$_field['form_id'] = $view->form->ID;
739
+			if ( ! empty( $_field[ 'id' ] ) && is_numeric( $_field[ 'id' ] ) && empty( $_field[ 'form_id' ] ) ) {
740
+				$_field[ 'form_id' ] = $view->form->ID;
743 741
 			}
744 742
 		}
745 743
 	}
@@ -753,25 +751,25 @@  discard block
 block discarded – undo
753 751
 	if ( class_exists( '\GravityView_frontend' ) ) {
754 752
 		global $wp_filter;
755 753
 
756
-		if ( empty( $wp_filter['gravityview_after'] ) ) {
754
+		if ( empty( $wp_filter[ 'gravityview_after' ] ) ) {
757 755
 			return;
758 756
 		}
759 757
 
760 758
 		/** WordPress 4.6 and lower compatibility, when WP_Hook classes were still absent. */
761
-		if ( is_array( $wp_filter['gravityview_after'] ) ) {
762
-			if ( ! empty( $wp_filter['gravityview_after'][10] ) ) {
763
-				foreach ( $wp_filter['gravityview_after'][10] as $function_key => $callback ) {
759
+		if ( is_array( $wp_filter[ 'gravityview_after' ] ) ) {
760
+			if ( ! empty( $wp_filter[ 'gravityview_after' ][ 10 ] ) ) {
761
+				foreach ( $wp_filter[ 'gravityview_after' ][ 10 ] as $function_key => $callback ) {
764 762
 					if ( strpos( $function_key, 'context_not_configured_warning' ) ) {
765
-						unset( $wp_filter['gravityview_after'][10][ $function_key ] );
763
+						unset( $wp_filter[ 'gravityview_after' ][ 10 ][ $function_key ] );
766 764
 					}
767 765
 				}
768 766
 			}
769 767
 			return;
770 768
 		}
771 769
 
772
-		foreach ( $wp_filter['gravityview_after']->callbacks[10] as $function_key => $callback ) {
770
+		foreach ( $wp_filter[ 'gravityview_after' ]->callbacks[ 10 ] as $function_key => $callback ) {
773 771
 			if ( strpos( $function_key, 'context_not_configured_warning' ) ) {
774
-				unset( $wp_filter['gravityview_after']->callbacks[10][ $function_key ] );
772
+				unset( $wp_filter[ 'gravityview_after' ]->callbacks[ 10 ][ $function_key ] );
775 773
 			}
776 774
 		}
777 775
 	}
Please login to merge, or discard this patch.
future/includes/class-gv-entry-gravityforms.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@
 block discarded – undo
102 102
 	 *
103 103
 	 * @param array $entry The array ID.
104 104
 	 *
105
-	 * @return \GV\Entry|null An instance of this entry or null if not found.
105
+	 * @return null|GF_Entry An instance of this entry or null if not found.
106 106
 	 */
107 107
 	public static function from_entry( $entry ) {
108 108
 		if ( empty( $entry['id'] ) ) {
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -105,14 +105,14 @@  discard block
 block discarded – undo
105 105
 	 * @return \GV\Entry|null An instance of this entry or null if not found.
106 106
 	 */
107 107
 	public static function from_entry( $entry ) {
108
-		if ( empty( $entry['id'] ) ) {
108
+		if ( empty( $entry[ 'id' ] ) ) {
109 109
 			return null;
110 110
 		}
111 111
 
112 112
 		$self = new self();
113 113
 		$self->entry = $entry;
114 114
 
115
-		$self->ID = $self->entry['id'];
115
+		$self->ID = $self->entry[ 'id' ];
116 116
 		$self->slug = \GravityView_API::get_entry_slug( $self->ID, $self->as_entry() );
117 117
 
118 118
 		return $self;
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	 * @return bool Whether the offset exists or not.
128 128
 	 */
129 129
 	public function offsetExists( $offset ) {
130
-		return isset( $this->entry[$offset] );
130
+		return isset( $this->entry[ $offset ] );
131 131
 	}
132 132
 
133 133
 	/**
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	 * @return mixed The value of the requested entry data.
143 143
 	 */
144 144
 	public function offsetGet( $offset ) {
145
-		return $this->entry[$offset];
145
+		return $this->entry[ $offset ];
146 146
 	}
147 147
 
148 148
 	/**
Please login to merge, or discard this patch.
future/includes/class-gv-extension.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 	 * - Checks PHP version numbers
208 208
 	 * - Sets self::$is_compatible[__CLASS__] to boolean value
209 209
 	 *
210
-	 * @return boolean Is the extension supported?
210
+	 * @return boolean|null Is the extension supported?
211 211
 	 */
212 212
 	protected function is_extension_supported() {
213 213
 
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 	/**
330 330
 	 * Add a notice to be displayed in the admin.
331 331
 	 *
332
-	 * @param array $notice Array with `class` and `message` keys. The message is not escaped.
332
+	 * @param string $notice Array with `class` and `message` keys. The message is not escaped.
333 333
 	 *
334 334
 	 * @return void
335 335
 	 */
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -180,13 +180,13 @@  discard block
 block discarded – undo
180 180
 		$tab = wp_parse_args( $tab_settings, $tab_defaults );
181 181
 
182 182
 		// Force the screen to be GravityView
183
-		$tab['screen'] = 'gravityview';
183
+		$tab[ 'screen' ] = 'gravityview';
184 184
 
185 185
 		if ( class_exists( 'GravityView_Metabox_Tab' ) ) {
186
-			$metabox = new \GravityView_Metabox_Tab( $tab['id'], $tab['title'], $tab['file'], $tab['icon-class'], $tab['callback'], $tab['callback_args'] );
186
+			$metabox = new \GravityView_Metabox_Tab( $tab[ 'id' ], $tab[ 'title' ], $tab[ 'file' ], $tab[ 'icon-class' ], $tab[ 'callback' ], $tab[ 'callback_args' ] );
187 187
 			\GravityView_Metabox_Tabs::add( $metabox );
188 188
 		} else {
189
-			add_meta_box( 'gravityview_' . $tab['id'], $tab['title'], $tab['callback'], $tab['screen'], $tab['context'], $tab['priority'] );
189
+			add_meta_box( 'gravityview_' . $tab[ 'id' ], $tab[ 'title' ], $tab[ 'callback' ], $tab[ 'screen' ], $tab[ 'context' ], $tab[ 'priority' ] );
190 190
 		}
191 191
 	}
192 192
 
@@ -211,14 +211,14 @@  discard block
 block discarded – undo
211 211
 	 */
212 212
 	protected function is_extension_supported() {
213 213
 
214
-		self::$is_compatible = is_array( self::$is_compatible ) ? self::$is_compatible : array( get_called_class() => (bool) self::$is_compatible );
214
+		self::$is_compatible = is_array( self::$is_compatible ) ? self::$is_compatible : array( get_called_class() => (bool)self::$is_compatible );
215 215
 
216 216
 		if ( ! function_exists( 'gravityview' ) ) {
217 217
 			$message = sprintf( __( 'Could not activate the %s Extension; GravityView is not active.', 'gravityview' ), esc_html( $this->_title ) );
218
-		} else if ( false === version_compare( Plugin::$version, $this->_min_gravityview_version , ">=" ) ) {
219
-			$message = sprintf( __( 'The %s Extension requires GravityView Version %s or newer.', 'gravityview' ), esc_html( $this->_title ), '<tt>'.$this->_min_gravityview_version.'</tt>' );
220
-		} else if ( isset( $this->_min_php_version ) && false === version_compare( phpversion(), $this->_min_php_version , ">=" ) ) {
221
-			$message = sprintf( __( 'The %s Extension requires PHP Version %s or newer. Please ask your host to upgrade your server\'s PHP.', 'gravityview' ), esc_html( $this->_title ), '<tt>'.$this->_min_php_version.'</tt>' );
218
+		} else if ( false === version_compare( Plugin::$version, $this->_min_gravityview_version, ">=" ) ) {
219
+			$message = sprintf( __( 'The %s Extension requires GravityView Version %s or newer.', 'gravityview' ), esc_html( $this->_title ), '<tt>' . $this->_min_gravityview_version . '</tt>' );
220
+		} else if ( isset( $this->_min_php_version ) && false === version_compare( phpversion(), $this->_min_php_version, ">=" ) ) {
221
+			$message = sprintf( __( 'The %s Extension requires PHP Version %s or newer. Please ask your host to upgrade your server\'s PHP.', 'gravityview' ), esc_html( $this->_title ), '<tt>' . $this->_min_php_version . '</tt>' );
222 222
 		} else if ( ! empty( $this->_max_gravityview_version ) && false === version_compare( $this->_max_gravityview_version, Plugin::$version, ">" ) ) {
223 223
 			$message = sprintf( __( 'The %s Extension is not compatible with this version of GravityView. Please update the Extension to the latest version.', 'gravityview' ), esc_html( $this->_title ) );
224 224
 		} else {
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 		$lang_dir = dirname( plugin_basename( $path ) ) . '/languages/';
258 258
 
259 259
 		// Traditional WordPress plugin locale filter
260
-		$locale = apply_filters( 'plugin_locale',  get_locale(), $this->_text_domain );
260
+		$locale = apply_filters( 'plugin_locale', get_locale(), $this->_text_domain );
261 261
 
262 262
 		$mofile = sprintf( '%1$s-%2$s.mo', $this->_text_domain, $locale );
263 263
 
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 	 */
285 285
 	public function settings() {
286 286
 		// If doing ajax, get outta here
287
-		if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) )  {
287
+		if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
288 288
 			return;
289 289
 		}
290 290
 
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 		}
296 296
 
297 297
 		// Don't update if invalid license.
298
-		if ( false === $license || empty( $license['status'] ) || strtolower( $license['status'] ) !== 'valid' ) {
298
+		if ( false === $license || empty( $license[ 'status' ] ) || strtolower( $license[ 'status' ] ) !== 'valid' ) {
299 299
 			return;
300 300
 		}
301 301
 
@@ -304,9 +304,9 @@  discard block
 block discarded – undo
304 304
 			$this->_path,
305 305
 			array(
306 306
             	'version'	=> $this->_version, // current version number
307
-            	'license'	=> $license['license'],
307
+            	'license'	=> $license[ 'license' ],
308 308
 	            'item_id'   => $this->_item_id, // The ID of the download on _remote_update_url
309
-            	'item_name' => $this->_title,  // name of this plugin
309
+            	'item_name' => $this->_title, // name of this plugin
310 310
             	'author' 	=> strip_tags( $this->_author )  // author of this plugin
311 311
           	)
312 312
         );
@@ -335,16 +335,16 @@  discard block
 block discarded – undo
335 335
 	 */
336 336
 	public static function add_notice( $notice = array() ) {
337 337
 
338
-		if ( is_array( $notice ) && empty( $notice['message'] ) ) {
338
+		if ( is_array( $notice ) && empty( $notice[ 'message' ] ) ) {
339 339
 			gravityview()->log->error( 'Notice not set', array( 'data' => $notice ) );
340 340
 			return;
341 341
 		} else if ( is_string( $notice ) ) {
342 342
 			$notice = array( 'message' => $notice );
343 343
 		}
344 344
 
345
-		$notice['class'] = empty( $notice['class'] ) ? 'error' : $notice['class'];
345
+		$notice[ 'class' ] = empty( $notice[ 'class' ] ) ? 'error' : $notice[ 'class' ];
346 346
 
347
-		self::$admin_notices []= $notice;
347
+		self::$admin_notices [ ] = $notice;
348 348
 	}
349 349
 
350 350
 	/**
@@ -358,8 +358,8 @@  discard block
 block discarded – undo
358 358
 		}
359 359
 
360 360
 		foreach ( self::$admin_notices as $key => $notice ) {
361
-			echo '<div id="message" class="'. esc_attr( $notice['class'] ).'">';
362
-			echo wpautop( $notice['message'] );
361
+			echo '<div id="message" class="' . esc_attr( $notice[ 'class' ] ) . '">';
362
+			echo wpautop( $notice[ 'message' ] );
363 363
 			echo '<div class="clear"></div>';
364 364
 			echo '</div>';
365 365
 		}
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -284,7 +284,7 @@
 block discarded – undo
284 284
 	 */
285 285
 	public function settings() {
286 286
 		// If doing ajax, get outta here
287
-		if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) )  {
287
+		if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
288 288
 			return;
289 289
 		}
290 290
 
Please login to merge, or discard this patch.
future/includes/class-gv-field-gravityforms.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@
 block discarded – undo
54 54
 	 * @param \GV\GF_Form $form The Gravity Form form.
55 55
 	 * @param int $field_id The Gravity Form field ID for the $form.
56 56
 	 *
57
-	 * @return \GV\Field|null The requested field or null if not found.
57
+	 * @return null|GF_Field The requested field or null if not found.
58 58
 	 */
59 59
 	public static function by_id( $form, $field_id ) {
60 60
 
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,17 +27,17 @@  discard block
 block discarded – undo
27 27
 	 * @return \GV\GF_Field|null The field implementation or null on error.
28 28
 	 */
29 29
 	public static function from_configuration( $configuration ) {
30
-		if ( empty( $configuration['id'] ) || ! is_numeric( $configuration['id'] ) ) {
30
+		if ( empty( $configuration[ 'id' ] ) || ! is_numeric( $configuration[ 'id' ] ) ) {
31 31
 			gravityview()->log->error( 'Invalid configuration[id] supplied.' );
32 32
 			return null;
33 33
 		}
34 34
 
35
-		if ( empty( $configuration['form_id'] ) || ! $form = \GV\GF_Form::by_id( $configuration['form_id'] )  ) {
35
+		if ( empty( $configuration[ 'form_id' ] ) || ! $form = \GV\GF_Form::by_id( $configuration[ 'form_id' ] ) ) {
36 36
 			gravityview()->log->error( 'Invalid configuration[form_id] supplied.' );
37 37
 			return null;
38 38
 		}
39 39
 
40
-		$field = self::by_id( $form, $configuration['id'] );
40
+		$field = self::by_id( $form, $configuration[ 'id' ] );
41 41
 
42 42
 		if ( ! $field ) {
43 43
 			gravityview()->log->error( 'Invalid configuration[id] supplied.' );
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 
112 112
 		/** This is a complex Gravity Forms input. */
113 113
 		if ( $input = \GFFormsModel::get_input( $this->field, $this->ID ) ) {
114
-			$label = ! empty( $input['customLabel'] ) ? $input['customLabel'] : $input['label'];
114
+			$label = ! empty( $input[ 'customLabel' ] ) ? $input[ 'customLabel' ] : $input[ 'label' ];
115 115
 		} else {
116 116
 			/** This is a field with one label. */
117 117
 			$label = $this->field->get_field_label( true, $this->label );
Please login to merge, or discard this patch.
future/includes/class-gv-form-gravityforms.php 2 patches
Doc Comments   +1 added lines, -3 removed lines patch added patch discarded remove patch
@@ -132,10 +132,8 @@
 block discarded – undo
132 132
 	/**
133 133
 	 * Get a \GV\Field by Form and Field ID for this data source.
134 134
 	 *
135
-	 * @param \GV\GF_Form $form The Gravity Form form ID.
136
-	 * @param int $field_id The Gravity Form field ID for the $form_id.
137 135
 	 *
138
-	 * @return \GV\Field|null The requested field or null if not found.
136
+	 * @return null|GF_Field The requested field or null if not found.
139 137
 	 */
140 138
 	public static function get_field( /** varargs */ ) {
141 139
 		$args = func_get_args();
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 		$self = new self();
56 56
 		$self->form = $form;
57 57
 
58
-		$self->ID = $self->form['id'];
58
+		$self->ID = $self->form[ 'id' ];
59 59
 
60 60
 		return $self;
61 61
 	}
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
 
99 99
 			/** The offset and limit */
100 100
 			if ( ! empty( $offset->limit ) ) {
101
-				$paging['page_size'] = $offset->limit;
101
+				$paging[ 'page_size' ] = $offset->limit;
102 102
 			}
103 103
 
104 104
 			if ( ! empty( $offset->offset ) ) {
105
-				$paging['offset'] = $offset->offset;
105
+				$paging[ 'offset' ] = $offset->offset;
106 106
 			}
107 107
 
108 108
 			foreach ( \GFAPI::get_entries( $form->ID, $search_criteria, $sorting, $paging ) as $entry ) {
@@ -159,8 +159,8 @@  discard block
 block discarded – undo
159 159
 	 */
160 160
 	public function get_fields() {
161 161
 		$fields = array();
162
-		foreach ( $this['fields'] as $field ) {
163
-			foreach ( empty( $field['inputs'] ) ? array( $field['id'] ) : wp_list_pluck( $field['inputs'], 'id' ) as $id ) {
162
+		foreach ( $this[ 'fields' ] as $field ) {
163
+			foreach ( empty( $field[ 'inputs' ] ) ? array( $field[ 'id' ] ) : wp_list_pluck( $field[ 'inputs' ], 'id' ) as $id ) {
164 164
 				if ( is_numeric( $id ) ) {
165 165
 					$fields[ $id ] = self::get_field( $this, $id );
166 166
 				} else {
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	 * @return bool Whether the offset exists or not.
198 198
 	 */
199 199
 	public function offsetExists( $offset ) {
200
-		return isset( $this->form[$offset] );
200
+		return isset( $this->form[ $offset ] );
201 201
 	}
202 202
 
203 203
 	/**
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 	 * @return mixed The value of the requested form data.
213 213
 	 */
214 214
 	public function offsetGet( $offset ) {
215
-		return $this->form[$offset];
215
+		return $this->form[ $offset ];
216 216
 	}
217 217
 
218 218
 	/**
Please login to merge, or discard this patch.
future/includes/class-gv-license-handler.php 4 patches
Doc Comments   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 	 * Generate the status message box HTML based on the current status
351 351
 	 *
352 352
 	 * @since 1.7.4
353
-	 * @param $message
353
+	 * @param string $message
354 354
 	 * @param string $class
355 355
 	 *
356 356
 	 * @return string
@@ -470,6 +470,9 @@  discard block
 block discarded – undo
470 470
 		$this->settings->update( $settings );
471 471
 	}
472 472
 
473
+	/**
474
+	 * @param boolean $echo
475
+	 */
473 476
 	public function settings_edd_license_activation( $field, $echo ) {
474 477
 		$script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
475 478
 
@@ -569,7 +572,6 @@  discard block
 block discarded – undo
569 572
 	 * Check the GravityView license information
570 573
 	 *
571 574
 	 * @since 1.19.3
572
-	 * @param bool $force Whether to force checking license, even if AJAX
573 575
 	 *
574 576
 	 * @return void
575 577
 	 */
Please login to merge, or discard this patch.
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 			'author'    => self::author,
97 97
 			'language'  => get_locale(),
98 98
 			'url'       => home_url(),
99
-		    'beta'      => $this->settings->get( 'beta' ),
99
+			'beta'      => $this->settings->get( 'beta' ),
100 100
 		);
101 101
 
102 102
 		if ( ! empty( $action ) ) {
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
 	private function license_call_update_settings( $license_data, $data ) {
464 464
 		$settings = array();
465 465
 
466
-        $settings['license_key'] = $license_data->license_key = trim( $data['license'] );
466
+		$settings['license_key'] = $license_data->license_key = trim( $data['license'] );
467 467
 		$settings['license_key_status'] = $license_data->license;
468 468
 		$settings['license_key_response'] = (array)$license_data;
469 469
 
@@ -597,14 +597,14 @@  discard block
 block discarded – undo
597 597
 			// Call the custom API.
598 598
 			$response = wp_remote_post( self::url, array(
599 599
 				'timeout'   => 15,
600
-			    'sslverify' => false,
601
-			    'body'      =>  array(
602
-				    'edd_action' => 'check_license',
603
-				    'license'    => trim( $this->settings->get( 'license_key' ) ),
604
-				    'item_name'  => self::name,
605
-				    'url'        => home_url(),
606
-				    'site_data'  => $this->get_site_data(),
607
-			    ),
600
+				'sslverify' => false,
601
+				'body'      =>  array(
602
+					'edd_action' => 'check_license',
603
+					'license'    => trim( $this->settings->get( 'license_key' ) ),
604
+					'item_name'  => self::name,
605
+					'url'        => home_url(),
606
+					'site_data'  => $this->get_site_data(),
607
+				),
608 608
 			));
609 609
 
610 610
 			// make sure the response came back okay
Please login to merge, or discard this patch.
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 		);
101 101
 
102 102
 		if ( ! empty( $action ) ) {
103
-			$settings['edd_action'] = esc_attr( $action );
103
+			$settings[ 'edd_action' ] = esc_attr( $action );
104 104
 		}
105 105
 
106 106
 		return array_map( 'urlencode', $settings );
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 			'format' => 'json',
157 157
 		) );
158 158
 
159
-		if ( $is_ajax && empty( $data['license'] ) ) {
159
+		if ( $is_ajax && empty( $data[ 'license' ] ) ) {
160 160
 			die( -1 );
161 161
 		}
162 162
 
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 			// most likely a mistake.
198 198
 			} else if ( $license_data->license !== 'failed' && $update_license ) {
199 199
 
200
-				if ( ! empty( $data['field_id'] ) ) {
200
+				if ( ! empty( $data[ 'field_id' ] ) ) {
201 201
 					set_transient( self::status_transient_key, $license_data, DAY_IN_SECONDS );
202 202
 				}
203 203
 
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 		if ( empty( $license_data ) ) {
225 225
 			$message = '';
226 226
 		} else {
227
-			if( ! empty( $license_data->error ) ) {
227
+			if ( ! empty( $license_data->error ) ) {
228 228
 				$class = 'error';
229 229
 				$string_key = $license_data->error;
230 230
 			} else { $class = $license_data->license;
@@ -250,17 +250,17 @@  discard block
 block discarded – undo
250 250
 	 */
251 251
 	public function license_details( $response = array() ) {
252 252
 
253
-		$response = (array) $response;
253
+		$response = (array)$response;
254 254
 
255 255
 		$return = '';
256 256
 		$wrapper = '<span class="gv-license-details" aria-live="polite" aria-busy="false">%s</span>';
257 257
 
258
-		if ( ! empty( $response['license_key'] ) ) {
258
+		if ( ! empty( $response[ 'license_key' ] ) ) {
259 259
 			$return .= '<h3>' . esc_html__( 'License Details:', 'gravityview' ) . '</h3>';
260 260
 
261 261
 			if ( in_array( Utils::get( $response, 'license' ), array( 'invalid', 'deactivated' ) ) ) {
262
-				$return .= $this->strings( $response['license'], $response );
263
-			} elseif ( ! empty( $response['license_name'] ) ) {
262
+				$return .= $this->strings( $response[ 'license' ], $response );
263
+			} elseif ( ! empty( $response[ 'license_name' ] ) ) {
264 264
 				$response_keys = array(
265 265
 					'license_name'   => '',
266 266
 					'license_limit'  => '',
@@ -274,19 +274,19 @@  discard block
 block discarded – undo
274 274
 				// Make sure all the keys are set
275 275
 				$response = wp_parse_args( $response, $response_keys );
276 276
 
277
-				$login_link = sprintf( '<a href="%s" class="howto" rel="external">%s</a>', esc_url( sprintf( 'https://gravityview.co/wp-login.php?username=%s', $response['customer_email'] ) ), esc_html__( 'Access your GravityView account', 'gravityview' ) );
278
-				$local_text = ( ! empty( $response['is_local'] ) ? '<span class="howto">' . __( 'This development site does not count toward license activation limits', 'gravityview' ) . '</span>' : '' );
277
+				$login_link = sprintf( '<a href="%s" class="howto" rel="external">%s</a>', esc_url( sprintf( 'https://gravityview.co/wp-login.php?username=%s', $response[ 'customer_email' ] ) ), esc_html__( 'Access your GravityView account', 'gravityview' ) );
278
+				$local_text = ( ! empty( $response[ 'is_local' ] ) ? '<span class="howto">' . __( 'This development site does not count toward license activation limits', 'gravityview' ) . '</span>' : '' );
279 279
 				$details    = array(
280
-					'license'     => sprintf( esc_html__( 'License level: %s', 'gravityview' ), esc_html( $response['license_name'] ), esc_html( $response['license_limit'] ) ),
281
-					'licensed_to' => sprintf( esc_html_x( 'Licensed to: %1$s (%2$s)', '1: Customer name; 2: Customer email', 'gravityview' ), esc_html__( $response['customer_name'], 'gravityview' ), esc_html__( $response['customer_email'], 'gravityview' ) ) . $login_link,
282
-					'activations' => sprintf( esc_html__( 'Activations: %d of %s sites', 'gravityview' ), intval( $response['site_count'] ), esc_html( $response['license_limit'] ) ) . $local_text,
283
-					'expires'     => 'lifetime' === $response['expires'] ? '' : sprintf( esc_html__( 'Renew on: %s', 'gravityview' ), date_i18n( get_option( 'date_format' ), strtotime( $response['expires'] ) - DAY_IN_SECONDS ) ),
284
-					'upgrade'     => $this->get_upgrade_html( $response['upgrades'] ),
280
+					'license'     => sprintf( esc_html__( 'License level: %s', 'gravityview' ), esc_html( $response[ 'license_name' ] ), esc_html( $response[ 'license_limit' ] ) ),
281
+					'licensed_to' => sprintf( esc_html_x( 'Licensed to: %1$s (%2$s)', '1: Customer name; 2: Customer email', 'gravityview' ), esc_html__( $response[ 'customer_name' ], 'gravityview' ), esc_html__( $response[ 'customer_email' ], 'gravityview' ) ) . $login_link,
282
+					'activations' => sprintf( esc_html__( 'Activations: %d of %s sites', 'gravityview' ), intval( $response[ 'site_count' ] ), esc_html( $response[ 'license_limit' ] ) ) . $local_text,
283
+					'expires'     => 'lifetime' === $response[ 'expires' ] ? '' : sprintf( esc_html__( 'Renew on: %s', 'gravityview' ), date_i18n( get_option( 'date_format' ), strtotime( $response[ 'expires' ] ) - DAY_IN_SECONDS ) ),
284
+					'upgrade'     => $this->get_upgrade_html( $response[ 'upgrades' ] ),
285 285
 				);
286 286
 
287
-				if ( ! empty( $response['error'] ) && 'expired' === $response['error'] ) {
288
-					unset( $details['upgrade'] );
289
-					$details['expires'] = '<div class="error inline"><p>' . $this->strings( 'expired', $response ) . '</p></div>';
287
+				if ( ! empty( $response[ 'error' ] ) && 'expired' === $response[ 'error' ] ) {
288
+					unset( $details[ 'upgrade' ] );
289
+					$details[ 'expires' ] = '<div class="error inline"><p>' . $this->strings( 'expired', $response ) . '</p></div>';
290 290
 				}
291 291
 
292 292
 				$return .= '<ul><li>' . implode( '</li><li>', array_filter( $details ) ) . '</li></ul>';
@@ -312,20 +312,20 @@  discard block
 block discarded – undo
312 312
 		if ( ! empty( $upgrades ) ) {
313 313
 
314 314
 			$locale_parts = explode( '_', get_locale() );
315
-			$is_english = ( 'en' === $locale_parts[0] );
315
+			$is_english = ( 'en' === $locale_parts[ 0 ] );
316 316
 
317 317
 			$output .= '<h4>' . esc_html__( 'Upgrades available:', 'gravityview' ) . '</h4>';
318 318
 			$output .= '<ul class="ul-disc">';
319 319
 
320 320
 			foreach ( $upgrades as $upgrade_id => $upgrade ) {
321
-				$upgrade = (object) $upgrade;
321
+				$upgrade = (object)$upgrade;
322 322
 
323 323
 				$anchor_text = sprintf( esc_html_x( 'Upgrade to %1$s for %2$s', '1: GravityView upgrade name, 2: Cost of upgrade', 'gravityview' ), esc_attr( $upgrade->name ), esc_attr( $upgrade->price ) );
324 324
 
325 325
 				if ( $is_english && isset( $upgrade->description ) ) {
326 326
 					$message = esc_html( $upgrade->description );
327 327
 				} else {
328
-					switch( $upgrade->price_id ) {
328
+					switch ( $upgrade->price_id ) {
329 329
 						// Interstellar
330 330
 						case 1:
331 331
 						default:
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 			'invalid' => esc_html__( 'The license key entered is invalid.', 'gravityview' ),
384 384
 			'missing' => esc_html__( 'Invalid license key.', 'gravityview' ),
385 385
 			'revoked' => esc_html__( 'This license key has been revoked.', 'gravityview' ),
386
-			'expired' => sprintf( esc_html__( 'This license key has expired. %sRenew your license on the GravityView website%s to receive updates and support.', 'gravityview' ), '<a href="'. esc_url( $this->get_license_renewal_url( $license_data ) ) .'">', '</a>' ),
386
+			'expired' => sprintf( esc_html__( 'This license key has expired. %sRenew your license on the GravityView website%s to receive updates and support.', 'gravityview' ), '<a href="' . esc_url( $this->get_license_renewal_url( $license_data ) ) . '">', '</a>' ),
387 387
 			'capability' => esc_html__( 'You don\'t have the ability to edit plugin settings.', 'gravityview' ),
388 388
 
389 389
 			'verifying_license' => esc_html__( 'Verifying license&hellip;', 'gravityview' ),
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
 
407 407
 		if ( ! empty( $license_data->renewal_url ) ) {
408 408
 			$renew_license_url = $license_data->renewal_url;
409
-		} elseif( ! empty( $license_data->license_key ) ) {
409
+		} elseif ( ! empty( $license_data->license_key ) ) {
410 410
 			$renew_license_url = sprintf( 'https://gravityview.co/checkout/?download_id=17&edd_license_key=%s', $license_data->license_key );
411 411
 		} else {
412 412
 			$renew_license_url = 'https://gravityview.co/account/';
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
 	 * @return array|WP_Error
424 424
 	 */
425 425
 	private function _license_get_remote_response( $data, $license = '' ) {
426
-		$api_params = $this->_get_edd_settings( $data['edd_action'], $license );
426
+		$api_params = $this->_get_edd_settings( $data[ 'edd_action' ], $license );
427 427
 
428 428
 		$url = add_query_arg( $api_params, self::url );
429 429
 
@@ -463,9 +463,9 @@  discard block
 block discarded – undo
463 463
 	private function license_call_update_settings( $license_data, $data ) {
464 464
 		$settings = array();
465 465
 
466
-        $settings['license_key'] = $license_data->license_key = trim( $data['license'] );
467
-		$settings['license_key_status'] = $license_data->license;
468
-		$settings['license_key_response'] = (array)$license_data;
466
+        $settings[ 'license_key' ] = $license_data->license_key = trim( $data[ 'license' ] );
467
+		$settings[ 'license_key_status' ] = $license_data->license;
468
+		$settings[ 'license_key_response' ] = (array)$license_data;
469 469
 
470 470
 		$this->settings->update( $settings );
471 471
 	}
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
 
481 481
 		if ( ! empty( $key ) ) {
482 482
 			$response = $this->settings->get( 'license_key_response' );
483
-			$response = is_array( $response ) ? (object) $response : json_decode( $response );
483
+			$response = is_array( $response ) ? (object)$response : json_decode( $response );
484 484
 		} else {
485 485
 			$response = array();
486 486
 		}
@@ -522,11 +522,11 @@  discard block
 block discarded – undo
522 522
 
523 523
 		$submit = '<div class="gv-edd-button-wrapper">';
524 524
 		foreach ( $fields as $field ) {
525
-			$field['type'] = 'button';
526
-			$field['class'] = isset( $field['class'] ) ? $field['class'] . ' '. $class : $class;
527
-			$field['style'] = 'margin-left: 10px;';
528
-			if( $disabled_attribute ) {
529
-				$field['disabled'] = $disabled_attribute;
525
+			$field[ 'type' ] = 'button';
526
+			$field[ 'class' ] = isset( $field[ 'class' ] ) ? $field[ 'class' ] . ' ' . $class : $class;
527
+			$field[ 'style' ] = 'margin-left: 10px;';
528
+			if ( $disabled_attribute ) {
529
+				$field[ 'disabled' ] = $disabled_attribute;
530 530
 			}
531 531
 			$submit .= $this->settings->as_html( $field, $echo );
532 532
 		}
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
 				    'url'        => home_url(),
606 606
 				    'site_data'  => $this->get_site_data(),
607 607
 			    ),
608
-			));
608
+			) );
609 609
 
610 610
 			// make sure the response came back okay
611 611
 			if ( is_wp_error( $response ) ) {
@@ -636,45 +636,45 @@  discard block
 block discarded – undo
636 636
 		$theme_data = wp_get_theme();
637 637
 		$theme      = $theme_data->Name . ' ' . $theme_data->Version;
638 638
 
639
-		$data['gv_version']  = Plugin::$version;
640
-		$data['php_version']  = phpversion();
641
-		$data['wp_version']   = get_bloginfo( 'version' );
642
-		$data['gf_version']  = \GFForms::$version;
643
-		$data['server']       = Utils::get( $_SERVER, 'SERVER_SOFTWARE' );
644
-		$data['multisite']    = is_multisite();
645
-		$data['theme']        = $theme;
646
-		$data['url']          = home_url();
647
-		$data['license_key']  = $this->settings->get( 'license_key' );
648
-		$data['beta']         = $this->settings->get( 'beta' );
639
+		$data[ 'gv_version' ]  = Plugin::$version;
640
+		$data[ 'php_version' ]  = phpversion();
641
+		$data[ 'wp_version' ]   = get_bloginfo( 'version' );
642
+		$data[ 'gf_version' ]  = \GFForms::$version;
643
+		$data[ 'server' ]       = Utils::get( $_SERVER, 'SERVER_SOFTWARE' );
644
+		$data[ 'multisite' ]    = is_multisite();
645
+		$data[ 'theme' ]        = $theme;
646
+		$data[ 'url' ]          = home_url();
647
+		$data[ 'license_key' ]  = $this->settings->get( 'license_key' );
648
+		$data[ 'beta' ]         = $this->settings->get( 'beta' );
649 649
 
650 650
 		// View Data
651 651
 		$gravityview_posts = wp_count_posts( 'gravityview', 'readable' );
652 652
 
653
-		$data['view_count'] = null;
654
-		$data['view_first'] = null;
655
-		$data['view_latest'] = null;
653
+		$data[ 'view_count' ] = null;
654
+		$data[ 'view_first' ] = null;
655
+		$data[ 'view_latest' ] = null;
656 656
 
657 657
 		if ( $gravityview_posts->publish ) {
658
-			$data['view_count'] = $gravityview_posts->publish;
658
+			$data[ 'view_count' ] = $gravityview_posts->publish;
659 659
 
660 660
 			$first = get_posts( 'numberposts=1&post_type=gravityview&post_status=publish&order=ASC' );
661 661
 			$latest = get_posts( 'numberposts=1&post_type=gravityview&post_status=publish&order=DESC' );
662 662
 
663 663
 			if ( $first = array_shift( $first ) ) {
664
-				$data['view_first'] = $first->post_date;
664
+				$data[ 'view_first' ] = $first->post_date;
665 665
 			}
666 666
 			if ( $latest = array_pop( $latest ) ) {
667
-				$data['view_latest'] = $latest->post_date;
667
+				$data[ 'view_latest' ] = $latest->post_date;
668 668
 			}
669 669
 		}
670 670
 
671 671
 		// Form counts
672 672
 		if ( class_exists( 'GFFormsModel' ) ) {
673 673
 			$form_data = \GFFormsModel::get_form_count();
674
-			$data['forms_total'] = Utils::get( $form_data, 'total', 0 );
675
-			$data['forms_active'] = Utils::get( $form_data, 'active', 0 );
676
-			$data['forms_inactive'] = Utils::get( $form_data, 'inactive', 0 );
677
-			$data['forms_trash'] = Utils::get( $form_data, 'inactive', 0 );
674
+			$data[ 'forms_total' ] = Utils::get( $form_data, 'total', 0 );
675
+			$data[ 'forms_active' ] = Utils::get( $form_data, 'active', 0 );
676
+			$data[ 'forms_inactive' ] = Utils::get( $form_data, 'inactive', 0 );
677
+			$data[ 'forms_trash' ] = Utils::get( $form_data, 'inactive', 0 );
678 678
 		}
679 679
 
680 680
 		// Retrieve current plugin information
@@ -682,13 +682,13 @@  discard block
 block discarded – undo
682 682
 			include ABSPATH . '/wp-admin/includes/plugin.php';
683 683
 		}
684 684
 
685
-		$data['integrations']     = self::get_related_plugins_and_extensions();
686
-		$data['active_plugins']   = get_option( 'active_plugins', array() );
687
-		$data['inactive_plugins'] = array();
688
-		$data['locale']           = get_locale();
685
+		$data[ 'integrations' ]     = self::get_related_plugins_and_extensions();
686
+		$data[ 'active_plugins' ]   = get_option( 'active_plugins', array() );
687
+		$data[ 'inactive_plugins' ] = array();
688
+		$data[ 'locale' ]           = get_locale();
689 689
 
690 690
 		// Validate request on the GV server
691
-		$data['hash']             = 'gv_version.url.locale:' . sha1( $data['gv_version'] . $data['url'] . $data['locale'] );
691
+		$data[ 'hash' ]             = 'gv_version.url.locale:' . sha1( $data[ 'gv_version' ] . $data[ 'url' ] . $data[ 'locale' ] );
692 692
 
693 693
 		return $data;
694 694
 	}
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
 
719 719
 				$plugin_data = get_plugin_data( $active_plugin );
720 720
 
721
-				$extensions[] = sprintf( '%s %s', $plugin_data['Name'], $plugin_data['Version'] );
721
+				$extensions[ ] = sprintf( '%s %s', $plugin_data[ 'Name' ], $plugin_data[ 'Version' ] );
722 722
 			}
723 723
 
724 724
 			if ( ! empty( $extensions ) ) {
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -174,7 +174,8 @@  discard block
 block discarded – undo
174 174
 			if ( empty( $license_data ) ) {
175 175
 				if ( $is_ajax ) {
176 176
 					exit( json_encode( array() ) );
177
-				} else { // Non-ajax call
177
+				} else {
178
+// Non-ajax call
178 179
 					return json_encode( array() );
179 180
 				}
180 181
 			}
@@ -207,7 +208,8 @@  discard block
 block discarded – undo
207 208
 
208 209
 		if ( $is_ajax ) {
209 210
 			exit( $json );
210
-		} else { // Non-ajax call
211
+		} else {
212
+// Non-ajax call
211 213
 			return ( Utils::_GET( 'format', Utils::get( $data, 'format' ) ) === 'object' ) ? $license_data : $json;
212 214
 		}
213 215
 	}
Please login to merge, or discard this patch.
future/includes/class-gv-settings.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@
 block discarded – undo
64 64
 	 * Set an setting.
65 65
 	 *
66 66
 	 * @param mixed $key The key in this setting to retrieve.
67
-	 * @param mixed $default A default in case the key is not set. 
67
+	 * @param false|null $default A default in case the key is not set. 
68 68
 	 *
69 69
 	 * @api
70 70
 	 * @since 2.0
Please login to merge, or discard this patch.
future/includes/class-gv-shortcode-gravityview.php 2 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -174,7 +174,6 @@
 block discarded – undo
174 174
 	 * @param \GV\View $view The View.
175 175
 	 * @param \GV\Entry_Collection $entries The calculated entries.
176 176
 	 * @param array $atts The shortcode attributes (with defaults).
177
-	 * @param array $view_atts A quirky compatibility parameter where we get the unaltered view atts.
178 177
 	 *
179 178
 	 * @return string The output.
180 179
 	 */
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 			'page_size' => 20,
39 39
 		) );
40 40
 
41
-		$view = \GV\View::by_id( $atts['id'] ? : $atts['view_id'] );
41
+		$view = \GV\View::by_id( $atts[ 'id' ] ?: $atts[ 'view_id' ] );
42 42
 
43 43
 		if ( ! $view ) {
44 44
 			gravityview()->log->error( 'View does not exist #{view_id}', array( 'view_id' => $view->ID ) );
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 			return get_the_password_form( $view->ID );
73 73
 		}
74 74
 
75
-		if ( ! $view->form  ) {
75
+		if ( ! $view->form ) {
76 76
 			gravityview()->log->notice( 'View #{id} has no form attached to it.', array( 'id' => $view->ID ) );
77 77
 
78 78
 			/**
@@ -96,14 +96,14 @@  discard block
 block discarded – undo
96 96
 		/**
97 97
 		 * View details.
98 98
 		 */
99
-		if ( $atts['detail'] ) {
99
+		if ( $atts[ 'detail' ] ) {
100 100
 			return $this->detail( $view, $entries, $atts );
101 101
 
102 102
 		/**
103 103
 		 * Editing a single entry.
104 104
 		 */
105 105
 		} else if ( ! $is_reembedded && ( $entry = $request->is_edit_entry() ) ) {
106
-			if ( $entry['status'] != 'active' ) {
106
+			if ( $entry[ 'status' ] != 'active' ) {
107 107
 				gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) );
108 108
 				return __( 'You are not allowed to view this content.', 'gravityview' );
109 109
 			}
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 			}
115 115
 
116 116
 			if ( $view->settings->get( 'show_only_approved' ) ) {
117
-				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) )  ) {
117
+				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) {
118 118
 					gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) );
119 119
 					return __( 'You are not allowed to view this content.', 'gravityview' );
120 120
 				}
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 		 * Viewing a single entry.
128 128
 		 */
129 129
 		} else if ( ! $is_reembedded && ( $entry = $request->is_entry() ) ) {
130
-			if ( $entry['status'] != 'active' ) {
130
+			if ( $entry[ 'status' ] != 'active' ) {
131 131
 				gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) );
132 132
 				return __( 'You are not allowed to view this content.', 'gravityview' );
133 133
 			}
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 			}
139 139
 
140 140
 			if ( $view->settings->get( 'show_only_approved' ) ) {
141
-				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) )  ) {
141
+				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) {
142 142
 					gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) );
143 143
 					return __( 'You are not allowed to view this content.', 'gravityview' );
144 144
 				}
@@ -155,10 +155,10 @@  discard block
 block discarded – undo
155 155
 				
156 156
 				// Mock the request with the actual View, not the global one
157 157
 				$mock_request = new \GV\Mock_Request();
158
-				$mock_request->returns['is_view'] = $view;
159
-				$mock_request->returns['is_entry'] = $request->is_entry();
160
-				$mock_request->returns['is_edit_entry'] = $request->is_edit_entry();
161
-				$mock_request->returns['is_search'] = $request->is_search();
158
+				$mock_request->returns[ 'is_view' ] = $view;
159
+				$mock_request->returns[ 'is_entry' ] = $request->is_entry();
160
+				$mock_request->returns[ 'is_edit_entry' ] = $request->is_edit_entry();
161
+				$mock_request->returns[ 'is_search' ] = $request->is_search();
162 162
 
163 163
 				$request = $mock_request;
164 164
 			}
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	private function detail( $view, $entries, $atts ) {
182 182
 		$output = '';
183 183
 
184
-		switch ( $key = $atts['detail'] ):
184
+		switch ( $key = $atts[ 'detail' ] ):
185 185
 			case 'total_entries':
186 186
 				$output = number_format_i18n( $entries->total() );
187 187
 				break;
Please login to merge, or discard this patch.