Completed
Pull Request — master (#1022)
by Zack
54:55 queued 34:42
created
includes/fields/class-gravityview-field-password.php 3 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
 	 *
50 50
 	 * @return string If a custom field label isn't set, return the field label for the password field
51 51
 	 */
52
-	function field_label( $label = '', $field = array(), $form = array(), $entry = array() ){
52
+	function field_label( $label = '', $field = array(), $form = array(), $entry = array() ) {
53 53
 
54 54
 		// If using a custom label, no need to fetch the parent label
55 55
 		if( ! is_numeric( $field['id'] ) || ! empty( $field['custom_label'] ) ) {
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -49,17 +49,17 @@  discard block
 block discarded – undo
49 49
 	 *
50 50
 	 * @return string If a custom field label isn't set, return the field label for the password field
51 51
 	 */
52
-	function field_label( $label = '', $field = array(), $form = array(), $entry = array() ){
52
+	function field_label( $label = '', $field = array(), $form = array(), $entry = array() ) {
53 53
 
54 54
 		// If using a custom label, no need to fetch the parent label
55
-		if( ! is_numeric( $field['id'] ) || ! empty( $field['custom_label'] ) ) {
55
+		if ( ! is_numeric( $field[ 'id' ] ) || ! empty( $field[ 'custom_label' ] ) ) {
56 56
 			return $label;
57 57
 		}
58 58
 
59
-		$field_object = GFFormsModel::get_field( $form, $field['id'] );
59
+		$field_object = GFFormsModel::get_field( $form, $field[ 'id' ] );
60 60
 
61
-		if( $field_object && 'password' === $field_object->type ) {
62
-			$label = $field['label'];
61
+		if ( $field_object && 'password' === $field_object->type ) {
62
+			$label = $field[ 'label' ];
63 63
 		}
64 64
 
65 65
 		return $label;
@@ -79,17 +79,17 @@  discard block
 block discarded – undo
79 79
 	function add_form_fields( $fields = array(), $form = array(), $include_parent_field = true ) {
80 80
 
81 81
 		foreach ( $fields as $key => $field ) {
82
-			if( 'password' === $field['type'] ) {
82
+			if ( 'password' === $field[ 'type' ] ) {
83 83
 
84 84
 				// The Enter Password input
85
-				if( floor( $key ) === floatval( $key ) ) {
85
+				if ( floor( $key ) === floatval( $key ) ) {
86 86
 
87
-					if( ! empty( $field['parent'] ) ) {
88
-						$field['label']      = $field['parent']->label;
89
-						$field['adminOnly']  = $field['parent']->adminOnly;
90
-						$field['adminLabel'] = $field['parent']->adminLabel;
87
+					if ( ! empty( $field[ 'parent' ] ) ) {
88
+						$field[ 'label' ]      = $field[ 'parent' ]->label;
89
+						$field[ 'adminOnly' ]  = $field[ 'parent' ]->adminOnly;
90
+						$field[ 'adminLabel' ] = $field[ 'parent' ]->adminLabel;
91 91
 						// Don't show as a child input
92
-						unset( $field['parent'] );
92
+						unset( $field[ 'parent' ] );
93 93
 					}
94 94
 
95 95
 					$fields[ $key ] = $field;
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
 	 * @param \GV\Entry		$entry	The entry.
39 39
 	 * @param \GV\Request	$request The request context.
40 40
 	 *
41
-	 * @return mixed $value The filtered value.
41
+	 * @return string $value The filtered value.
42 42
 	 */
43 43
 	public function get_value( $value, $field, $view, $source, $entry, $request ) {
44 44
 		/** Passwords should never be exposed. */
Please login to merge, or discard this patch.
includes/presets/default-edit/class-gravityview-default-template-edit.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
24 24
 			'slug' => 'edit',
25 25
 			'type' => 'internal',
26 26
 			'label' =>  __( 'Edit Table', 'gravityview' ),
27
-			'description' => __('Display items in a table view.', 'gravityview'),
28
-			'logo' => plugins_url('includes/presets/default-table/logo-default-table.png', GRAVITYVIEW_FILE),
27
+			'description' => __( 'Display items in a table view.', 'gravityview' ),
28
+			'logo' => plugins_url( 'includes/presets/default-table/logo-default-table.png', GRAVITYVIEW_FILE ),
29 29
 			'css_source' => gravityview_css_url( 'table-view.css', GRAVITYVIEW_DIR . 'templates/css/' ),
30 30
 		);
31 31
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 				'1-1' => array(
43 43
 					array(
44 44
 						'areaid' => 'edit-fields',
45
-						'title' => __('Visible Edit Fields', 'gravityview' )
45
+						'title' => __( 'Visible Edit Fields', 'gravityview' )
46 46
 					)
47 47
 				)
48 48
 			)
Please login to merge, or discard this patch.
class-gravityview-plugin-hooks-gravity-forms-survey.php 2 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,6 @@
 block discarded – undo
36 36
 	 * @since 1.16.4
37 37
 	 * @since 1.17 Moved to GravityView_Plugin_Hooks_Gravity_Forms_Survey class
38 38
 	 *
39
-	 * @param array $form
40 39
 	 *
41 40
 	 * @return array Form, with all fields set to `allowsPrepopulate => true`
42 41
 	 */
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
 		$return = $input_type;
47 47
 
48
-		if( 'survey' === $field_type ) {
48
+		if ( 'survey' === $field_type ) {
49 49
 			$return = 'select';
50 50
 		}
51 51
 
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
 	public function fix_survey_fields( $fields ) {
66 66
 
67 67
 		/** @var GF_Field $field */
68
-		foreach( $fields as &$field ) {
69
-			if( 'survey' === $field->type ) {
68
+		foreach ( $fields as &$field ) {
69
+			if ( 'survey' === $field->type ) {
70 70
 				$field->allowsPrepopulate = true;
71 71
 			}
72 72
 		}
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	 * @return void
83 83
 	 */
84 84
 	function add_render_hooks() {
85
-		add_filter( 'gform_field_value', array( $this, 'fix_survey_field_value'), 10, 3 );
85
+		add_filter( 'gform_field_value', array( $this, 'fix_survey_field_value' ), 10, 3 );
86 86
 	}
87 87
 
88 88
 	/**
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 * @return void
96 96
 	 */
97 97
 	function remove_render_hooks() {
98
-		remove_filter( 'gform_field_value', array( $this, 'fix_survey_field_value'), 10 );
98
+		remove_filter( 'gform_field_value', array( $this, 'fix_survey_field_value' ), 10 );
99 99
 	}
100 100
 
101 101
 	/**
@@ -113,9 +113,9 @@  discard block
 block discarded – undo
113 113
 	 */
114 114
 	public function fix_survey_field_value( $value, $field, $name ) {
115 115
 
116
-		if( 'survey' === $field->type ) {
116
+		if ( 'survey' === $field->type ) {
117 117
 
118
-			$entry = GravityView_Edit_Entry::getInstance()->instances['render']->get_entry();
118
+			$entry = GravityView_Edit_Entry::getInstance()->instances[ 'render' ]->get_entry();
119 119
 
120 120
 			// We need to run through each survey row until we find a match for expected values
121 121
 			foreach ( $entry as $field_id => $field_value ) {
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 					list( $row_val, $col_val ) = explode( ':', $field_value, 2 );
129 129
 
130 130
 					// If the $name matches the $row_val, we are processing the correct row
131
-					if( $row_val === $name ) {
131
+					if ( $row_val === $name ) {
132 132
 						$value = $field_value;
133 133
 						break;
134 134
 					}
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-post-custom-field.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	 * @return void
31 31
 	 */
32 32
 	private function add_hooks() {
33
-		add_filter( 'gravityview/edit_entry/field_value_post_custom_field', array( $this, 'edit_entry_field_value'), 10, 2 );
33
+		add_filter( 'gravityview/edit_entry/field_value_post_custom_field', array( $this, 'edit_entry_field_value' ), 10, 2 );
34 34
 	}
35 35
 
36 36
 	/**
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	 */
46 46
 	public function edit_entry_field_value( $field_value, $field ) {
47 47
 
48
-		if( 'list' === $field->inputType ) {
48
+		if ( 'list' === $field->inputType ) {
49 49
 			$field_value = is_string( $field_value ) ? json_decode( $field_value, true ) : $field_value;
50 50
 
51 51
 			if ( ! is_array( $field_value ) ) {
Please login to merge, or discard this patch.
includes/admin/class-gravityview-admin-view-widget.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@
 block discarded – undo
12 12
 
13 13
 		$field_info_items = array();
14 14
 
15
-		if( !empty( $this->item['description'] ) ) {
15
+		if ( ! empty( $this->item[ 'description' ] ) ) {
16 16
 
17
-			$field_info_items[] = array(
18
-				'value' => $this->item['description']
17
+			$field_info_items[ ] = array(
18
+				'value' => $this->item[ 'description' ]
19 19
 			);
20 20
 
21 21
 		}
Please login to merge, or discard this patch.
includes/admin/class-gravityview-admin-view-field.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -15,29 +15,29 @@
 block discarded – undo
15 15
 		$field_info_items = array();
16 16
 
17 17
 		// Fields with IDs, not like Source URL or Entry ID
18
-		if( is_numeric( $this->id ) ) {
18
+		if ( is_numeric( $this->id ) ) {
19 19
 
20
-			$field_type_title = GFCommon::get_field_type_title( $this->item['input_type'] );
20
+			$field_type_title = GFCommon::get_field_type_title( $this->item[ 'input_type' ] );
21 21
 
22
-			$field_info_items[] = array(
23
-				'value' => sprintf( __('Type: %s', 'gravityview'), $field_type_title )
22
+			$field_info_items[ ] = array(
23
+				'value' => sprintf( __( 'Type: %s', 'gravityview' ), $field_type_title )
24 24
 			);
25 25
 
26
-			$field_info_items[] = array(
27
-				'value' => sprintf( __('Field ID: %s', 'gravityview'), $this->id ),
26
+			$field_info_items[ ] = array(
27
+				'value' => sprintf( __( 'Field ID: %s', 'gravityview' ), $this->id ),
28 28
 			);
29 29
 
30 30
 		}
31 31
 
32
-		if( !empty( $this->item['desc'] ) ) {
33
-			$field_info_items[] = array(
34
-				'value' => $this->item['desc']
32
+		if ( ! empty( $this->item[ 'desc' ] ) ) {
33
+			$field_info_items[ ] = array(
34
+				'value' => $this->item[ 'desc' ]
35 35
 			);
36 36
 		}
37 37
 
38
-		if( !empty( $this->item['adminLabel'] ) ) {
39
-			$field_info_items[] = array(
40
-				'value' => sprintf( __('Admin Label: %s', 'gravityview' ), $this->item['adminLabel'] ),
38
+		if ( ! empty( $this->item[ 'adminLabel' ] ) ) {
39
+			$field_info_items[ ] = array(
40
+				'value' => sprintf( __( 'Admin Label: %s', 'gravityview' ), $this->item[ 'adminLabel' ] ),
41 41
 				'class'	=> 'gv-sublabel'
42 42
 			);
43 43
 		}
Please login to merge, or discard this patch.
includes/class-common.php 4 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 	 * Return array of fields' id and label, for a given Form ID
210 210
 	 *
211 211
 	 * @access public
212
-	 * @param string|array $form_id (default: '') or $form object
212
+	 * @param string|array $form (default: '') or $form object
213 213
 	 * @param bool $add_default_properties
214 214
 	 * @param bool $include_parent_field
215 215
 	 * @return array
@@ -850,7 +850,7 @@  discard block
 block discarded – undo
850 850
 	 *
851 851
 	 * @param array $form Gravity Forms form array
852 852
 	 * @param string $field_id ID of the field. If an input, full input ID (like `1.3`)
853
-	 * @param string|array $field_value Raw value of the field.
853
+	 * @param string $field_value Raw value of the field.
854 854
 	 * @return string
855 855
 	 */
856 856
 	public static function get_field_label( $form = array(), $field_id = '', $field_value = '' ) {
@@ -1503,9 +1503,9 @@  discard block
 block discarded – undo
1503 1503
 	 * @param string $message            Message body (required)
1504 1504
 	 * @param string $from_name          Displayed name of the sender
1505 1505
 	 * @param string $message_format     If "html", sent text as `text/html`. Otherwise, `text/plain`. Default: "html".
1506
-	 * @param string|array $attachments  Optional. Files to attach. {@see wp_mail()} for usage. Default: "".
1506
+	 * @param string $attachments  Optional. Files to attach. {@see wp_mail()} for usage. Default: "".
1507 1507
 	 * @param array|false $entry         Gravity Forms entry array, related to the email. Default: false.
1508
-	 * @param array|false $notification  Gravity Forms notification that triggered the email. {@see GFCommon::send_notification}. Default:false.
1508
+	 * @param boolean $notification  Gravity Forms notification that triggered the email. {@see GFCommon::send_notification}. Default:false.
1509 1509
 	 */
1510 1510
 	public static function send_email( $from, $to, $bcc, $reply_to, $subject, $message, $from_name = '', $message_format = 'html', $attachments = '', $entry = false, $notification = false ) {
1511 1511
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 				}
325 325
 
326 326
 
327
-				if( GFCommon::is_product_field( $field['type'] ) ){
327
+				if( GFCommon::is_product_field( $field['type'] ) ) {
328 328
 					$has_product_fields = true;
329 329
 				}
330 330
 
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 
385 385
 		$fields = array();
386 386
 
387
-		foreach ( $extra_fields as $key => $field ){
387
+		foreach ( $extra_fields as $key => $field ) {
388 388
 			if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) {
389 389
 				$fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' );
390 390
 			}
@@ -978,7 +978,7 @@  discard block
 block discarded – undo
978 978
 			$form = GFAPI::get_form( $form );
979 979
 		}
980 980
 
981
-		if ( class_exists( 'GFFormsModel' ) ){
981
+		if ( class_exists( 'GFFormsModel' ) ) {
982 982
 			return GFFormsModel::get_field( $form, $field_id );
983 983
 		} else {
984 984
 			return null;
@@ -1025,7 +1025,7 @@  discard block
 block discarded – undo
1025 1025
 			$shortcodes = array();
1026 1026
 
1027 1027
 			preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER );
1028
-			if ( empty( $matches ) ){
1028
+			if ( empty( $matches ) ) {
1029 1029
 				return false;
1030 1030
 			}
1031 1031
 
Please login to merge, or discard this patch.
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.
includes/fields/class-gravityview-field-workflow_step.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -47,11 +47,11 @@  discard block
 block discarded – undo
47 47
 	function modify_entry_value_workflow_step( $output, $entry, $field_settings, $field ) {
48 48
 
49 49
 		// If not set, the entry hasn't started a workflow
50
-		$has_workflow_step = isset( $entry['workflow_step'] );
50
+		$has_workflow_step = isset( $entry[ 'workflow_step' ] );
51 51
 
52
-		if( $has_workflow_step ) {
52
+		if ( $has_workflow_step ) {
53 53
 
54
-			$GFlow = new Gravity_Flow_API( $entry['form_id'] );
54
+			$GFlow = new Gravity_Flow_API( $entry[ 'form_id' ] );
55 55
 
56 56
 			if ( $current_step = $GFlow->get_current_step( $entry ) ) {
57 57
 				$output = esc_html( $current_step->get_name() );
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 		preg_match( '/workflow_step_status_(\d+)/', $key, $matches );
80 80
 
81 81
 		if ( ! empty( $matches ) ) {
82
-			$workflow_step_id = intval( $matches[1] );
82
+			$workflow_step_id = intval( $matches[ 1 ] );
83 83
 		}
84 84
 
85 85
 		return $workflow_step_id;
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 
99 99
 		$return = $label;
100 100
 
101
-		if ( '' === $label && $workflow_step_id = $this->get_step_id_from_key( $field['field'] ) ) {
101
+		if ( '' === $label && $workflow_step_id = $this->get_step_id_from_key( $field[ 'field' ] ) ) {
102 102
 
103 103
 			$step = $this->get_workflow_step( $workflow_step_id );
104 104
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 
129 129
 		$workflow_step = $GFlow->get_step( $workflow_step_id );
130 130
 
131
-		if( ! $GFlow || ! $workflow_step ) {
131
+		if ( ! $GFlow || ! $workflow_step ) {
132 132
 			return false;
133 133
 		}
134 134
 
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 		
151 151
 		foreach ( $search_fields as & $search_field ) {
152 152
 
153
-			if ( $this->name === $search_field['key'] ) {
153
+			if ( $this->name === $search_field[ 'key' ] ) {
154 154
 
155 155
 				$form_id = GravityView_View::getInstance()->getFormId();
156 156
 
@@ -159,21 +159,21 @@  discard block
 block discarded – undo
159 159
 				$choices = array();
160 160
 
161 161
 				foreach ( $workflow_steps as $step ) {
162
-					$choices[] = array(
162
+					$choices[ ] = array(
163 163
 						'text'   => $step->get_name(),
164 164
 						'value'   => $step->get_id(),
165 165
 					);
166 166
 				}
167 167
 
168
-				$search_field['choices'] = $choices;
168
+				$search_field[ 'choices' ] = $choices;
169 169
 			}
170 170
 
171 171
 			// Workflow Step Statuses
172
-			else if ( $workflow_step_id = $this->get_step_id_from_key( $search_field['key'] ) ) {
172
+			else if ( $workflow_step_id = $this->get_step_id_from_key( $search_field[ 'key' ] ) ) {
173 173
 
174 174
 				$status_key = sprintf( 'workflow_step_status_%d', $workflow_step_id );
175 175
 
176
-				$search_field['choices'] = GravityView_Plugin_Hooks_Gravity_Flow::get_status_options( null, $status_key );
176
+				$search_field[ 'choices' ] = GravityView_Plugin_Hooks_Gravity_Flow::get_status_options( null, $status_key );
177 177
 			}
178 178
 		}
179 179
 		
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-workflow_final_status.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 */
42 42
 	function modify_entry_value_workflow_final_status( $output, $entry, $field_settings, $field ) {
43 43
 
44
-		if( ! empty( $output ) ) {
44
+		if ( ! empty( $output ) ) {
45 45
 			$output = gravity_flow()->translate_status_label( $output );
46 46
 		}
47 47
 
@@ -59,8 +59,8 @@  discard block
 block discarded – undo
59 59
 	function modify_search_filters( $search_fields = array(), GravityView_Widget_Search $widget, $widget_args = array() ) {
60 60
 
61 61
 		foreach ( $search_fields as & $search_field ) {
62
-			if ( $this->name === $search_field['key'] ) {
63
-				$search_field['choices'] = GravityView_Plugin_Hooks_Gravity_Flow::get_status_options();
62
+			if ( $this->name === $search_field[ 'key' ] ) {
63
+				$search_field[ 'choices' ] = GravityView_Plugin_Hooks_Gravity_Flow::get_status_options();
64 64
 			}
65 65
 		}
66 66
 
Please login to merge, or discard this patch.