Completed
Pull Request — master (#1205)
by Zack
03:40
created
includes/admin/class-gravityview-admin-view-field.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -15,34 +15,34 @@
 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
-		if( !empty( $this->item['desc'] ) ) {
32
-			$field_info_items[] = array(
33
-				'value' => $this->item['desc']
31
+		if ( ! empty( $this->item[ 'desc' ] ) ) {
32
+			$field_info_items[ ] = array(
33
+				'value' => $this->item[ 'desc' ]
34 34
 			);
35 35
 		}
36 36
 
37
-		if( !empty( $this->item['adminLabel'] ) ) {
38
-			$field_info_items[] = array(
39
-				'value' => sprintf( __('Admin Label: %s', 'gravityview' ), $this->item['adminLabel'] ),
37
+		if ( ! empty( $this->item[ 'adminLabel' ] ) ) {
38
+			$field_info_items[ ] = array(
39
+				'value' => sprintf( __( 'Admin Label: %s', 'gravityview' ), $this->item[ 'adminLabel' ] ),
40 40
 				'class'	=> 'gv-sublabel'
41 41
 			);
42 42
 		}
43 43
 
44
-		$field_info_items[] = array(
45
-			'value'          => sprintf( __('Form ID: %s', 'gravityview' ), $this->form_id ),
44
+		$field_info_items[ ] = array(
45
+			'value'          => sprintf( __( 'Form ID: %s', 'gravityview' ), $this->form_id ),
46 46
 			'hide_in_picker' => true,
47 47
 		);
48 48
 
Please login to merge, or discard this patch.
includes/admin/class-gravityview-admin-view-item.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -44,12 +44,12 @@  discard block
 block discarded – undo
44 44
 	 */
45 45
 	protected $form_id;
46 46
 
47
-	function __construct( $title = '', $item_id, $item = array(), $settings = array(), $form_id = null) {
47
+	function __construct( $title = '', $item_id, $item = array(), $settings = array(), $form_id = null ) {
48 48
 
49 49
 		// Backward compat
50
-		if ( ! empty( $item['type'] ) ) {
51
-			$item['input_type'] = $item['type'];
52
-			unset( $item['type'] );
50
+		if ( ! empty( $item[ 'type' ] ) ) {
51
+			$item[ 'input_type' ] = $item[ 'type' ];
52
+			unset( $item[ 'type' ] );
53 53
 		}
54 54
 
55 55
 		// Prevent items from not having index set
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 		$this->id         = $item_id;
72 72
 		$this->form_id    = $form_id;
73 73
 		$this->settings   = $settings;
74
-		$this->label_type = $item['label_type'];
74
+		$this->label_type = $item[ 'label_type' ];
75 75
 	}
76 76
 
77 77
 	/**
@@ -115,14 +115,14 @@  discard block
 block discarded – undo
115 115
 
116 116
 			foreach ( $field_info_items as $item ) {
117 117
 
118
-				if( \GV\Utils::get( $item, 'hide_in_picker', false ) ) {
118
+				if ( \GV\Utils::get( $item, 'hide_in_picker', false ) ) {
119 119
 					continue;
120 120
 				}
121 121
 
122
-				$class = isset( $item['class'] ) ? sanitize_html_class( $item['class'] ) . ' description' : 'description';
122
+				$class = isset( $item[ 'class' ] ) ? sanitize_html_class( $item[ 'class' ] ) . ' description' : 'description';
123 123
 				// Add the title in case the value's long, in which case, it'll be truncated by CSS.
124 124
 				$output .= '<span class="' . $class . '">';
125
-				$output .= esc_html( $item['value'] );
125
+				$output .= esc_html( $item[ 'value' ] );
126 126
 				$output .= '</span>';
127 127
 			}
128 128
 
@@ -150,29 +150,29 @@  discard block
 block discarded – undo
150 150
 
151 151
 		// $settings_html will just be hidden inputs if empty. Otherwise, it'll have an <ul>. Ugly hack, I know.
152 152
 		// TODO: Un-hack this
153
-		$hide_settings_link = ( empty( $this->item['settings_html'] ) || strpos( $this->item['settings_html'], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : '';
153
+		$hide_settings_link = ( empty( $this->item[ 'settings_html' ] ) || strpos( $this->item[ 'settings_html' ], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : '';
154 154
 		$settings_link      = sprintf( '<a href="#settings" class="dashicons-admin-generic dashicons %s" title="%s"></a>', $hide_settings_link, esc_attr( $settings_title ) );
155 155
 
156 156
 		// Should we show the icon that the field is being used as a link to single entry?
157
-		$hide_show_as_link_class = empty( $this->settings['show_as_link'] ) ? 'hide-if-js' : '';
157
+		$hide_show_as_link_class = empty( $this->settings[ 'show_as_link' ] ) ? 'hide-if-js' : '';
158 158
 		$show_as_link            = '<span class="dashicons dashicons-admin-links ' . $hide_show_as_link_class . '" title="' . esc_attr( $single_link_title ) . '"></span>';
159 159
 
160 160
 		// When a field label is empty, use the Field ID
161 161
 		$label = empty( $this->title ) ? sprintf( _x( 'Field #%s (No Label)', 'Label in field picker for empty label', 'gravityview' ), $this->id ) : $this->title;
162 162
 
163 163
 		// If there's a custom label, and show label is checked, use that as the field heading
164
-		if ( ! empty( $this->settings['custom_label'] ) && ! empty( $this->settings['show_label'] ) ) {
165
-			$label = $this->settings['custom_label'];
166
-		} else if ( ! empty( $this->item['customLabel'] ) ) {
167
-			$label = $this->item['customLabel'];
164
+		if ( ! empty( $this->settings[ 'custom_label' ] ) && ! empty( $this->settings[ 'show_label' ] ) ) {
165
+			$label = $this->settings[ 'custom_label' ];
166
+		} else if ( ! empty( $this->item[ 'customLabel' ] ) ) {
167
+			$label = $this->item[ 'customLabel' ];
168 168
 		}
169 169
 
170 170
 		$output = '<h5 class="selectable gfield field-id-' . esc_attr( $this->id ) . '">';
171 171
 
172 172
 		$label = esc_attr( $label );
173 173
 
174
-		if ( ! empty( $this->item['parent'] ) ) {
175
-			$label .= ' <small>(' . esc_attr( $this->item['parent']['label'] ) . ')</small>';
174
+		if ( ! empty( $this->item[ 'parent' ] ) ) {
175
+			$label .= ' <small>(' . esc_attr( $this->item[ 'parent' ][ 'label' ] ) . ')</small>';
176 176
 		}
177 177
 
178 178
 		// Name of field / widget
@@ -188,10 +188,10 @@  discard block
 block discarded – undo
188 188
 
189 189
 		$output .= '</h5>';
190 190
 
191
-		$container_class = ! empty( $this->item['parent'] ) ? ' gv-child-field' : '';
192
-		$data_form_id   = ! empty( $this->form_id ) ? 'data-formid="' . esc_attr( $this->form_id ) . '"' : '';
191
+		$container_class = ! empty( $this->item[ 'parent' ] ) ? ' gv-child-field' : '';
192
+		$data_form_id = ! empty( $this->form_id ) ? 'data-formid="' . esc_attr( $this->form_id ) . '"' : '';
193 193
 
194
-		$output = '<div data-fieldid="' . esc_attr( $this->id ) . '" ' . $data_form_id . ' data-inputtype="' . esc_attr( $this->item['input_type'] ) . '" class="gv-fields' . $container_class . '">' . $output . $this->item['settings_html'] . '</div>';
194
+		$output = '<div data-fieldid="' . esc_attr( $this->id ) . '" ' . $data_form_id . ' data-inputtype="' . esc_attr( $this->item[ 'input_type' ] ) . '" class="gv-fields' . $container_class . '">' . $output . $this->item[ 'settings_html' ] . '</div>';
195 195
 
196 196
 		return $output;
197 197
 	}
Please login to merge, or discard this patch.
future/includes/class-gv-template-entry-table.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	 */
27 27
 	public function the_field( \GV\Field $field ) {
28 28
 		$renderer = new Field_Renderer();
29
-		$source = is_numeric( $field->ID ) ? ( GF_Form::by_id( $field->form_id ) ? : $this->view->form ) : new Internal_Source();
29
+		$source = is_numeric( $field->ID ) ? ( GF_Form::by_id( $field->form_id ) ?: $this->view->form ) : new Internal_Source();
30 30
 
31 31
 		return $renderer->render( $field, $this->view, $source, $this->entry->from_field( $field ), $this->request );
32 32
 	}
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 		foreach ( $fields->all() as $field ) {
64 64
 			$context = Template_Context::from_template( $this, compact( 'field' ) );
65 65
 
66
-			$form = \GV\GF_Form::by_id( $field->form_id ) ? : $this->view->form;
66
+			$form = \GV\GF_Form::by_id( $field->form_id ) ?: $this->view->form;
67 67
 			$entry = $this->entry->from_field( $field );
68 68
 
69 69
 			/**
Please login to merge, or discard this patch.
future/includes/class-gv-renderer-entry.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -58,16 +58,16 @@
 block discarded – undo
58 58
 		if ( $view->joins ) {
59 59
 			$form_ids = array();
60 60
 			foreach ( $view->joins as $join ) {
61
-				$form_ids[] = $join->join->ID;
62
-				$form_ids[] = $join->join_on->ID;
61
+				$form_ids[ ] = $join->join->ID;
62
+				$form_ids[ ] = $join->join_on->ID;
63 63
 			}
64 64
 			foreach ( $entry->entries as $e ) {
65
-				if ( ! in_array( $e['form_id'], $form_ids ) ) {
65
+				if ( ! in_array( $e[ 'form_id' ], $form_ids ) ) {
66 66
 					gravityview()->log->error( 'The requested entry does not belong to this View. Entry #{entry_id}, #View {view_id}', array( 'entry_id' => $e->ID, 'view_id' => $view->ID ) );
67 67
 					return null;
68 68
 				}
69 69
 			}
70
-		} else if ( $view->form && $view->form->ID != $entry['form_id'] ) {
70
+		} else if ( $view->form && $view->form->ID != $entry[ 'form_id' ] ) {
71 71
 			gravityview()->log->error( 'The requested entry does not belong to this View. Entry #{entry_id}, #View {view_id}', array( 'entry_id' => $entry->ID, 'view_id' => $view->ID ) );
72 72
 			return null;
73 73
 		}
Please login to merge, or discard this patch.
future/includes/class-gv-entry-multi.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 			if ( ! $entry instanceof Entry ) {
45 45
 				continue;
46 46
 			}
47
-			$_entry->entries[ $entry['form_id'] ]  = &$entry;
47
+			$_entry->entries[ $entry[ 'form_id' ] ] = &$entry;
48 48
 		}
49 49
 		return $_entry;
50 50
 	}
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 
66 66
 			foreach ( $this->entries as $entry ) {
67 67
 				$entry = $entry->as_entry();
68
-				$_entry['_multi'][ $entry['form_id'] ] = $entry;
68
+				$_entry[ '_multi' ][ $entry[ 'form_id' ] ] = $entry;
69 69
 			}
70 70
 		}
71 71
 
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	public function get_permalink( \GV\View $view = null, \GV\Request $request = null, $track_directory = true ) {
88 88
 		$slugs = array();
89 89
 		add_filter( 'gravityview/entry/slug', $callback = function( $slug ) use ( &$slugs ) {
90
-			$slugs[] = $slug;
90
+			$slugs[ ] = $slug;
91 91
 			return implode( ',', $slugs );
92 92
 		}, 10, 1 );
93 93
 
Please login to merge, or discard this patch.
future/includes/class-gv-template-entry-list.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -26,11 +26,11 @@  discard block
 block discarded – undo
26 26
 	 * @return string
27 27
 	 */
28 28
 	public function the_field( \GV\Field $field, $extras = null ) {
29
-		$form = \GV\GF_Form::by_id( $field->form_id ) ? : $this->view->form;
29
+		$form = \GV\GF_Form::by_id( $field->form_id ) ?: $this->view->form;
30 30
 		$entry = $this->entry->from_field( $field );
31 31
 
32 32
 		$renderer = new Field_Renderer();
33
-		$source = is_numeric( $field->ID ) ? ( GF_Form::by_id( $field->form_id ) ? : $this->view->form ) : new Internal_Source();
33
+		$source = is_numeric( $field->ID ) ? ( GF_Form::by_id( $field->form_id ) ?: $this->view->form ) : new Internal_Source();
34 34
 		
35 35
 		$value = $renderer->render( $field, $this->view, $source, $entry, $this->request );
36 36
 		
@@ -58,13 +58,13 @@  discard block
 block discarded – undo
58 58
 		$hide_empty = apply_filters( 'gravityview/render/hide-empty-zone', Utils::get( $extras, 'hide_empty', $this->view->settings->get( 'hide_empty', false ) ), $context );
59 59
 
60 60
 		if ( is_numeric( $field->ID ) ) {
61
-			$extras['field'] = $field->as_configuration();
61
+			$extras[ 'field' ] = $field->as_configuration();
62 62
 		}
63 63
 
64
-		$extras['entry'] = $this->entry->as_entry();
65
-		$extras['hide_empty'] = $hide_empty;
66
-		$extras['label'] = $label;
67
-		$extras['value'] = $value;
64
+		$extras[ 'entry' ] = $this->entry->as_entry();
65
+		$extras[ 'hide_empty' ] = $hide_empty;
66
+		$extras[ 'label' ] = $label;
67
+		$extras[ 'value' ] = $value;
68 68
 
69 69
 		return \gravityview_field_output( $extras, $context );
70 70
 	}
Please login to merge, or discard this patch.
future/includes/class-gv-request.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	 */
46 46
 	public static function is_add_oembed_preview() {
47 47
 		/** The preview request is a parse-embed AJAX call without a type set. */
48
-		return ( self::is_ajax() && ! empty( $_POST['action'] ) && $_POST['action'] == 'parse-embed' && ! isset( $_POST['type'] ) );
48
+		return ( self::is_ajax() && ! empty( $_POST[ 'action' ] ) && $_POST[ 'action' ] == 'parse-embed' && ! isset( $_POST[ 'type' ] ) );
49 49
 	}
50 50
 
51 51
 	/**
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 * @return boolean
64 64
 	 */
65 65
 	public static function is_rest() {
66
-		return ! empty( $GLOBALS['wp']->query_vars['rest_route'] );
66
+		return ! empty( $GLOBALS[ 'wp' ]->query_vars[ 'rest_route' ] );
67 67
 	}
68 68
 
69 69
 	/**
@@ -119,11 +119,11 @@  discard block
 block discarded – undo
119 119
 						return false;
120 120
 					}
121 121
 
122
-					if ( ! in_array( $e['form_id'], $valid_forms ) ) {
122
+					if ( ! in_array( $e[ 'form_id' ], $valid_forms ) ) {
123 123
 						return false;
124 124
 					}
125 125
 
126
-					unset( $needs_forms[ $e['form_id'] ] );
126
+					unset( $needs_forms[ $e[ 'form_id' ] ] );
127 127
 
128 128
 					array_push( $multientry, $e );
129 129
 				}
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 				}
141 141
 
142 142
 				$entry = Multi_Entry::from_entries( array_filter( $multientry ) );
143
-			}  else {
143
+			} else {
144 144
 				/**
145 145
 				 * A regular one.
146 146
 				 */
@@ -195,15 +195,15 @@  discard block
 block discarded – undo
195 195
 			$get = $_GET;
196 196
 		}
197 197
 
198
-		unset( $get['mode'] );
198
+		unset( $get[ 'mode' ] );
199 199
 
200 200
 		$get = array_filter( $get, 'gravityview_is_not_empty_string' );
201 201
 
202
-		if( $has_field_key = $this->_has_field_key( $get ) ) {
202
+		if ( $has_field_key = $this->_has_field_key( $get ) ) {
203 203
 			return true;
204 204
 		}
205 205
 
206
-		return isset( $get['gv_search'] ) || isset( $get['gv_start'] ) || isset( $get['gv_end'] ) || isset( $get['gv_by'] ) || isset( $get['gv_id'] );
206
+		return isset( $get[ 'gv_search' ] ) || isset( $get[ 'gv_start' ] ) || isset( $get[ 'gv_end' ] ) || isset( $get[ 'gv_by' ] ) || isset( $get[ 'gv_id' ] );
207 207
 	}
208 208
 
209 209
 	/**
@@ -226,13 +226,13 @@  discard block
 block discarded – undo
226 226
 
227 227
 		$meta = array();
228 228
 		foreach ( $fields as $field ) {
229
-			if( empty( $field->_gf_field_class_name ) ) {
230
-				$meta[] = preg_quote( $field->name );
229
+			if ( empty( $field->_gf_field_class_name ) ) {
230
+				$meta[ ] = preg_quote( $field->name );
231 231
 			}
232 232
 		}
233 233
 
234 234
 		foreach ( $get as $key => $value ) {
235
-			if ( preg_match('/^filter_(([0-9_]+)|'. implode( '|', $meta ) .')$/sm', $key ) ) {
235
+			if ( preg_match( '/^filter_(([0-9_]+)|' . implode( '|', $meta ) . ')$/sm', $key ) ) {
236 236
 				$has_field_key = true;
237 237
 				break;
238 238
 			}
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -140,7 +140,7 @@
 block discarded – undo
140 140
 				}
141 141
 
142 142
 				$entry = Multi_Entry::from_entries( array_filter( $multientry ) );
143
-			}  else {
143
+			} else {
144 144
 				/**
145 145
 				 * A regular one.
146 146
 				 */
Please login to merge, or discard this patch.
future/includes/class-gv-template-field.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 	}
93 93
 
94 94
 	public function __destruct() {
95
-		remove_filter( $this->filter_prefix . '_get_template_part', $this->_add_id_specific_templates_callback );;
95
+		remove_filter( $this->filter_prefix . '_get_template_part', $this->_add_id_specific_templates_callback ); ;
96 96
 	}
97 97
 
98 98
 	/**
@@ -175,55 +175,55 @@  discard block
 block discarded – undo
175 175
 
176 176
 			if ( $is_view && $post ) {
177 177
 				if ( $field_type ) {
178
-					$specifics []= sprintf( '%spost-%d-view-%d-field-%s-%s.php', $slug_dir, $post->ID, $view_id, $field_type, $slug_name );
179
-					$inputType && $specifics []= sprintf( '%spost-%d-view-%d-field-%s-%s.php', $slug_dir, $post->ID, $view_id, $inputType, $slug_name );
180
-					$specifics []= sprintf( '%spost-%d-view-%d-field-%s.php', $slug_dir, $post->ID, $view_id, $field_type );
181
-					$inputType && $specifics []= sprintf( '%spost-%d-view-%d-field-%s.php', $slug_dir, $post->ID, $view_id, $inputType );
182
-					$specifics []= sprintf( '%spost-%d-field-%s-%s.php', $slug_dir, $post->ID, $field_type, $slug_name );
183
-					$inputType && $specifics []= sprintf( '%spost-%d-field-%s-%s.php', $slug_dir, $post->ID, $inputType, $slug_name );
184
-					$specifics []= sprintf( '%spost-%d-field-%s.php', $slug_dir, $post->ID, $field_type );
185
-					$inputType &&  $specifics []= sprintf( '%spost-%d-field-%s.php', $slug_dir, $post->ID, $inputType );
178
+					$specifics [ ] = sprintf( '%spost-%d-view-%d-field-%s-%s.php', $slug_dir, $post->ID, $view_id, $field_type, $slug_name );
179
+					$inputType && $specifics [ ] = sprintf( '%spost-%d-view-%d-field-%s-%s.php', $slug_dir, $post->ID, $view_id, $inputType, $slug_name );
180
+					$specifics [ ] = sprintf( '%spost-%d-view-%d-field-%s.php', $slug_dir, $post->ID, $view_id, $field_type );
181
+					$inputType && $specifics [ ] = sprintf( '%spost-%d-view-%d-field-%s.php', $slug_dir, $post->ID, $view_id, $inputType );
182
+					$specifics [ ] = sprintf( '%spost-%d-field-%s-%s.php', $slug_dir, $post->ID, $field_type, $slug_name );
183
+					$inputType && $specifics [ ] = sprintf( '%spost-%d-field-%s-%s.php', $slug_dir, $post->ID, $inputType, $slug_name );
184
+					$specifics [ ] = sprintf( '%spost-%d-field-%s.php', $slug_dir, $post->ID, $field_type );
185
+					$inputType && $specifics [ ] = sprintf( '%spost-%d-field-%s.php', $slug_dir, $post->ID, $inputType );
186 186
 				}
187 187
 
188
-				$specifics []= sprintf( '%spost-%d-view-%d-field-%s.php', $slug_dir, $post->ID, $view_id, $slug_name );
189
-				$specifics []= sprintf( '%spost-%d-view-%d-field.php', $slug_dir, $post->ID, $view_id );
190
-				$specifics []= sprintf( '%spost-%d-field-%s.php', $slug_dir, $post->ID, $slug_name );
191
-				$specifics []= sprintf( '%spost-%d-field.php', $slug_dir, $post->ID );
188
+				$specifics [ ] = sprintf( '%spost-%d-view-%d-field-%s.php', $slug_dir, $post->ID, $view_id, $slug_name );
189
+				$specifics [ ] = sprintf( '%spost-%d-view-%d-field.php', $slug_dir, $post->ID, $view_id );
190
+				$specifics [ ] = sprintf( '%spost-%d-field-%s.php', $slug_dir, $post->ID, $slug_name );
191
+				$specifics [ ] = sprintf( '%spost-%d-field.php', $slug_dir, $post->ID );
192 192
 			}
193 193
 			
194 194
 			/** Field-specific */
195 195
 			if ( $field_id && $form_id ) {
196 196
 
197 197
 				if ( $field_id ) {
198
-					$specifics []= sprintf( '%sform-%d-field-%d-%s.php', $slug_dir, $form_id, $field_id, $slug_name );
199
-					$specifics []= sprintf( '%sform-%d-field-%d.php', $slug_dir, $form_id, $field_id );
198
+					$specifics [ ] = sprintf( '%sform-%d-field-%d-%s.php', $slug_dir, $form_id, $field_id, $slug_name );
199
+					$specifics [ ] = sprintf( '%sform-%d-field-%d.php', $slug_dir, $form_id, $field_id );
200 200
 				}
201 201
 
202 202
 				if ( $field_type ) {
203
-					$specifics []= sprintf( '%sform-%d-field-%s-%s.php', $slug_dir, $form_id, $field_type, $slug_name );
204
-					$inputType && $specifics []= sprintf( '%sform-%d-field-%s-%s.php', $slug_dir, $form_id, $inputType, $slug_name );
205
-					$specifics []= sprintf( '%sform-%d-field-%s.php', $slug_dir, $form_id, $field_type );
206
-					$inputType && $specifics []= sprintf( '%sform-%d-field-%s.php', $slug_dir, $form_id, $inputType );
207
-
208
-					$specifics []= sprintf( '%sview-%d-field-%s-%s.php', $slug_dir, $view_id, $field_type, $slug_name );
209
-					$inputType && $specifics []= sprintf( '%sview-%d-field-%s-%s.php', $slug_dir, $view_id, $inputType, $slug_name );
210
-					$specifics []= sprintf( '%sview-%d-field-%s.php', $slug_dir, $view_id, $field_type );
211
-					$inputType && $specifics []= sprintf( '%sview-%d-field-%s.php', $slug_dir, $view_id, $inputType );
212
-
213
-					$specifics []= sprintf( '%sfield-%s-%s.php', $slug_dir, $field_type, $slug_name );
214
-					$inputType && $specifics []= sprintf( '%sfield-%s-%s.php', $slug_dir, $inputType, $slug_name );
215
-					$specifics []= sprintf( '%sfield-%s.php', $slug_dir, $field_type );
216
-					$inputType && $specifics []= sprintf( '%sfield-%s.php', $slug_dir, $inputType );
203
+					$specifics [ ] = sprintf( '%sform-%d-field-%s-%s.php', $slug_dir, $form_id, $field_type, $slug_name );
204
+					$inputType && $specifics [ ] = sprintf( '%sform-%d-field-%s-%s.php', $slug_dir, $form_id, $inputType, $slug_name );
205
+					$specifics [ ] = sprintf( '%sform-%d-field-%s.php', $slug_dir, $form_id, $field_type );
206
+					$inputType && $specifics [ ] = sprintf( '%sform-%d-field-%s.php', $slug_dir, $form_id, $inputType );
207
+
208
+					$specifics [ ] = sprintf( '%sview-%d-field-%s-%s.php', $slug_dir, $view_id, $field_type, $slug_name );
209
+					$inputType && $specifics [ ] = sprintf( '%sview-%d-field-%s-%s.php', $slug_dir, $view_id, $inputType, $slug_name );
210
+					$specifics [ ] = sprintf( '%sview-%d-field-%s.php', $slug_dir, $view_id, $field_type );
211
+					$inputType && $specifics [ ] = sprintf( '%sview-%d-field-%s.php', $slug_dir, $view_id, $inputType );
212
+
213
+					$specifics [ ] = sprintf( '%sfield-%s-%s.php', $slug_dir, $field_type, $slug_name );
214
+					$inputType && $specifics [ ] = sprintf( '%sfield-%s-%s.php', $slug_dir, $inputType, $slug_name );
215
+					$specifics [ ] = sprintf( '%sfield-%s.php', $slug_dir, $field_type );
216
+					$inputType && $specifics [ ] = sprintf( '%sfield-%s.php', $slug_dir, $inputType );
217 217
 				}
218 218
 			}
219 219
 
220 220
 			if ( $form_id ) {
221 221
 				/** Generic field templates */
222
-				$specifics []= sprintf( '%sview-%d-field-%s.php', $slug_dir, $view_id, $slug_name );
223
-				$specifics []= sprintf( '%sform-%d-field-%s.php', $slug_dir, $form_id, $slug_name );
222
+				$specifics [ ] = sprintf( '%sview-%d-field-%s.php', $slug_dir, $view_id, $slug_name );
223
+				$specifics [ ] = sprintf( '%sform-%d-field-%s.php', $slug_dir, $form_id, $slug_name );
224 224
 
225
-				$specifics []= sprintf( '%sview-%d-field.php', $slug_dir, $view_id );
226
-				$specifics []= sprintf( '%sform-%d-field.php', $slug_dir, $form_id );
225
+				$specifics [ ] = sprintf( '%sview-%d-field.php', $slug_dir, $view_id );
226
+				$specifics [ ] = sprintf( '%sform-%d-field.php', $slug_dir, $form_id );
227 227
 			}
228 228
 
229 229
 			/**
@@ -231,12 +231,12 @@  discard block
 block discarded – undo
231 231
 			 * Ignore some types that conflict.
232 232
 			 */
233 233
 			if ( ! in_array( $field_type, array( 'notes' ) ) ) {
234
-				$specifics []= sprintf( '%s.php', $field_type );
235
-				$specifics []= sprintf( 'fields/%s.php', $field_type );
234
+				$specifics [ ] = sprintf( '%s.php', $field_type );
235
+				$specifics [ ] = sprintf( 'fields/%s.php', $field_type );
236 236
 			}
237 237
 
238
-			$specifics []= sprintf( '%sfield-%s.php', $slug_dir, $slug_name );
239
-			$specifics []= sprintf( '%sfield.php', $slug_dir );
238
+			$specifics [ ] = sprintf( '%sfield-%s.php', $slug_dir, $slug_name );
239
+			$specifics [ ] = sprintf( '%sfield.php', $slug_dir );
240 240
 
241 241
 			return array_merge( $specifics, $templates );
242 242
 		};
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 			/** Prevent any PHP warnings that may be generated. */
268 268
 			ob_start();
269 269
 
270
-			$display_value = \GFCommon::get_lead_field_display( $this->field->field, $value, $entry['currency'], false, 'html' );
270
+			$display_value = \GFCommon::get_lead_field_display( $this->field->field, $value, $entry[ 'currency' ], false, 'html' );
271 271
 
272 272
 			if ( $errors = ob_get_clean() ) {
273 273
 				gravityview()->log->error( 'Errors when calling GFCommon::get_lead_field_display()', array( 'data' => $errors ) );
Please login to merge, or discard this patch.
future/includes/class-gv-view.php 1 patch
Spacing   +28 added lines, -29 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 		$supports = array( 'title', 'revisions' );
109 109
 
110 110
 		if ( $is_hierarchical ) {
111
-			$supports[] = 'page-attributes';
111
+			$supports[ ] = 'page-attributes';
112 112
 		}
113 113
 
114 114
 		/**
@@ -210,11 +210,11 @@  discard block
 block discarded – undo
210 210
 		$rule = array( sprintf( '%s/([^/]+)/csv/?', $slug ), 'index.php?gravityview=$matches[1]&csv=1', 'top' );
211 211
 
212 212
 		add_filter( 'query_vars', function( $query_vars ) { 
213
-			$query_vars[] = 'csv';
213
+			$query_vars[ ] = 'csv';
214 214
 			return $query_vars;
215 215
 		} );
216 216
 
217
-		if ( ! isset( $wp_rewrite->extra_rules_top[ $rule[0] ] ) ) {
217
+		if ( ! isset( $wp_rewrite->extra_rules_top[ $rule[ 0 ] ] ) ) {
218 218
 			call_user_func_array( 'add_rewrite_rule', $rule );
219 219
 		}
220 220
 	}
@@ -283,13 +283,13 @@  discard block
 block discarded – undo
283 283
 			return $content;
284 284
 		}
285 285
 
286
-		$is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap('gravityview_moderate_entries', $view->ID );
286
+		$is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap( 'gravityview_moderate_entries', $view->ID );
287 287
 
288 288
 		/**
289 289
 		 * Editing a single entry.
290 290
 		 */
291 291
 		if ( $entry = $request->is_edit_entry( $view->form ? $view->form->ID : 0 ) ) {
292
-			if ( $entry['status'] != 'active' ) {
292
+			if ( $entry[ 'status' ] != 'active' ) {
293 293
 				gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) );
294 294
 				return __( 'You are not allowed to view this content.', 'gravityview' );
295 295
 			}
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 			}
301 301
 
302 302
 			if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) {
303
-				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) )  ) {
303
+				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) {
304 304
 					gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) );
305 305
 					return __( 'You are not allowed to view this content.', 'gravityview' );
306 306
 				}
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 
324 324
 			foreach ( $entryset as $e ) {
325 325
 
326
-				if ( 'active' !== $e['status'] ) {
326
+				if ( 'active' !== $e[ 'status' ] ) {
327 327
 					gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $e->ID ) );
328 328
 					return __( 'You are not allowed to view this content.', 'gravityview' );
329 329
 				}
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 				}
335 335
 
336 336
 				if ( $show_only_approved && ! $is_admin_and_can_view ) {
337
-					if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $e->ID, \GravityView_Entry_Approval::meta_key ) )  ) {
337
+					if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $e->ID, \GravityView_Entry_Approval::meta_key ) ) ) {
338 338
 						gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $e->ID ) );
339 339
 						return __( 'You are not allowed to view this content.', 'gravityview' );
340 340
 					}
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
 			$join_column    = is_numeric( $join_column ) ? GF_Field::by_id( $join, $join_column ) : Internal_Field::by_id( $join_column );
510 510
 			$join_on_column = is_numeric( $join_on_column ) ? GF_Field::by_id( $join_on, $join_on_column ) : Internal_Field::by_id( $join_on_column );
511 511
 
512
-			$joins [] = new Join( $join, $join_column, $join_on, $join_on_column );
512
+			$joins [ ] = new Join( $join, $join_column, $join_on, $join_on_column );
513 513
 		}
514 514
 
515 515
 		return $joins;
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
 
557 557
 			list( $join, $join_column, $join_on, $join_on_column ) = $meta;
558 558
 
559
-			$forms[] = GF_Form::by_id( $join_on );
559
+			$forms[ ] = GF_Form::by_id( $join_on );
560 560
 		}
561 561
 
562 562
 		return $forms;
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
 		if ( ! $view->form ) {
598 598
 			gravityview()->log->error( 'View #{view_id} tried attaching non-existent Form #{form_id} to it.', array(
599 599
 				'view_id' => $view->ID,
600
-				'form_id' => $view->_gravityview_form_id ? : 0,
600
+				'form_id' => $view->_gravityview_form_id ?: 0,
601 601
 			) );
602 602
 		}
603 603
 
@@ -830,34 +830,33 @@  discard block
 block discarded – undo
830 830
 			 * @todo: Stop using _frontend and use something like $request->get_search_criteria() instead
831 831
 			 */
832 832
 			$parameters = \GravityView_frontend::get_view_entries_parameters( $this->settings->as_atts(), $this->form->ID );
833
-			$parameters['context_view_id'] = $this->ID;
833
+			$parameters[ 'context_view_id' ] = $this->ID;
834 834
 			$parameters = \GVCommon::calculate_get_entries_criteria( $parameters, $this->form->ID );
835 835
 
836 836
 			if ( $request instanceof REST\Request ) {
837 837
 				$atts = $this->settings->as_atts();
838 838
 				$paging_parameters = wp_parse_args( $request->get_paging(), array(
839
-						'paging' => array( 'page_size' => $atts['page_size'] ),
839
+						'paging' => array( 'page_size' => $atts[ 'page_size' ] ),
840 840
 					) );
841
-				$parameters['paging'] = $paging_parameters['paging'];
841
+				$parameters[ 'paging' ] = $paging_parameters[ 'paging' ];
842 842
 			}
843 843
 
844
-			$page = Utils::get( $parameters['paging'], 'current_page' ) ?
845
-				: ( ( ( $parameters['paging']['offset'] - $this->settings->get( 'offset' ) ) / $parameters['paging']['page_size'] ) + 1 );
844
+			$page = Utils::get( $parameters[ 'paging' ], 'current_page' ) ?: ( ( ( $parameters[ 'paging' ][ 'offset' ] - $this->settings->get( 'offset' ) ) / $parameters[ 'paging' ][ 'page_size' ] ) + 1 );
846 845
 
847 846
 			/**
848 847
 			 * Cleanup duplicate field_filter parameters to simplify the query.
849 848
 			 */
850 849
 			$unique_field_filters = array();
851
-			foreach ( $parameters['search_criteria']['field_filters'] as $key => $filter ) {
850
+			foreach ( $parameters[ 'search_criteria' ][ 'field_filters' ] as $key => $filter ) {
852 851
 				if ( 'mode' === $key ) {
853
-					$unique_field_filters['mode'] = $filter;
852
+					$unique_field_filters[ 'mode' ] = $filter;
854 853
 				} else if ( ! in_array( $filter, $unique_field_filters ) ) {
855
-					$unique_field_filters[] = $filter;
854
+					$unique_field_filters[ ] = $filter;
856 855
 				}
857 856
 			}
858
-			$parameters['search_criteria']['field_filters'] = $unique_field_filters;
857
+			$parameters[ 'search_criteria' ][ 'field_filters' ] = $unique_field_filters;
859 858
 
860
-			if ( ! empty( $parameters['search_criteria']['field_filters'] ) ) {
859
+			if ( ! empty( $parameters[ 'search_criteria' ][ 'field_filters' ] ) ) {
861 860
 				gravityview()->log->notice( 'search_criteria/field_filters is not empty, third-party code may be using legacy search_criteria filters.' );
862 861
 			}
863 862
 
@@ -865,10 +864,10 @@  discard block
 block discarded – undo
865 864
 				/**
866 865
 				 * New \GF_Query stuff :)
867 866
 				 */
868
-				$query = new \GF_Query( $this->form->ID, $parameters['search_criteria'], $parameters['sorting'] );
867
+				$query = new \GF_Query( $this->form->ID, $parameters[ 'search_criteria' ], $parameters[ 'sorting' ] );
869 868
 
870
-				$query->limit( $parameters['paging']['page_size'] )
871
-					->offset( ( ( $page - 1 ) * $parameters['paging']['page_size'] ) + $this->settings->get( 'offset' ) );
869
+				$query->limit( $parameters[ 'paging' ][ 'page_size' ] )
870
+					->offset( ( ( $page - 1 ) * $parameters[ 'paging' ][ 'page_size' ] ) + $this->settings->get( 'offset' ) );
872 871
 
873 872
 				/**
874 873
 				 * Any joins?
@@ -910,15 +909,15 @@  discard block
 block discarded – undo
910 909
 				} );
911 910
 			} else {
912 911
 				$entries = $this->form->entries
913
-					->filter( \GV\GF_Entry_Filter::from_search_criteria( $parameters['search_criteria'] ) )
912
+					->filter( \GV\GF_Entry_Filter::from_search_criteria( $parameters[ 'search_criteria' ] ) )
914 913
 					->offset( $this->settings->get( 'offset' ) )
915
-					->limit( $parameters['paging']['page_size'] )
914
+					->limit( $parameters[ 'paging' ][ 'page_size' ] )
916 915
 					->page( $page );
917 916
 
918
-				if ( ! empty( $parameters['sorting'] ) && ! empty( $parameters['sorting']['key'] ) ) {
917
+				if ( ! empty( $parameters[ 'sorting' ] ) && ! empty( $parameters[ 'sorting' ][ 'key' ] ) ) {
919 918
 					$field = new \GV\Field();
920
-					$field->ID = $parameters['sorting']['key'];
921
-					$direction = strtolower( $parameters['sorting']['direction'] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC;
919
+					$field->ID = $parameters[ 'sorting' ][ 'key' ];
920
+					$direction = strtolower( $parameters[ 'sorting' ][ 'direction' ] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC;
922 921
 					$entries = $entries->sort( new \GV\Entry_Sort( $field, $direction ) );
923 922
 				}
924 923
 			}
Please login to merge, or discard this patch.