Completed
Pull Request — master (#1141)
by
unknown
19:31 queued 15:17
created
future/includes/rest/class-gv-rest-route.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 				'args'     => $this->create_sub_item_args()
122 122
 			),
123 123
 		) );
124
-		register_rest_route( $namespace, sprintf( '/%s/(?P<id>[\d]+)/%s/(?P<s_id>[\w-]+)%s', $base, $sub_type, $format ) , array(
124
+		register_rest_route( $namespace, sprintf( '/%s/(?P<id>[\d]+)/%s/(?P<s_id>[\w-]+)%s', $base, $sub_type, $format ), array(
125 125
 			array(
126 126
 				'methods'         => \WP_REST_Server::READABLE,
127 127
 				'callback'        => array( $this, 'get_sub_item' ),
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 	 * @return \WP_REST_Response
373 373
 	 */
374 374
 	protected function not_implemented(  ) {
375
-		$error = new \WP_Error( 'not-implemented-yet', __( 'Endpoint Not Yet Implemented.', 'gravityview' )  );
375
+		$error = new \WP_Error( 'not-implemented-yet', __( 'Endpoint Not Yet Implemented.', 'gravityview' ) );
376 376
 		return new \WP_REST_Response( $error, 501 );
377 377
 	}
378 378
 
Please login to merge, or discard this patch.
includes/widgets/search-widget/templates/search-field-search_all.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,15 +7,15 @@
 block discarded – undo
7 7
 
8 8
 $gravityview_view = GravityView_View::getInstance();
9 9
 $view_id = $gravityview_view->getViewId();
10
-$value = $gravityview_view->search_field['value'];
11
-$label = $gravityview_view->search_field['label'];
10
+$value = $gravityview_view->search_field[ 'value' ];
11
+$label = $gravityview_view->search_field[ 'label' ];
12 12
 
13 13
 $html_input_type = RGFormsModel::is_html5_enabled() ? 'search' : 'text';
14 14
 ?>
15 15
 
16 16
 <div class="gv-search-box gv-search-field-text gv-search-field-search_all">
17 17
 	<div class="gv-search">
18
-	<?php if( ! gv_empty( $label, false, false ) ) { ?>
18
+	<?php if ( ! gv_empty( $label, false, false ) ) { ?>
19 19
 		<label for="gv_search_<?php echo $view_id; ?>"><?php echo esc_html( $label ); ?></label>
20 20
 	<?php } ?>
21 21
 		<p><input type="<?php echo $html_input_type; ?>" name="gv_search" id="gv_search_<?php echo $view_id; ?>" value="<?php echo esc_attr( $value ); ?>" /></p>
Please login to merge, or discard this patch.
includes/widgets/search-widget/templates/search-field-entry_id.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,13 +7,13 @@
 block discarded – undo
7 7
 
8 8
 $gravityview_view = GravityView_View::getInstance();
9 9
 $view_id = $gravityview_view->getViewId();
10
-$value = $gravityview_view->search_field['value'];
11
-$label = $gravityview_view->search_field['label'];
10
+$value = $gravityview_view->search_field[ 'value' ];
11
+$label = $gravityview_view->search_field[ 'label' ];
12 12
 ?>
13 13
 
14 14
 <div class="gv-search-box gv-search-field-entry_id">
15 15
 	<div class="gv-search">
16
-		<?php if( ! gv_empty( $label, false, false ) ) { ?>
16
+		<?php if ( ! gv_empty( $label, false, false ) ) { ?>
17 17
 		<label for="gv_entry_id_<?php echo $view_id; ?>"><?php echo esc_html( $label ); ?></label>
18 18
 		<?php } ?>
19 19
 		<p><input type="text" name="gv_id" id="gv_entry_id_<?php echo $view_id; ?>" value="<?php echo esc_attr( $value ); ?>" /></p>
Please login to merge, or discard this patch.
includes/widgets/search-widget/templates/search-field-entry_date.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,17 +7,17 @@
 block discarded – undo
7 7
 
8 8
 $gravityview_view = GravityView_View::getInstance();
9 9
 $view_id = $gravityview_view->getViewId();
10
-$value = $gravityview_view->search_field['value'];
11
-$label = $gravityview_view->search_field['label'];
10
+$value = $gravityview_view->search_field[ 'value' ];
11
+$label = $gravityview_view->search_field[ 'label' ];
12 12
 
13 13
 ?>
14 14
 
15 15
 <div class="gv-search-box gv-search-date gv-search-date-range gv-search-field-entry_date">
16
-	<?php if( ! gv_empty( $label, false, false ) ) { ?>
16
+	<?php if ( ! gv_empty( $label, false, false ) ) { ?>
17 17
 	<label for="gv_start_date_<?php echo $view_id; ?>"><?php echo esc_html( $label ); ?></label>
18 18
 	<?php } ?>
19 19
 	<p>
20
-		<input name="gv_start" id="gv_start_date_<?php echo $view_id; ?>" type="text" class="<?php echo esc_attr( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e('Start date', 'gravityview' ); ?>" value="<?php echo $value['start']; ?>">
21
-		<input name="gv_end" id="gv_end_date_<?php echo $view_id; ?>" type="text" class="<?php echo esc_attr( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e('End date', 'gravityview' ); ?>" value="<?php echo $value['end']; ?>">
20
+		<input name="gv_start" id="gv_start_date_<?php echo $view_id; ?>" type="text" class="<?php echo esc_attr( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e( 'Start date', 'gravityview' ); ?>" value="<?php echo $value[ 'start' ]; ?>">
21
+		<input name="gv_end" id="gv_end_date_<?php echo $view_id; ?>" type="text" class="<?php echo esc_attr( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e( 'End date', 'gravityview' ); ?>" value="<?php echo $value[ 'end' ]; ?>">
22 22
 	</p>
23 23
 </div>
24 24
\ No newline at end of file
Please login to merge, or discard this patch.
includes/widgets/search-widget/templates/search-field-date_range.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -7,17 +7,17 @@
 block discarded – undo
7 7
 
8 8
 $gravityview_view = GravityView_View::getInstance();
9 9
 $view_id = $gravityview_view->getViewId();
10
-$value = $gravityview_view->search_field['value'];
11
-$label = $gravityview_view->search_field['label'];
12
-$name = $gravityview_view->search_field['name'];
10
+$value = $gravityview_view->search_field[ 'value' ];
11
+$label = $gravityview_view->search_field[ 'label' ];
12
+$name = $gravityview_view->search_field[ 'name' ];
13 13
 ?>
14 14
 
15 15
 <div class="gv-search-box gv-search-date gv-search-date-range">
16
-	<?php if( ! gv_empty( $label, false, false ) ) { ?>
17
-	<label for="search-box-<?php echo esc_attr( $name ).'-start'; ?>"><?php echo esc_html( $label ); ?></label>
16
+	<?php if ( ! gv_empty( $label, false, false ) ) { ?>
17
+	<label for="search-box-<?php echo esc_attr( $name ) . '-start'; ?>"><?php echo esc_html( $label ); ?></label>
18 18
 	<?php } ?>
19 19
 	<p>
20
-		<input name="<?php echo esc_attr( $name ).'[start]'; ?>" id="search-box-<?php echo esc_attr( $name ).'-start'; ?>" type="text" class="<?php echo esc_html( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e('Start date', 'gravityview' ); ?>" value="<?php echo esc_attr( $value['start'] ); ?>">
21
-		<input name="<?php echo esc_attr( $name ).'[end]'; ?>" id="search-box-<?php echo esc_attr( $name ).'-end'; ?>" type="text" class="<?php echo esc_html( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e('End date', 'gravityview' ); ?>" value="<?php echo esc_attr( $value['end'] ); ?>">
20
+		<input name="<?php echo esc_attr( $name ) . '[start]'; ?>" id="search-box-<?php echo esc_attr( $name ) . '-start'; ?>" type="text" class="<?php echo esc_html( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e( 'Start date', 'gravityview' ); ?>" value="<?php echo esc_attr( $value[ 'start' ] ); ?>">
21
+		<input name="<?php echo esc_attr( $name ) . '[end]'; ?>" id="search-box-<?php echo esc_attr( $name ) . '-end'; ?>" type="text" class="<?php echo esc_html( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e( 'End date', 'gravityview' ); ?>" value="<?php echo esc_attr( $value[ 'end' ] ); ?>">
22 22
 	</p>
23 23
 </div>
24 24
\ No newline at end of file
Please login to merge, or discard this patch.
future/includes/rest/class-gv-rest-views-route.php 2 patches
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 			'total' => wp_count_posts( 'gravityview' )->publish,
64 64
 		);
65 65
 		foreach ( $items as $item ) {
66
-			$data['views'][] = $this->prepare_view_for_response( $item, $request );
66
+			$data[ 'views' ][ ] = $this->prepare_view_for_response( $item, $request );
67 67
 		}
68 68
 
69 69
 		return new \WP_REST_Response( $data, 200 );
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 
83 83
 		$url = $request->get_url_params();
84 84
 
85
-		$view_id = intval( $url['id'] );
85
+		$view_id = intval( $url[ 'id' ] );
86 86
 
87 87
 		$item = get_post( $view_id );
88 88
 
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 		// Only output the fields that should be displayed.
112 112
 		$allowed = array();
113 113
 		foreach ( $view->fields->by_position( "{$context}_*" )->by_visible()->all() as $field ) {
114
-			$allowed[] = $field->ID;
114
+			$allowed[ ] = $field->ID;
115 115
 		}
116 116
 
117 117
 		/**
@@ -156,10 +156,10 @@  discard block
 block discarded – undo
156 156
 	public function get_sub_items( $request ) {
157 157
 
158 158
 		$url     = $request->get_url_params();
159
-		$view_id = intval( $url['id'] );
159
+		$view_id = intval( $url[ 'id' ] );
160 160
 		$format  = \GV\Utils::get( $url, 'format', 'json' );
161 161
 
162
-		if( $post_id = $request->get_param('post_id') ) {
162
+		if ( $post_id = $request->get_param( 'post_id' ) ) {
163 163
 			global $post;
164 164
 
165 165
 			$post = get_post( $post_id );
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 
216 216
 		$data = array( 'entries' => $entries->all(), 'total' => $entries->total() );
217 217
 
218
-		foreach ( $data['entries'] as &$entry ) {
218
+		foreach ( $data[ 'entries' ] as &$entry ) {
219 219
 			$entry = $this->prepare_entry_for_response( $view, $entry, $request, 'directory' );
220 220
 		}
221 221
 
@@ -234,8 +234,8 @@  discard block
 block discarded – undo
234 234
 	 */
235 235
 	public function get_sub_item( $request ) {
236 236
 		$url      = $request->get_url_params();
237
-		$view_id  = intval( $url['id'] );
238
-		$entry_id = intval( $url['s_id'] );
237
+		$view_id  = intval( $url[ 'id' ] );
238
+		$entry_id = intval( $url[ 's_id' ] );
239 239
 		$format   = \GV\Utils::get( $url, 'format', 'json' );
240 240
 
241 241
 		$view  = \GV\View::by_id( $view_id );
@@ -270,32 +270,32 @@  discard block
 block discarded – undo
270 270
 		// Add all the WP_Post data
271 271
 		$view_post = $view_post->to_array();
272 272
 
273
-		unset( $view_post['to_ping'], $view_post['ping_status'], $view_post['pinged'], $view_post['post_type'], $view_post['filter'], $view_post['post_category'], $view_post['tags_input'], $view_post['post_content'], $view_post['post_content_filtered'] );
273
+		unset( $view_post[ 'to_ping' ], $view_post[ 'ping_status' ], $view_post[ 'pinged' ], $view_post[ 'post_type' ], $view_post[ 'filter' ], $view_post[ 'post_category' ], $view_post[ 'tags_input' ], $view_post[ 'post_content' ], $view_post[ 'post_content_filtered' ] );
274 274
 
275 275
 		$return = wp_parse_args( $item, $view_post );
276 276
 
277
-		$return['title'] = $return['post_title'];
277
+		$return[ 'title' ] = $return[ 'post_title' ];
278 278
 
279
-		$return['settings'] = isset( $return['atts'] ) ? $return['atts'] : array();
280
-		unset( $return['atts'], $return['view_id'] );
279
+		$return[ 'settings' ] = isset( $return[ 'atts' ] ) ? $return[ 'atts' ] : array();
280
+		unset( $return[ 'atts' ], $return[ 'view_id' ] );
281 281
 
282
-		$return['search_criteria'] = array(
282
+		$return[ 'search_criteria' ] = array(
283 283
 			'page_size' => rgars( $return, 'settings/page_size' ),
284 284
 			'sort_field' => rgars( $return, 'settings/sort_field' ),
285 285
 			'sort_direction' => rgars( $return, 'settings/sort_direction' ),
286 286
 			'offset' => rgars( $return, 'settings/offset' ),
287 287
 		);
288 288
 
289
-		unset( $return['settings']['page_size'], $return['settings']['sort_field'], $return['settings']['sort_direction'] );
289
+		unset( $return[ 'settings' ][ 'page_size' ], $return[ 'settings' ][ 'sort_field' ], $return[ 'settings' ][ 'sort_direction' ] );
290 290
 
291 291
 		// Redact for non-logged ins
292 292
 		if ( ! \GVCommon::has_cap( 'edit_others_gravityviews' ) ) {
293
-			unset( $return['settings'] );
294
-			unset( $return['search_criteria'] );
293
+			unset( $return[ 'settings' ] );
294
+			unset( $return[ 'search_criteria' ] );
295 295
 		}
296 296
 		
297 297
 		if ( ! \GFCommon::current_user_can_any( 'gravityforms_edit_forms' ) ) {
298
-			unset( $return['form'] );
298
+			unset( $return[ 'form' ] );
299 299
 		}
300 300
 
301 301
 		return $return;
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 			$view_id = func_get_arg( 1 ); // $view_id override
307 307
 		} else {
308 308
 			$url     = $request->get_url_params();
309
-			$view_id = intval( $url['id'] );
309
+			$view_id = intval( $url[ 'id' ] );
310 310
 		}
311 311
 
312 312
 		if ( ! $view = \GV\View::by_id( $view_id ) ) {
@@ -359,8 +359,8 @@  discard block
 block discarded – undo
359 359
 		}
360 360
 
361 361
 		$url     = $request->get_url_params();
362
-		$view_id = intval( $url['id'] );
363
-		$entry_id = intval( $url['s_id'] );
362
+		$view_id = intval( $url[ 'id' ] );
363
+		$entry_id = intval( $url[ 's_id' ] );
364 364
 
365 365
 		$view = \GV\View::by_id( $view_id );
366 366
 
@@ -368,11 +368,11 @@  discard block
 block discarded – undo
368 368
 			return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' );
369 369
 		}
370 370
 
371
-		if ( $entry['form_id'] != $view->form->ID ) {
371
+		if ( $entry[ 'form_id' ] != $view->form->ID ) {
372 372
 			return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' );
373 373
 		}
374 374
 
375
-		if ( $entry['status'] != 'active' ) {
375
+		if ( $entry[ 'status' ] != 'active' ) {
376 376
 			return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' );
377 377
 		}
378 378
 
@@ -380,10 +380,10 @@  discard block
 block discarded – undo
380 380
 			return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' );
381 381
 		}
382 382
 
383
-		$is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap('gravityview_moderate_entries', $view->ID );
383
+		$is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap( 'gravityview_moderate_entries', $view->ID );
384 384
 
385 385
 		if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) {
386
-			if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) )  ) {
386
+			if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) {
387 387
 				return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' );
388 388
 			}
389 389
 		}
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -319,8 +319,9 @@
 block discarded – undo
319 319
 		}
320 320
 
321 321
 		while ( $error = $view->can_render( array( 'rest' ), $request ) ) {
322
-			if ( ! is_wp_error( $error ) )
323
-				break;
322
+			if ( ! is_wp_error( $error ) ) {
323
+							break;
324
+			}
324 325
 
325 326
 			switch ( str_replace( 'gravityview/', '', $error->get_error_code() ) ) {
326 327
 				case 'rest_disabled':
Please login to merge, or discard this patch.
future/includes/class-gv-entry.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
 		$rule = array( sprintf( '%s/([^/]+)/%s(/(.*))?/?$', $slug, $endpoint ), sprintf( 'index.php?gravityview=$matches[1]&%s=$matches[3]', $endpoint ), 'top' );
48 48
 
49 49
 		add_filter( 'query_vars', function( $query_vars ) use ( $endpoint ) {
50
-			$query_vars[] = $endpoint;
50
+			$query_vars[ ] = $endpoint;
51 51
 			return $query_vars;
52 52
 		} );
53 53
 
54
-		if ( ! isset( $wp_rewrite->extra_rules_top[ $rule[0] ] ) ) {
54
+		if ( ! isset( $wp_rewrite->extra_rules_top[ $rule[ 0 ] ] ) ) {
55 55
 			call_user_func_array( 'add_rewrite_rule', $rule );
56 56
 		}
57 57
 	}
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 
118 118
 		$args = array();
119 119
 
120
-		$view_id = is_null ( $view ) ? null : $view->ID;
120
+		$view_id = is_null( $view ) ? null : $view->ID;
121 121
 
122 122
 		$permalink = null;
123 123
 
@@ -130,8 +130,8 @@  discard block
 block discarded – undo
130 130
 
131 131
 				$view_collection = View_Collection::from_post( $post );
132 132
 
133
-				if( 1 < $view_collection->count() ) {
134
-					$args['gvid'] = $view_id;
133
+				if ( 1 < $view_collection->count() ) {
134
+					$args[ 'gvid' ] = $view_id;
135 135
 				}
136 136
 			}
137 137
 		}
@@ -160,21 +160,21 @@  discard block
 block discarded – undo
160 160
 			 */
161 161
 			$link_parts = explode( '?', $permalink );
162 162
 
163
-			$query = ! empty( $link_parts[1] ) ? '?' . $link_parts[1] : '';
163
+			$query = ! empty( $link_parts[ 1 ] ) ? '?' . $link_parts[ 1 ] : '';
164 164
 
165
-			$permalink = trailingslashit( $link_parts[0] ) . $entry_endpoint_name . '/'. $entry_slug .'/' . $query;
165
+			$permalink = trailingslashit( $link_parts[ 0 ] ) . $entry_endpoint_name . '/' . $entry_slug . '/' . $query;
166 166
 		} else {
167 167
 			$args[ $entry_endpoint_name ] = $entry_slug;
168 168
 		}
169 169
 
170 170
 		if ( $track_directory ) {
171
-			if ( ! empty( $_GET['pagenum'] ) ) {
172
-				$args['pagenum'] = intval( $_GET['pagenum'] );
171
+			if ( ! empty( $_GET[ 'pagenum' ] ) ) {
172
+				$args[ 'pagenum' ] = intval( $_GET[ 'pagenum' ] );
173 173
 			}
174 174
 
175 175
 			if ( $sort = Utils::_GET( 'sort' ) ) {
176
-				$args['sort'] = $sort;
177
-				$args['dir'] = Utils::_GET( 'dir' );
176
+				$args[ 'sort' ] = $sort;
177
+				$args[ 'dir' ] = Utils::_GET( 'dir' );
178 178
 			}
179 179
 		}
180 180
 
Please login to merge, or discard this patch.
future/includes/class-gv-shortcode-gravityview.php 2 patches
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
 			'detail' => null,
38 38
 		) );
39 39
 		
40
-		if ( ! $view_id = $atts['id'] ? : $atts['view_id'] ) {
41
-			if ( $atts['detail'] && $view = $request->is_view() ) {
40
+		if ( ! $view_id = $atts[ 'id' ] ?: $atts[ 'view_id' ] ) {
41
+			if ( $atts[ 'detail' ] && $view = $request->is_view() ) {
42 42
 				$view_id = $view->ID;
43 43
 			}
44 44
 		}
@@ -101,12 +101,12 @@  discard block
 block discarded – undo
101 101
 			}
102 102
 		}
103 103
 
104
-		$is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap('gravityview_moderate_entries', $view->ID );
104
+		$is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap( 'gravityview_moderate_entries', $view->ID );
105 105
 
106 106
 		/**
107 107
 		 * View details.
108 108
 		 */
109
-		if ( $atts['detail'] ) {
109
+		if ( $atts[ 'detail' ] ) {
110 110
 			return $this->detail( $view, $entries, $atts );
111 111
 
112 112
 		/**
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 				return '';
123 123
 			}
124 124
 
125
-			if ( $entry['status'] != 'active' ) {
125
+			if ( $entry[ 'status' ] != 'active' ) {
126 126
 				gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) );
127 127
 				return __( 'You are not allowed to view this content.', 'gravityview' );
128 128
 			}
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 			}
134 134
 
135 135
 			if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) {
136
-				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) )  ) {
136
+				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) {
137 137
 					gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) );
138 138
 					return __( 'You are not allowed to view this content.', 'gravityview' );
139 139
 				}
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 				return '';
154 154
 			}
155 155
 
156
-			if ( $entry['status'] != 'active' ) {
156
+			if ( $entry[ 'status' ] != 'active' ) {
157 157
 				gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) );
158 158
 				return __( 'You are not allowed to view this content.', 'gravityview' );
159 159
 			}
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 			}
165 165
 
166 166
 			if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) {
167
-				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) )  ) {
167
+				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) {
168 168
 					gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) );
169 169
 					return __( 'You are not allowed to view this content.', 'gravityview' );
170 170
 				}
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 
173 173
 			$error = \GVCommon::check_entry_display( $entry->as_entry() );
174 174
 
175
-			if( is_wp_error( $error ) ) {
175
+			if ( is_wp_error( $error ) ) {
176 176
 				gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing: {message}', array( 'entry_id' => $entry->ID, 'message' => $error->get_error_message() ) );
177 177
 				return __( 'You are not allowed to view this content.', 'gravityview' );
178 178
 			}
@@ -188,10 +188,10 @@  discard block
 block discarded – undo
188 188
 				
189 189
 				// Mock the request with the actual View, not the global one
190 190
 				$mock_request = new \GV\Mock_Request();
191
-				$mock_request->returns['is_view'] = $view;
192
-				$mock_request->returns['is_entry'] = $request->is_entry();
193
-				$mock_request->returns['is_edit_entry'] = $request->is_edit_entry();
194
-				$mock_request->returns['is_search'] = $request->is_search();
191
+				$mock_request->returns[ 'is_view' ] = $view;
192
+				$mock_request->returns[ 'is_entry' ] = $request->is_entry();
193
+				$mock_request->returns[ 'is_edit_entry' ] = $request->is_edit_entry();
194
+				$mock_request->returns[ 'is_search' ] = $request->is_search();
195 195
 
196 196
 				$request = $mock_request;
197 197
 			}
@@ -227,16 +227,16 @@  discard block
 block discarded – undo
227 227
 		$filtered_atts = shortcode_atts( $supported_atts, $passed_atts, 'gravityview' );
228 228
 
229 229
 		// Only keep the passed attributes after making sure that they're valid pairs
230
-		$filtered_atts = array_intersect_key( (array) $passed_atts, $filtered_atts );
230
+		$filtered_atts = array_intersect_key( (array)$passed_atts, $filtered_atts );
231 231
 
232 232
 		$atts = array();
233 233
 
234
-		foreach( $filtered_atts as $key => $passed_value ) {
234
+		foreach ( $filtered_atts as $key => $passed_value ) {
235 235
 
236 236
 			// Allow using GravityView merge tags in shortcode attributes, like {get} and {created_by}
237 237
 			$passed_value = \GravityView_Merge_Tags::replace_variables( $passed_value );
238 238
 
239
-			switch( $defaults[ $key ]['type'] ) {
239
+			switch ( $defaults[ $key ][ 'type' ] ) {
240 240
 
241 241
 				/**
242 242
 				 * Make sure number fields are numeric.
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 				 * @see http://php.net/manual/en/function.is-numeric.php#107326
245 245
 				 */
246 246
 				case 'number':
247
-					if( is_numeric( $passed_value ) ) {
247
+					if ( is_numeric( $passed_value ) ) {
248 248
 						$atts[ $key ] = ( $passed_value + 0 );
249 249
 					}
250 250
 					break;
@@ -259,8 +259,8 @@  discard block
 block discarded – undo
259 259
 				 */
260 260
 				case 'select':
261 261
 				case 'radio':
262
-					$options = isset( $defaults[ $key ]['choices'] ) ? $defaults[ $key ]['choices'] : $defaults[ $key ]['options'];
263
-					if( in_array( $passed_value, array_keys( $options ) ) ) {
262
+					$options = isset( $defaults[ $key ][ 'choices' ] ) ? $defaults[ $key ][ 'choices' ] : $defaults[ $key ][ 'options' ];
263
+					if ( in_array( $passed_value, array_keys( $options ) ) ) {
264 264
 						$atts[ $key ] = $passed_value;
265 265
 					}
266 266
 					break;
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 			}
273 273
 		}
274 274
 
275
-		$atts['detail'] = \GV\Utils::get( $passed_atts, 'detail', null );
275
+		$atts[ 'detail' ] = \GV\Utils::get( $passed_atts, 'detail', null );
276 276
 
277 277
 		return $atts;
278 278
 	}
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 	private function detail( $view, $entries, $atts ) {
290 290
 		$output = '';
291 291
 
292
-		switch ( $key = $atts['detail'] ):
292
+		switch ( $key = $atts[ 'detail' ] ):
293 293
 			case 'total_entries':
294 294
 				$output = number_format_i18n( $entries->total() );
295 295
 				break;
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -79,8 +79,9 @@
 block discarded – undo
79 79
 		 * Check permissions.
80 80
 		 */
81 81
 		while ( $error = $view->can_render( array( 'shortcode' ), $request ) ) {
82
-			if ( ! is_wp_error( $error ) )
83
-				break;
82
+			if ( ! is_wp_error( $error ) ) {
83
+							break;
84
+			}
84 85
 
85 86
 			switch ( str_replace( 'gravityview/', '', $error->get_error_code() ) ) {
86 87
 				case 'post_password_required':
Please login to merge, or discard this patch.
includes/admin/class-gravityview-admin-view-item.php 1 patch
Spacing   +18 added lines, -18 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
 	/**
@@ -114,10 +114,10 @@  discard block
 block discarded – undo
114 114
 		if ( $html ) {
115 115
 
116 116
 			foreach ( $field_info_items as $item ) {
117
-				$class = isset( $item['class'] ) ? sanitize_html_class( $item['class'] ) . ' description' : 'description';
117
+				$class = isset( $item[ 'class' ] ) ? sanitize_html_class( $item[ 'class' ] ) . ' description' : 'description';
118 118
 				// Add the title in case the value's long, in which case, it'll be truncated by CSS.
119 119
 				$output .= '<span class="' . $class . '">';
120
-				$output .= esc_html( $item['value'] );
120
+				$output .= esc_html( $item[ 'value' ] );
121 121
 				$output .= '</span>';
122 122
 			}
123 123
 
@@ -145,29 +145,29 @@  discard block
 block discarded – undo
145 145
 
146 146
 		// $settings_html will just be hidden inputs if empty. Otherwise, it'll have an <ul>. Ugly hack, I know.
147 147
 		// TODO: Un-hack this
148
-		$hide_settings_link = ( empty( $this->item['settings_html'] ) || strpos( $this->item['settings_html'], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : '';
148
+		$hide_settings_link = ( empty( $this->item[ 'settings_html' ] ) || strpos( $this->item[ 'settings_html' ], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : '';
149 149
 		$settings_link      = sprintf( '<a href="#settings" class="dashicons-admin-generic dashicons %s" title="%s"></a>', $hide_settings_link, esc_attr( $settings_title ) );
150 150
 
151 151
 		// Should we show the icon that the field is being used as a link to single entry?
152
-		$hide_show_as_link_class = empty( $this->settings['show_as_link'] ) ? 'hide-if-js' : '';
152
+		$hide_show_as_link_class = empty( $this->settings[ 'show_as_link' ] ) ? 'hide-if-js' : '';
153 153
 		$show_as_link            = '<span class="dashicons dashicons-admin-links ' . $hide_show_as_link_class . '" title="' . esc_attr( $single_link_title ) . '"></span>';
154 154
 
155 155
 		// When a field label is empty, use the Field ID
156 156
 		$label = empty( $this->title ) ? sprintf( _x( 'Field #%s (No Label)', 'Label in field picker for empty label', 'gravityview' ), $this->id ) : $this->title;
157 157
 
158 158
 		// If there's a custom label, and show label is checked, use that as the field heading
159
-		if ( ! empty( $this->settings['custom_label'] ) && ! empty( $this->settings['show_label'] ) ) {
160
-			$label = $this->settings['custom_label'];
161
-		} else if ( ! empty( $this->item['customLabel'] ) ) {
162
-			$label = $this->item['customLabel'];
159
+		if ( ! empty( $this->settings[ 'custom_label' ] ) && ! empty( $this->settings[ 'show_label' ] ) ) {
160
+			$label = $this->settings[ 'custom_label' ];
161
+		} else if ( ! empty( $this->item[ 'customLabel' ] ) ) {
162
+			$label = $this->item[ 'customLabel' ];
163 163
 		}
164 164
 
165 165
 		$output = '<h5 class="selectable gfield field-id-' . esc_attr( $this->id ) . '">';
166 166
 
167 167
 		$label = esc_attr( $label );
168 168
 
169
-		if ( ! empty( $this->item['parent'] ) ) {
170
-			$label .= ' <small>(' . esc_attr( $this->item['parent']['label'] ) . ')</small>';
169
+		if ( ! empty( $this->item[ 'parent' ] ) ) {
170
+			$label .= ' <small>(' . esc_attr( $this->item[ 'parent' ][ 'label' ] ) . ')</small>';
171 171
 		}
172 172
 
173 173
 		// Name of field / widget
@@ -183,10 +183,10 @@  discard block
 block discarded – undo
183 183
 
184 184
 		$output .= '</h5>';
185 185
 
186
-		$container_class = ! empty( $this->item['parent'] ) ? ' gv-child-field' : '';
187
-		$data_form_id   = ! empty( $this->form_id ) ? 'data-formid="' . esc_attr( $this->form_id ) . '"' : '';
186
+		$container_class = ! empty( $this->item[ 'parent' ] ) ? ' gv-child-field' : '';
187
+		$data_form_id = ! empty( $this->form_id ) ? 'data-formid="' . esc_attr( $this->form_id ) . '"' : '';
188 188
 
189
-		$output = '<div data-fieldtype="' . esc_html($this->label_type) .'" 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>';
189
+		$output = '<div data-fieldtype="' . esc_html( $this->label_type ) . '" 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>';
190 190
 
191 191
 		return $output;
192 192
 	}
Please login to merge, or discard this patch.