Completed
Pull Request — master (#822)
by Zack
23:55 queued 20:40
created
includes/class-gravityview-admin-bar.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -38,13 +38,13 @@  discard block
 block discarded – undo
38 38
 		/** @var WP_Admin_Bar $wp_admin_bar */
39 39
 		global $wp_admin_bar;
40 40
 
41
-		if( is_admin() || ! GVCommon::has_cap( array( 'edit_gravityviews', 'gravityview_edit_entry', 'gravityforms_edit_forms' ) ) ) {
41
+		if ( is_admin() || ! GVCommon::has_cap( array( 'edit_gravityviews', 'gravityview_edit_entry', 'gravityforms_edit_forms' ) ) ) {
42 42
 			return;
43 43
 		}
44 44
 
45 45
 		$view_data = GravityView_View_Data::getInstance()->get_views();
46 46
 
47
-		if( empty( $view_data ) ) {
47
+		if ( empty( $view_data ) ) {
48 48
 			return;
49 49
 		}
50 50
 
@@ -104,9 +104,9 @@  discard block
 block discarded – undo
104 104
 				'parent' => 'gravityview',
105 105
 				'title' => __( 'Edit Entry', 'gravityview' ),
106 106
 				'meta' => array(
107
-					'title' => sprintf( __( 'Edit Entry %s', 'gravityview' ), GravityView_API::get_entry_slug( $entry['id'], $entry ) ),
107
+					'title' => sprintf( __( 'Edit Entry %s', 'gravityview' ), GravityView_API::get_entry_slug( $entry[ 'id' ], $entry ) ),
108 108
 				),
109
-				'href' => esc_url_raw( admin_url( sprintf( 'admin.php?page=gf_entries&screen_mode=edit&view=entry&id=%d&lid=%d', $entry['form_id'], $entry['id'] ) ) ),
109
+				'href' => esc_url_raw( admin_url( sprintf( 'admin.php?page=gf_entries&screen_mode=edit&view=entry&id=%d&lid=%d', $entry[ 'form_id' ], $entry[ 'id' ] ) ) ),
110 110
 			) );
111 111
 
112 112
 		}
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 		/** @var WP_Admin_Bar $wp_admin_bar */
123 123
 		global $wp_admin_bar;
124 124
 
125
-		if( GVCommon::has_cap( array( 'edit_gravityviews', 'edit_gravityview', 'gravityforms_edit_forms' ) ) ) {
125
+		if ( GVCommon::has_cap( array( 'edit_gravityviews', 'edit_gravityview', 'gravityforms_edit_forms' ) ) ) {
126 126
 
127 127
 			$view_data = GravityView_View_Data::getInstance();
128 128
 
@@ -139,32 +139,32 @@  discard block
 block discarded – undo
139 139
 					$edit_view_title = __( 'Edit View', 'gravityview' );
140 140
 					$edit_form_title = __( 'Edit Form', 'gravityview' );
141 141
 
142
-					if( sizeof( $views ) > 1 ) {
143
-						$edit_view_title = sprintf( _x( 'Edit View #%d', 'Edit View with the ID of %d', 'gravityview' ), $view['id'] );
144
-						$edit_form_title = sprintf( __( 'Edit Form #%d', 'Edit Form with the ID of %d', 'gravityview' ), $view['form_id'] );
142
+					if ( sizeof( $views ) > 1 ) {
143
+						$edit_view_title = sprintf( _x( 'Edit View #%d', 'Edit View with the ID of %d', 'gravityview' ), $view[ 'id' ] );
144
+						$edit_form_title = sprintf( __( 'Edit Form #%d', 'Edit Form with the ID of %d', 'gravityview' ), $view[ 'form_id' ] );
145 145
 					}
146 146
 
147
-					if( GVCommon::has_cap( 'edit_gravityview', $view['id'] ) && ! in_array( $view['id'], $added_views ) ) {
147
+					if ( GVCommon::has_cap( 'edit_gravityview', $view[ 'id' ] ) && ! in_array( $view[ 'id' ], $added_views ) ) {
148 148
 
149
-						$added_views[] = $view['id'];
149
+						$added_views[ ] = $view[ 'id' ];
150 150
 
151 151
 						$wp_admin_bar->add_menu( array(
152
-							'id'    => 'edit-view-' . $view['id'],
152
+							'id'    => 'edit-view-' . $view[ 'id' ],
153 153
 							'parent' => 'gravityview',
154 154
 							'title' => $edit_view_title,
155
-							'href'  => esc_url_raw( admin_url( sprintf( 'post.php?post=%d&action=edit', $view['id'] ) ) ),
155
+							'href'  => esc_url_raw( admin_url( sprintf( 'post.php?post=%d&action=edit', $view[ 'id' ] ) ) ),
156 156
 						) );
157 157
 					}
158 158
 
159
-					if ( ! empty( $view['form_id'] ) && GVCommon::has_cap( array( 'gravityforms_edit_forms' ), $view['form_id'] ) && ! in_array( $view['form_id'], $added_forms )  ) {
159
+					if ( ! empty( $view[ 'form_id' ] ) && GVCommon::has_cap( array( 'gravityforms_edit_forms' ), $view[ 'form_id' ] ) && ! in_array( $view[ 'form_id' ], $added_forms ) ) {
160 160
 
161
-						$added_forms[] = $view['form_id'];
161
+						$added_forms[ ] = $view[ 'form_id' ];
162 162
 
163 163
 						$wp_admin_bar->add_menu( array(
164
-							'id'    => 'edit-form-' . $view['form_id'],
164
+							'id'    => 'edit-form-' . $view[ 'form_id' ],
165 165
 							'parent' => 'gravityview',
166 166
 							'title' => $edit_form_title,
167
-							'href' => esc_url_raw( admin_url( sprintf( 'admin.php?page=gf_edit_forms&id=%d', $view['form_id'] ) ) ),
167
+							'href' => esc_url_raw( admin_url( sprintf( 'admin.php?page=gf_edit_forms&id=%d', $view[ 'form_id' ] ) ) ),
168 168
 						) );
169 169
 					}
170 170
 				}
Please login to merge, or discard this patch.
includes/admin/field-types/type_multiselect.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 		?>
9 9
 		<label for="<?php echo $this->get_field_id(); ?>" class="<?php echo $this->get_label_class(); ?>"><?php
10 10
 
11
-			echo '<span class="gv-label">'.$this->get_field_label().'</span>';
11
+			echo '<span class="gv-label">' . $this->get_field_label() . '</span>';
12 12
 
13 13
 			echo $this->get_tooltip() . $this->get_field_desc();
14 14
 
@@ -20,13 +20,13 @@  discard block
 block discarded – undo
20 20
 	}
21 21
 
22 22
 	function render_input( $override_input = null ) {
23
-		if( isset( $override_input ) ) {
23
+		if ( isset( $override_input ) ) {
24 24
 			echo $override_input;
25 25
 			return;
26 26
 		}
27 27
 		?>
28 28
 		<select name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>">
29
-			<?php foreach( $this->field['options'] as $value => $label ) : ?>
29
+			<?php foreach ( $this->field[ 'options' ] as $value => $label ) : ?>
30 30
 				<option value="<?php echo esc_attr( $value ); ?>" <?php selected( $value, $this->value, true ); ?>><?php echo esc_html( $label ); ?></option>
31 31
 			<?php endforeach; ?>
32 32
 		</select>
Please login to merge, or discard this patch.
includes/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/fields/class-gravityview-field-workflow_step.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -47,11 +47,11 @@  discard block
 block discarded – undo
47 47
 	function modify_entry_value_workflow_step( $output, $entry, $field_settings, $field ) {
48 48
 
49 49
 		// If not set, the entry hasn't started a workflow
50
-		$has_workflow_step = isset( $entry['workflow_step'] );
50
+		$has_workflow_step = isset( $entry[ 'workflow_step' ] );
51 51
 
52
-		if( $has_workflow_step ) {
52
+		if ( $has_workflow_step ) {
53 53
 
54
-			$GFlow = new Gravity_Flow_API( $entry['form_id'] );
54
+			$GFlow = new Gravity_Flow_API( $entry[ 'form_id' ] );
55 55
 
56 56
 			if ( $current_step = $GFlow->get_current_step( $entry ) ) {
57 57
 				$output = esc_html( $current_step->get_name() );
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 		preg_match( '/workflow_step_status_(\d+)/', $key, $matches );
80 80
 
81 81
 		if ( ! empty( $matches ) ) {
82
-			$workflow_step_id = intval( $matches[1] );
82
+			$workflow_step_id = intval( $matches[ 1 ] );
83 83
 		}
84 84
 
85 85
 		return $workflow_step_id;
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 
99 99
 		$return = $label;
100 100
 
101
-		if ( '' === $label && $workflow_step_id = $this->get_step_id_from_key( $field['field'] ) ) {
101
+		if ( '' === $label && $workflow_step_id = $this->get_step_id_from_key( $field[ 'field' ] ) ) {
102 102
 
103 103
 			$step = $this->get_workflow_step( $workflow_step_id );
104 104
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 
129 129
 		$workflow_step = $GFlow->get_step( $workflow_step_id );
130 130
 
131
-		if( ! $GFlow || ! $workflow_step ) {
131
+		if ( ! $GFlow || ! $workflow_step ) {
132 132
 			return false;
133 133
 		}
134 134
 
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 		
151 151
 		foreach ( $search_fields as & $search_field ) {
152 152
 
153
-			if ( $this->name === $search_field['key'] ) {
153
+			if ( $this->name === $search_field[ 'key' ] ) {
154 154
 
155 155
 				$form_id = GravityView_View::getInstance()->getFormId();
156 156
 
@@ -159,21 +159,21 @@  discard block
 block discarded – undo
159 159
 				$choices = array();
160 160
 
161 161
 				foreach ( $workflow_steps as $step ) {
162
-					$choices[] = array(
162
+					$choices[ ] = array(
163 163
 						'text'   => $step->get_name(),
164 164
 						'value'   => $step->get_id(),
165 165
 					);
166 166
 				}
167 167
 
168
-				$search_field['choices'] = $choices;
168
+				$search_field[ 'choices' ] = $choices;
169 169
 			}
170 170
 
171 171
 			// Workflow Step Statuses
172
-			else if ( $workflow_step_id = $this->get_step_id_from_key( $search_field['key'] ) ) {
172
+			else if ( $workflow_step_id = $this->get_step_id_from_key( $search_field[ 'key' ] ) ) {
173 173
 
174 174
 				$status_key = sprintf( 'workflow_step_status_%d', $workflow_step_id );
175 175
 
176
-				$search_field['choices'] = GravityView_Plugin_Hooks_Gravity_Flow::get_status_options( null, $status_key );
176
+				$search_field[ 'choices' ] = GravityView_Plugin_Hooks_Gravity_Flow::get_status_options( null, $status_key );
177 177
 			}
178 178
 		}
179 179
 		
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-workflow_final_status.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 */
42 42
 	function modify_entry_value_workflow_final_status( $output, $entry, $field_settings, $field ) {
43 43
 
44
-		if( ! empty( $output ) ) {
44
+		if ( ! empty( $output ) ) {
45 45
 			$output = gravity_flow()->translate_status_label( $output );
46 46
 		}
47 47
 
@@ -59,8 +59,8 @@  discard block
 block discarded – undo
59 59
 	function modify_search_filters( $search_fields = array(), GravityView_Widget_Search $widget, $widget_args = array() ) {
60 60
 
61 61
 		foreach ( $search_fields as & $search_field ) {
62
-			if ( $this->name === $search_field['key'] ) {
63
-				$search_field['choices'] = GravityView_Plugin_Hooks_Gravity_Flow::get_status_options();
62
+			if ( $this->name === $search_field[ 'key' ] ) {
63
+				$search_field[ 'choices' ] = GravityView_Plugin_Hooks_Gravity_Flow::get_status_options();
64 64
 			}
65 65
 		}
66 66
 
Please login to merge, or discard this patch.
plugin-and-theme-hooks/class-gravityview-plugin-hooks-gravity-flow.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 
34 34
 		parent::add_hooks();
35 35
 
36
-		add_filter( 'gravityview/search/searchable_fields', array( $this, 'modify_search_bar_fields_dropdown'), 10, 2 );
36
+		add_filter( 'gravityview/search/searchable_fields', array( $this, 'modify_search_bar_fields_dropdown' ), 10, 2 );
37 37
 
38 38
 	}
39 39
 	
@@ -52,13 +52,13 @@  discard block
 block discarded – undo
52 52
 	 */
53 53
 	public static function get_status_options( $form_id = 0, $status_key = 'workflow_final_status' ) {
54 54
 
55
-		if( empty( $form_id ) ) {
55
+		if ( empty( $form_id ) ) {
56 56
 			$form_id = GravityView_View::getInstance()->getFormId();
57 57
 		}
58 58
 
59 59
 		$entry_meta = gravity_flow()->get_entry_meta( array(), $form_id );
60 60
 
61
-		return (array) rgars( $entry_meta, $status_key . '/filter/choices' );
61
+		return (array)rgars( $entry_meta, $status_key . '/filter/choices' );
62 62
 	}
63 63
 
64 64
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 
81 81
 		$workflow_steps = $GFlow->get_steps();
82 82
 
83
-		if( $workflow_steps ) {
83
+		if ( $workflow_steps ) {
84 84
 
85 85
 			foreach ( $workflow_steps as $step ) {
86 86
 
@@ -92,12 +92,12 @@  discard block
 block discarded – undo
92 92
 				);
93 93
 			}
94 94
 
95
-			$fields['workflow_step'] = array(
95
+			$fields[ 'workflow_step' ] = array(
96 96
 				'label' => esc_html__( 'Workflow Step', 'gravityview' ),
97 97
 				'type'  => 'select',
98 98
 			);
99 99
 
100
-			$fields['workflow_final_status'] = array(
100
+			$fields[ 'workflow_final_status' ] = array(
101 101
 				'label' => esc_html__( 'Workflow Status', 'gravityview' ),
102 102
 				'type'  => 'select',
103 103
 			);
Please login to merge, or discard this patch.
includes/admin/class-gravityview-admin-view-item.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
 	function __construct( $title = '', $item_id, $item = array(), $settings = array() ) {
43 43
 
44 44
 		// Backward compat
45
-		if ( ! empty( $item['type'] ) ) {
46
-			$item['input_type'] = $item['type'];
47
-			unset( $item['type'] );
45
+		if ( ! empty( $item[ 'type' ] ) ) {
46
+			$item[ 'input_type' ] = $item[ 'type' ];
47
+			unset( $item[ 'type' ] );
48 48
 		}
49 49
 
50 50
 		// Prevent items from not having index set
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 		$this->item       = $item;
65 65
 		$this->id         = $item_id;
66 66
 		$this->settings   = $settings;
67
-		$this->label_type = $item['label_type'];
67
+		$this->label_type = $item[ 'label_type' ];
68 68
 	}
69 69
 
70 70
 	/**
@@ -107,10 +107,10 @@  discard block
 block discarded – undo
107 107
 		if ( $html ) {
108 108
 
109 109
 			foreach ( $field_info_items as $item ) {
110
-				$class = isset( $item['class'] ) ? sanitize_html_class( $item['class'] ) . ' description' : 'description';
110
+				$class = isset( $item[ 'class' ] ) ? sanitize_html_class( $item[ 'class' ] ) . ' description' : 'description';
111 111
 				// Add the title in case the value's long, in which case, it'll be truncated by CSS.
112 112
 				$output .= '<span class="' . $class . '">';
113
-				$output .= esc_html( $item['value'] );
113
+				$output .= esc_html( $item[ 'value' ] );
114 114
 				$output .= '</span>';
115 115
 			}
116 116
 
@@ -138,29 +138,29 @@  discard block
 block discarded – undo
138 138
 
139 139
 		// $settings_html will just be hidden inputs if empty. Otherwise, it'll have an <ul>. Ugly hack, I know.
140 140
 		// TODO: Un-hack this
141
-		$hide_settings_link = ( empty( $this->item['settings_html'] ) || strpos( $this->item['settings_html'], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : '';
141
+		$hide_settings_link = ( empty( $this->item[ 'settings_html' ] ) || strpos( $this->item[ 'settings_html' ], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : '';
142 142
 		$settings_link      = sprintf( '<a href="#settings" class="dashicons-admin-generic dashicons %s" title="%s"></a>', $hide_settings_link, esc_attr( $settings_title ) );
143 143
 
144 144
 		// Should we show the icon that the field is being used as a link to single entry?
145
-		$hide_show_as_link_class = empty( $this->settings['show_as_link'] ) ? 'hide-if-js' : '';
145
+		$hide_show_as_link_class = empty( $this->settings[ 'show_as_link' ] ) ? 'hide-if-js' : '';
146 146
 		$show_as_link            = '<span class="dashicons dashicons-admin-links ' . $hide_show_as_link_class . '" title="' . esc_attr( $single_link_title ) . '"></span>';
147 147
 
148 148
 		// When a field label is empty, use the Field ID
149 149
 		$label = empty( $this->title ) ? sprintf( _x( 'Field #%s (No Label)', 'Label in field picker for empty label', 'gravityview' ), $this->id ) : $this->title;
150 150
 
151 151
 		// If there's a custom label, and show label is checked, use that as the field heading
152
-		if ( ! empty( $this->settings['custom_label'] ) && ! empty( $this->settings['show_label'] ) ) {
153
-			$label = $this->settings['custom_label'];
154
-		} else if ( ! empty( $this->item['customLabel'] ) ) {
155
-			$label = $this->item['customLabel'];
152
+		if ( ! empty( $this->settings[ 'custom_label' ] ) && ! empty( $this->settings[ 'show_label' ] ) ) {
153
+			$label = $this->settings[ 'custom_label' ];
154
+		} else if ( ! empty( $this->item[ 'customLabel' ] ) ) {
155
+			$label = $this->item[ 'customLabel' ];
156 156
 		}
157 157
 
158 158
 		$output = '<h5 class="selectable gfield field-id-' . esc_attr( $this->id ) . '">';
159 159
 
160 160
 		$label = esc_attr( $label );
161 161
 
162
-		if ( ! empty( $this->item['parent'] ) ) {
163
-			$label .= ' <small>(' . esc_attr( $this->item['parent']['label'] ) . ')</small>';
162
+		if ( ! empty( $this->item[ 'parent' ] ) ) {
163
+			$label .= ' <small>(' . esc_attr( $this->item[ 'parent' ][ 'label' ] ) . ')</small>';
164 164
 		}
165 165
 
166 166
 		// Name of field / widget
@@ -176,9 +176,9 @@  discard block
 block discarded – undo
176 176
 
177 177
 		$output .= '</h5>';
178 178
 
179
-		$container_class = ! empty( $this->item['parent'] ) ? ' gv-child-field' : '';
179
+		$container_class = ! empty( $this->item[ 'parent' ] ) ? ' gv-child-field' : '';
180 180
 
181
-		$output = '<div data-fieldid="' . esc_attr( $this->id ) . '" data-inputtype="' . esc_attr( $this->item['input_type'] ) . '" class="gv-fields' . $container_class . '">' . $output . $this->item['settings_html'] . '</div>';
181
+		$output = '<div data-fieldid="' . esc_attr( $this->id ) . '" data-inputtype="' . esc_attr( $this->item[ 'input_type' ] ) . '" class="gv-fields' . $container_class . '">' . $output . $this->item[ 'settings_html' ] . '</div>';
182 182
 
183 183
 		return $output;
184 184
 	}
Please login to merge, or discard this patch.
plugin-and-theme-hooks/class-gravityview-plugin-hooks-gravity-perks.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
 	function edit_entry_fix_hidden_fields( $fields ) {
48 48
 
49 49
 		/** @var GF_Field $field */
50
-		foreach( $fields as &$field ) {
50
+		foreach ( $fields as &$field ) {
51 51
 			if ( 'hidden' === $field->type ) {
52 52
 
53 53
 				// Replace GF_Field_Hidden with GF_Field_Text, copying all the data from $field
Please login to merge, or discard this patch.