Completed
Push — develop ( e9f2c4...db0f69 )
by Zack
17:54
created
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/class-gv-entry.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 
114 114
 		$args = array();
115 115
 
116
-		$view_id = is_null ( $view ) ? null : $view->ID;
116
+		$view_id = is_null( $view ) ? null : $view->ID;
117 117
 
118 118
 		$permalink = null;
119 119
 
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 
127 127
 				$view_collection = View_Collection::from_post( $post );
128 128
 
129
-				if( 1 < $view_collection->count() ) {
130
-					$args['gvid'] = $view_id;
129
+				if ( 1 < $view_collection->count() ) {
130
+					$args[ 'gvid' ] = $view_id;
131 131
 				}
132 132
 			}
133 133
 		}
@@ -156,21 +156,21 @@  discard block
 block discarded – undo
156 156
 			 */
157 157
 			$link_parts = explode( '?', $permalink );
158 158
 
159
-			$query = ! empty( $link_parts[1] ) ? '?' . $link_parts[1] : '';
159
+			$query = ! empty( $link_parts[ 1 ] ) ? '?' . $link_parts[ 1 ] : '';
160 160
 
161
-			$permalink = trailingslashit( $link_parts[0] ) . $entry_endpoint_name . '/'. $entry_slug .'/' . $query;
161
+			$permalink = trailingslashit( $link_parts[ 0 ] ) . $entry_endpoint_name . '/' . $entry_slug . '/' . $query;
162 162
 		} else {
163 163
 			$args[ $entry_endpoint_name ] = $entry_slug;
164 164
 		}
165 165
 
166 166
 		if ( $track_directory ) {
167
-			if ( ! empty( $_GET['pagenum'] ) ) {
168
-				$args['pagenum'] = intval( $_GET['pagenum'] );
167
+			if ( ! empty( $_GET[ 'pagenum' ] ) ) {
168
+				$args[ 'pagenum' ] = intval( $_GET[ 'pagenum' ] );
169 169
 			}
170 170
 
171 171
 			if ( $sort = Utils::_GET( 'sort' ) ) {
172
-				$args['sort'] = $sort;
173
-				$args['dir'] = Utils::_GET( 'dir' );
172
+				$args[ 'sort' ] = $sort;
173
+				$args[ 'dir' ] = Utils::_GET( 'dir' );
174 174
 			}
175 175
 		}
176 176
 
Please login to merge, or discard this patch.
future/includes/rest/class-gv-rest-views-route.php 1 patch
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.
future/includes/class-gv-shortcode-gravityview.php 2 patches
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.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
 			'detail' => null,
42 42
 		) );
43 43
 		
44
-		if ( ! $view_id = $atts['id'] ? : $atts['view_id'] ) {
45
-			if ( $atts['detail'] && $view = $request->is_view() ) {
44
+		if ( ! $view_id = $atts[ 'id' ] ?: $atts[ 'view_id' ] ) {
45
+			if ( $atts[ 'detail' ] && $view = $request->is_view() ) {
46 46
 				$view_id = $view->ID;
47 47
 			}
48 48
 		}
@@ -111,12 +111,12 @@  discard block
 block discarded – undo
111 111
 			}
112 112
 		}
113 113
 
114
-		$is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap('gravityview_moderate_entries', $view->ID );
114
+		$is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap( 'gravityview_moderate_entries', $view->ID );
115 115
 
116 116
 		/**
117 117
 		 * View details.
118 118
 		 */
119
-		if ( $atts['detail'] ) {
119
+		if ( $atts[ 'detail' ] ) {
120 120
 			return self::_return( $this->detail( $view, $entries, $atts ) );
121 121
 
122 122
 		/**
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 				return self::_return( '' );
133 133
 			}
134 134
 
135
-			if ( $entry['status'] != 'active' ) {
135
+			if ( $entry[ 'status' ] != 'active' ) {
136 136
 				gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) );
137 137
 				return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) );
138 138
 			}
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 			}
144 144
 
145 145
 			if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) {
146
-				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) )  ) {
146
+				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) {
147 147
 					gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) );
148 148
 					return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) );
149 149
 				}
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 				return self::_return( '' );
164 164
 			}
165 165
 
166
-			if ( $entry['status'] != 'active' ) {
166
+			if ( $entry[ 'status' ] != 'active' ) {
167 167
 				gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) );
168 168
 				return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) );
169 169
 			}
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 			}
175 175
 
176 176
 			if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) {
177
-				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) )  ) {
177
+				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) {
178 178
 					gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) );
179 179
 					return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) );
180 180
 				}
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 
183 183
 			$error = \GVCommon::check_entry_display( $entry->as_entry() );
184 184
 
185
-			if( is_wp_error( $error ) ) {
185
+			if ( is_wp_error( $error ) ) {
186 186
 				gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing: {message}', array( 'entry_id' => $entry->ID, 'message' => $error->get_error_message() ) );
187 187
 				return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) );
188 188
 			}
@@ -198,10 +198,10 @@  discard block
 block discarded – undo
198 198
 				
199 199
 				// Mock the request with the actual View, not the global one
200 200
 				$mock_request = new \GV\Mock_Request();
201
-				$mock_request->returns['is_view'] = $view;
202
-				$mock_request->returns['is_entry'] = $request->is_entry();
203
-				$mock_request->returns['is_edit_entry'] = $request->is_edit_entry();
204
-				$mock_request->returns['is_search'] = $request->is_search();
201
+				$mock_request->returns[ 'is_view' ] = $view;
202
+				$mock_request->returns[ 'is_entry' ] = $request->is_entry();
203
+				$mock_request->returns[ 'is_edit_entry' ] = $request->is_edit_entry();
204
+				$mock_request->returns[ 'is_search' ] = $request->is_search();
205 205
 
206 206
 				$request = $mock_request;
207 207
 			}
@@ -237,16 +237,16 @@  discard block
 block discarded – undo
237 237
 		$filtered_atts = shortcode_atts( $supported_atts, $passed_atts, 'gravityview' );
238 238
 
239 239
 		// Only keep the passed attributes after making sure that they're valid pairs
240
-		$filtered_atts = array_intersect_key( (array) $passed_atts, $filtered_atts );
240
+		$filtered_atts = array_intersect_key( (array)$passed_atts, $filtered_atts );
241 241
 
242 242
 		$atts = array();
243 243
 
244
-		foreach( $filtered_atts as $key => $passed_value ) {
244
+		foreach ( $filtered_atts as $key => $passed_value ) {
245 245
 
246 246
 			// Allow using GravityView merge tags in shortcode attributes, like {get} and {created_by}
247 247
 			$passed_value = \GravityView_Merge_Tags::replace_variables( $passed_value );
248 248
 
249
-			switch( $defaults[ $key ]['type'] ) {
249
+			switch ( $defaults[ $key ][ 'type' ] ) {
250 250
 
251 251
 				/**
252 252
 				 * Make sure number fields are numeric.
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 				 * @see http://php.net/manual/en/function.is-numeric.php#107326
255 255
 				 */
256 256
 				case 'number':
257
-					if( is_numeric( $passed_value ) ) {
257
+					if ( is_numeric( $passed_value ) ) {
258 258
 						$atts[ $key ] = ( $passed_value + 0 );
259 259
 					}
260 260
 					break;
@@ -269,8 +269,8 @@  discard block
 block discarded – undo
269 269
 				 */
270 270
 				case 'select':
271 271
 				case 'radio':
272
-					$options = isset( $defaults[ $key ]['choices'] ) ? $defaults[ $key ]['choices'] : $defaults[ $key ]['options'];
273
-					if( in_array( $passed_value, array_keys( $options ) ) ) {
272
+					$options = isset( $defaults[ $key ][ 'choices' ] ) ? $defaults[ $key ][ 'choices' ] : $defaults[ $key ][ 'options' ];
273
+					if ( in_array( $passed_value, array_keys( $options ) ) ) {
274 274
 						$atts[ $key ] = $passed_value;
275 275
 					}
276 276
 					break;
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 			}
283 283
 		}
284 284
 
285
-		$atts['detail'] = \GV\Utils::get( $passed_atts, 'detail', null );
285
+		$atts[ 'detail' ] = \GV\Utils::get( $passed_atts, 'detail', null );
286 286
 
287 287
 		return $atts;
288 288
 	}
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 	private function detail( $view, $entries, $atts ) {
300 300
 		$output = '';
301 301
 
302
-		switch ( $key = $atts['detail'] ):
302
+		switch ( $key = $atts[ 'detail' ] ):
303 303
 			case 'total_entries':
304 304
 				$output = number_format_i18n( $entries->total() );
305 305
 				break;
Please login to merge, or discard this patch.
includes/class-admin-installer.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
 	 *
50 50
 	 * @param array $items Scripts or styles to exclude from no-conflict
51 51
 	 *
52
-	 * @return array
52
+	 * @return string[]
53 53
 	 */
54 54
 	public function register_noconflict( $items ) {
55 55
 
Please login to merge, or discard this patch.
Indentation   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 */
96 96
 	public function add_admin_menu() {
97 97
 
98
-	    $menu_text = _x( 'Extensions', 'Extensions are WordPress plugins that add functionality to GravityView and Gravity Forms', 'gravityview' );
98
+		$menu_text = _x( 'Extensions', 'Extensions are WordPress plugins that add functionality to GravityView and Gravity Forms', 'gravityview' );
99 99
 
100 100
 		$menu_text = sprintf( '<span title="%s">%s</span>', esc_attr__( 'Plugins that extend GravityView and Gravity Forms functionality.', 'gravityview' ), $menu_text );
101 101
 
@@ -110,8 +110,8 @@  discard block
 block discarded – undo
110 110
 	}
111 111
 
112 112
 	/**
113
-     * When on the Installer page, show a different notice than on the Settings page
114
-     *
113
+	 * When on the Installer page, show a different notice than on the Settings page
114
+	 *
115 115
 	 * @param array $notice
116 116
 	 *
117 117
 	 * @return string License notice
@@ -119,10 +119,10 @@  discard block
 block discarded – undo
119 119
 	public function maybe_modify_license_notice( $notice = '' ) {
120 120
 
121 121
 		if ( ! gravityview()->request->is_admin( '', 'downloads' ) ) {
122
-            return $notice;
123
-        }
122
+			return $notice;
123
+		}
124 124
 
125
-        return esc_html__( 'Your license %s. Do you want access to these plugins? %sActivate your license%s or %sget a license here%s.', 'gravityview' );
125
+		return esc_html__( 'Your license %s. Do you want access to these plugins? %sActivate your license%s or %sget a license here%s.', 'gravityview' );
126 126
 	}
127 127
 
128 128
 	/**
@@ -160,43 +160,43 @@  discard block
 block discarded – undo
160 160
 	 * Get downloads data from transient or from API; save transient after getting data from API
161 161
 	 *
162 162
 	 * @return WP_Error|array If error, returns WP_Error. If not valid JSON, empty array. Otherwise, this structure: {
163
-     *   @type array  $info {
164
-     *       @type string $id int 17
165
-     *       @type string $slug Extension slug
166
-     *       @type string $title Extension title
167
-     *       @type string $create_date in '2018-07-19 20:03:10' format
168
-     *       @type string $modified_date
169
-     *       @type string $status
170
-     *       @type string $link URL to public plugin page
171
-     *       @type string $content
172
-     *       @type string $excerpt
173
-     *       @type string $thumbnail URL to thumbnail
174
-     *       @type array  $category Taxonomy details for the plugin's category {
175
-     *         @type int $term_id => int 30
176
-     *         @type string $name => string 'Plugins' (length=7)
177
-     *         @type string $slug => string 'plugins' (length=7)
178
-     *         @type int $term_group => int 0
179
-     *         @type int $term_taxonomy_id => int 30
180
-     *         @type string $taxonomy => string 'download_category' (length=17)
181
-     *         @type string $description => string '' (length=0)
182
-     *         @type int $parent => int 0
183
-     *         @type int $count => int 4
184
-     *         @type string $filter => string 'raw' (length=3)
185
-     *       }
186
-     *       @type array $tags {see $category above}
187
-     *       @type string $textdomain string 'gravityview' (length=11)
188
-     *   }
189
-     *   @type array $pricing array of `price_name_slugs` => '00.00' values, if price options exist
190
-     *   @type array $licensing {
191
-     *       @type bool   $enabled Is licensing enabled for the extension
192
-     *       @type string $version Version number
193
-     *       @type string $exp_unit Expiration unit ('years')
194
-     *       @type string $exp_length Expiration length ('1')
195
-     *   }
196
-     *   @type array $files Array of files. Empty if user has no access to the file. {
197
-     *       @type string $file string URL of the file download
198
-     *   }
199
-     * }
163
+	 *   @type array  $info {
164
+	 *       @type string $id int 17
165
+	 *       @type string $slug Extension slug
166
+	 *       @type string $title Extension title
167
+	 *       @type string $create_date in '2018-07-19 20:03:10' format
168
+	 *       @type string $modified_date
169
+	 *       @type string $status
170
+	 *       @type string $link URL to public plugin page
171
+	 *       @type string $content
172
+	 *       @type string $excerpt
173
+	 *       @type string $thumbnail URL to thumbnail
174
+	 *       @type array  $category Taxonomy details for the plugin's category {
175
+	 *         @type int $term_id => int 30
176
+	 *         @type string $name => string 'Plugins' (length=7)
177
+	 *         @type string $slug => string 'plugins' (length=7)
178
+	 *         @type int $term_group => int 0
179
+	 *         @type int $term_taxonomy_id => int 30
180
+	 *         @type string $taxonomy => string 'download_category' (length=17)
181
+	 *         @type string $description => string '' (length=0)
182
+	 *         @type int $parent => int 0
183
+	 *         @type int $count => int 4
184
+	 *         @type string $filter => string 'raw' (length=3)
185
+	 *       }
186
+	 *       @type array $tags {see $category above}
187
+	 *       @type string $textdomain string 'gravityview' (length=11)
188
+	 *   }
189
+	 *   @type array $pricing array of `price_name_slugs` => '00.00' values, if price options exist
190
+	 *   @type array $licensing {
191
+	 *       @type bool   $enabled Is licensing enabled for the extension
192
+	 *       @type string $version Version number
193
+	 *       @type string $exp_unit Expiration unit ('years')
194
+	 *       @type string $exp_length Expiration length ('1')
195
+	 *   }
196
+	 *   @type array $files Array of files. Empty if user has no access to the file. {
197
+	 *       @type string $file string URL of the file download
198
+	 *   }
199
+	 * }
200 200
 	 */
201 201
 	public function get_downloads_data() {
202 202
 
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 		) );
225 225
 
226 226
 		if ( is_wp_error( $response ) ) {
227
-		    gravityview()->log->error( "Extension data response is an error", array( 'data' => $response ) );
227
+			gravityview()->log->error( "Extension data response is an error", array( 'data' => $response ) );
228 228
 			return $response;
229 229
 		}
230 230
 
@@ -277,10 +277,10 @@  discard block
 block discarded – undo
277 277
                 <div class="gv-admin-installer-notice notice inline error">
278 278
                     <h3><?php esc_html_e( 'Extensions and plugins data cannot be loaded at the moment. Please try again later.', 'gravityview' ); ?></h3>
279 279
                     <?php
280
-                    if ( is_wp_error( $downloads_data ) ) {
281
-	                    echo wpautop( '<pre>' . esc_html( $downloads_data->get_error_message() ) . '</pre>' );
282
-                    }
283
-                    ?>
280
+					if ( is_wp_error( $downloads_data ) ) {
281
+						echo wpautop( '<pre>' . esc_html( $downloads_data->get_error_message() ) . '</pre>' );
282
+					}
283
+					?>
284 284
                 </div>
285 285
             </div>
286 286
 			<?php
@@ -336,9 +336,9 @@  discard block
 block discarded – undo
336 336
 	protected function render_download( $download, $wp_plugins ) {
337 337
 
338 338
 
339
-        $details = $this->get_download_display_details( $download, $wp_plugins );
339
+		$details = $this->get_download_display_details( $download, $wp_plugins );
340 340
 
341
-        $download_info = $details['download_info'];
341
+		$download_info = $details['download_info'];
342 342
 
343 343
 		?>
344 344
         <div class="item <?php echo esc_attr( $details['item_class'] ); ?>">
@@ -367,25 +367,25 @@  discard block
 block discarded – undo
367 367
 	}
368 368
 
369 369
 	/**
370
-     * Generates details array for the download to keep the render_download() method a bit tidier
371
-     *
370
+	 * Generates details array for the download to keep the render_download() method a bit tidier
371
+	 *
372 372
 	 * @param array $download Single download, as returned by {@see get_downloads_data}
373 373
 	 * @param array $wp_plugins All active plugins, as returned by {@see get_plugins()}
374 374
 	 *
375 375
 	 * @return array {
376
-     *   @type array $download_info
377
-     *   @type string $plugin_path
378
-     *   @type string $status License status returned by Easy Digital Downloads ("active", "inactive", "expired", "revoked", etc)
379
-     *   @type string $status_label
380
-     *   @type string $button_title Title attribute to show when hovering over the download's button
381
-     *   @type string $button_class CSS class to use for the button
382
-     *   @type string $button_label Text to use for the download's anchor link
383
-     *   @type string $href URL for the download's button
384
-     *   @type bool   $spinner Whether to show the spinner icon
385
-     *   @type string $item_class CSS class for the download container
386
-     *   @type string $required_license The name of the required license for the download ("Galactic" or "Interstellar")
387
-     *   @type bool   $is_active Is the current GravityView license (as entered in Settings) active?
388
-     * }
376
+	 *   @type array $download_info
377
+	 *   @type string $plugin_path
378
+	 *   @type string $status License status returned by Easy Digital Downloads ("active", "inactive", "expired", "revoked", etc)
379
+	 *   @type string $status_label
380
+	 *   @type string $button_title Title attribute to show when hovering over the download's button
381
+	 *   @type string $button_class CSS class to use for the button
382
+	 *   @type string $button_label Text to use for the download's anchor link
383
+	 *   @type string $href URL for the download's button
384
+	 *   @type bool   $spinner Whether to show the spinner icon
385
+	 *   @type string $item_class CSS class for the download container
386
+	 *   @type string $required_license The name of the required license for the download ("Galactic" or "Interstellar")
387
+	 *   @type bool   $is_active Is the current GravityView license (as entered in Settings) active?
388
+	 * }
389 389
 	 */
390 390
 	private function get_download_display_details( $download, $wp_plugins ) {
391 391
 
@@ -474,18 +474,18 @@  discard block
 block discarded – undo
474 474
 		}
475 475
 
476 476
 		return compact( 'download_info','plugin_path', 'status', 'status_label', 'button_title', 'button_class', 'button_label', 'href', 'spinner', 'item_class', 'required_license', 'is_active' );
477
-    }
477
+	}
478 478
 
479 479
 	/**
480
-     * Returns the base price for an extension
481
-     *
480
+	 * Returns the base price for an extension
481
+	 *
482 482
 	 * @param array $download
483 483
 	 *
484 484
 	 * @return float Base price for an extension. If not for sale separately, returns 0
485 485
 	 */
486 486
 	private function get_download_base_price( $download ) {
487 487
 
488
-	    $base_price = \GV\Utils::get( $download, 'pricing/amount', 0 );
488
+		$base_price = \GV\Utils::get( $download, 'pricing/amount', 0 );
489 489
 		$base_price = \GFCommon::to_number( $base_price );
490 490
 
491 491
 		unset( $download['pricing']['amount'] );
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 		}
497 497
 
498 498
 		return floatval( $base_price );
499
-    }
499
+	}
500 500
 
501 501
 	/**
502 502
 	 * Handle AJAX request to activate extension
@@ -514,8 +514,8 @@  discard block
 block discarded – undo
514 514
 
515 515
 		if ( is_wp_error( $result ) || ! is_plugin_active( $data['path'] ) ) {
516 516
 			wp_send_json_error( array(
517
-                'error' => sprintf( __( 'Plugin activation failed: %s', 'gravityview' ), $result->get_error_message() )
518
-            ) );
517
+				'error' => sprintf( __( 'Plugin activation failed: %s', 'gravityview' ), $result->get_error_message() )
518
+			) );
519 519
 		}
520 520
 
521 521
 		wp_send_json_success();
@@ -536,10 +536,10 @@  discard block
 block discarded – undo
536 536
 		deactivate_plugins( $data['path'] );
537 537
 
538 538
 		if( is_plugin_active( $data['path'] ) ) {
539
-            wp_send_json_error( array(
540
-                'error' => sprintf( __( 'Plugin deactivation failed.', 'gravityview' ) )
541
-            ) );
542
-        }
539
+			wp_send_json_error( array(
540
+				'error' => sprintf( __( 'Plugin deactivation failed.', 'gravityview' ) )
541
+			) );
542
+		}
543 543
 
544 544
 		wp_send_json_success();
545 545
 	}
Please login to merge, or discard this patch.
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 */
54 54
 	public function register_noconflict( $items ) {
55 55
 
56
-		$items[] = 'gravityview-admin-installer';
56
+		$items[ ] = 'gravityview-admin-installer';
57 57
 
58 58
 		return $items;
59 59
 	}
@@ -70,17 +70,17 @@  discard block
 block discarded – undo
70 70
 			return;
71 71
 		}
72 72
 
73
-		add_filter( 'plugins_api', function ( $data, $action, $args ) use ( $downloads_data ) {
73
+		add_filter( 'plugins_api', function( $data, $action, $args ) use ( $downloads_data ) {
74 74
 			foreach ( $downloads_data as $extension ) {
75
-				if ( empty( $extension['info'] ) || empty( $args->slug ) || $args->slug !== $extension['info']['slug'] ) {
75
+				if ( empty( $extension[ 'info' ] ) || empty( $args->slug ) || $args->slug !== $extension[ 'info' ][ 'slug' ] ) {
76 76
 					continue;
77 77
 				}
78 78
 
79
-				return (object) array(
80
-					'slug'          => $extension['info']['slug'],
81
-					'name'          => $extension['info']['title'],
82
-					'version'       => $extension['licensing']['version'],
83
-					'download_link' => $extension['files'][0]['file'],
79
+				return (object)array(
80
+					'slug'          => $extension[ 'info' ][ 'slug' ],
81
+					'name'          => $extension[ 'info' ][ 'title' ],
82
+					'version'       => $extension[ 'licensing' ][ 'version' ],
83
+					'download_link' => $extension[ 'files' ][ 0 ][ 'file' ],
84 84
 				);
85 85
 			}
86 86
 
@@ -142,13 +142,13 @@  discard block
 block discarded – undo
142 142
 
143 143
 		foreach ( $all_plugins as $path => $plugin ) {
144 144
 
145
-			if ( empty( $plugin['TextDomain'] ) ) {
145
+			if ( empty( $plugin[ 'TextDomain' ] ) ) {
146 146
 				continue;
147 147
 			}
148 148
 
149
-			$wp_plugins[ $plugin['TextDomain'] ] = array(
149
+			$wp_plugins[ $plugin[ 'TextDomain' ] ] = array(
150 150
 				'path'      => $path,
151
-				'version'   => $plugin['Version'],
151
+				'version'   => $plugin[ 'Version' ],
152 152
 				'activated' => is_plugin_active( $path )
153 153
 			);
154 154
 		}
@@ -230,13 +230,13 @@  discard block
 block discarded – undo
230 230
 
231 231
 		$downloads_data = json_decode( wp_remote_retrieve_body( $response ), true );
232 232
 
233
-		if ( empty( $downloads_data['products'] ) ) {
233
+		if ( empty( $downloads_data[ 'products' ] ) ) {
234 234
 			return array();
235 235
 		}
236 236
 
237
-		$this->set_downloads_data( $downloads_data['products'] );
237
+		$this->set_downloads_data( $downloads_data[ 'products' ] );
238 238
 
239
-		return $downloads_data['products'];
239
+		return $downloads_data[ 'products' ];
240 240
 	}
241 241
 
242 242
 	/**
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 
310 310
 				foreach ( $downloads_data as $extension ) {
311 311
 
312
-					if ( empty( $extension['info'] ) ) {
312
+					if ( empty( $extension[ 'info' ] ) ) {
313 313
 						continue;
314 314
 					}
315 315
 
@@ -338,28 +338,28 @@  discard block
 block discarded – undo
338 338
 
339 339
         $details = $this->get_download_display_details( $download, $wp_plugins );
340 340
 
341
-        $download_info = $details['download_info'];
341
+        $download_info = $details[ 'download_info' ];
342 342
 
343 343
 		?>
344
-        <div class="item <?php echo esc_attr( $details['item_class'] ); ?>">
344
+        <div class="item <?php echo esc_attr( $details[ 'item_class' ] ); ?>">
345 345
             <div class="addon-inner">
346
-                <a href="<?php echo esc_url( $download_info['link'] ); ?>" rel="external noreferrer noopener" title="<?php esc_html_e( 'Visit the plugin page', 'gravityview' ); ?>"><img class="thumbnail" src="<?php echo esc_attr( $download_info['thumbnail'] ); ?>" alt="" /></a>
347
-                <h3><?php echo esc_html( $download_info['title'] ); ?></h3>
346
+                <a href="<?php echo esc_url( $download_info[ 'link' ] ); ?>" rel="external noreferrer noopener" title="<?php esc_html_e( 'Visit the plugin page', 'gravityview' ); ?>"><img class="thumbnail" src="<?php echo esc_attr( $download_info[ 'thumbnail' ] ); ?>" alt="" /></a>
347
+                <h3><?php echo esc_html( $download_info[ 'title' ] ); ?></h3>
348 348
                 <div>
349
-                    <?php if( $details['status_label'] ) { ?>
350
-                    <div class="status <?php echo esc_attr( $details['status'] ); ?>" title="<?php printf( esc_attr__( 'Plugin status: %s', 'gravityview' ), esc_html( $details['status_label'] ) ); ?>">
351
-                        <span class="dashicons dashicons-admin-plugins"></span> <span class="status-label"><?php echo esc_html( $details['status_label'] ); ?></span>
349
+                    <?php if ( $details[ 'status_label' ] ) { ?>
350
+                    <div class="status <?php echo esc_attr( $details[ 'status' ] ); ?>" title="<?php printf( esc_attr__( 'Plugin status: %s', 'gravityview' ), esc_html( $details[ 'status_label' ] ) ); ?>">
351
+                        <span class="dashicons dashicons-admin-plugins"></span> <span class="status-label"><?php echo esc_html( $details[ 'status_label' ] ); ?></span>
352 352
                     </div>
353 353
 			        <?php } ?>
354 354
 
355
-                    <a data-status="<?php echo esc_attr( $details['status'] ); ?>" data-plugin-path="<?php echo esc_attr( $details['plugin_path'] ); ?>" href="<?php echo esc_url( $details['href'] ); ?>" class="button <?php echo esc_attr( $details['button_class'] ); ?>" title="<?php echo esc_attr( $details['button_title'] ); ?>">
356
-                        <span class="title"><?php echo esc_html( $details['button_label'] ); ?></span>
357
-                        <?php if( $details['spinner'] ) { ?><span class="spinner"></span><?php } ?>
355
+                    <a data-status="<?php echo esc_attr( $details[ 'status' ] ); ?>" data-plugin-path="<?php echo esc_attr( $details[ 'plugin_path' ] ); ?>" href="<?php echo esc_url( $details[ 'href' ] ); ?>" class="button <?php echo esc_attr( $details[ 'button_class' ] ); ?>" title="<?php echo esc_attr( $details[ 'button_title' ] ); ?>">
356
+                        <span class="title"><?php echo esc_html( $details[ 'button_label' ] ); ?></span>
357
+                        <?php if ( $details[ 'spinner' ] ) { ?><span class="spinner"></span><?php } ?>
358 358
                     </a>
359 359
                 </div>
360 360
 
361 361
                 <div class="addon-excerpt">
362
-					<?php echo wpautop( esc_html( $download_info['excerpt'] ) ); ?>
362
+					<?php echo wpautop( esc_html( $download_info[ 'excerpt' ] ) ); ?>
363 363
                 </div>
364 364
             </div>
365 365
         </div>
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 	 */
390 390
 	private function get_download_display_details( $download, $wp_plugins ) {
391 391
 
392
-		$download_info = wp_parse_args( (array) $download['info'], array(
392
+		$download_info = wp_parse_args( (array)$download[ 'info' ], array(
393 393
 			'thumbnail' => '',
394 394
 			'title' => '',
395 395
 			'textdomain' => '',
@@ -398,9 +398,9 @@  discard block
 block discarded – undo
398 398
 			'link' => '',
399 399
 		) );
400 400
 
401
-		$wp_plugin = \GV\Utils::get( $wp_plugins, $download_info['textdomain'], false );
401
+		$wp_plugin = \GV\Utils::get( $wp_plugins, $download_info[ 'textdomain' ], false );
402 402
 
403
-		$has_access = ! empty( $download['files'] );
403
+		$has_access = ! empty( $download[ 'files' ] );
404 404
 		$spinner = true;
405 405
 		$href = $plugin_path = '#';
406 406
 		$status = $item_class = $button_title = $button_class = '';
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 		$required_license = $galactic_only ? __( 'Galactic', 'gravityview' ) : __( 'Interstellar', 'gravityview' );
411 411
 
412 412
 		// The license is not active - no matter what level, this should not work
413
-		if( ! $is_active  && empty( $base_price ) ) {
413
+		if ( ! $is_active && empty( $base_price ) ) {
414 414
 			$spinner      = false;
415 415
 			$button_class = 'disabled disabled-license';
416 416
 			$button_label = sprintf( __( 'Active %s License is Required.', 'gravityview' ), $required_license );
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 			$status_label = '';
423 423
 			$button_label = sprintf( __( 'Purchase Now for %s', 'gravityview' ), '$' . $base_price );
424 424
 			$button_class = 'button-primary button-large';
425
-			$href         = $download_info['link'];
425
+			$href         = $download_info[ 'link' ];
426 426
 			$item_class   = 'featured';
427 427
 		}
428 428
 
@@ -441,8 +441,8 @@  discard block
 block discarded – undo
441 441
 			$href = add_query_arg(
442 442
 				array(
443 443
 					'action'   => 'install-plugin',
444
-					'plugin'   => $download_info['slug'],
445
-					'_wpnonce' => wp_create_nonce( 'install-plugin_' . $download_info['slug'] ),
444
+					'plugin'   => $download_info[ 'slug' ],
445
+					'_wpnonce' => wp_create_nonce( 'install-plugin_' . $download_info[ 'slug' ] ),
446 446
 				),
447 447
 				self_admin_url( 'update.php' )
448 448
 			);
@@ -454,26 +454,26 @@  discard block
 block discarded – undo
454 454
 		}
455 455
 
456 456
 		// Access and the plugin is installed but not active
457
-		else if ( false === $wp_plugin['activated'] ) {
457
+		else if ( false === $wp_plugin[ 'activated' ] ) {
458 458
 
459 459
 			$status = 'inactive';
460 460
 			$status_label = __( 'Inactive', 'gravityview' );
461 461
 			$button_label = __( 'Activate', 'gravityview' );
462
-			$plugin_path = $wp_plugin['path'];
462
+			$plugin_path = $wp_plugin[ 'path' ];
463 463
 
464 464
 		}
465 465
 
466 466
 		// Access and the plugin is installed and active
467 467
 		else {
468 468
 
469
-			$plugin_path = $wp_plugin['path'];
469
+			$plugin_path = $wp_plugin[ 'path' ];
470 470
 			$status = 'active';
471 471
 			$status_label = __( 'Active', 'gravityview' );
472 472
 			$button_label = __( 'Deactivate', 'gravityview' );
473 473
 
474 474
 		}
475 475
 
476
-		return compact( 'download_info','plugin_path', 'status', 'status_label', 'button_title', 'button_class', 'button_label', 'href', 'spinner', 'item_class', 'required_license', 'is_active' );
476
+		return compact( 'download_info', 'plugin_path', 'status', 'status_label', 'button_title', 'button_class', 'button_label', 'href', 'spinner', 'item_class', 'required_license', 'is_active' );
477 477
     }
478 478
 
479 479
 	/**
@@ -488,11 +488,11 @@  discard block
 block discarded – undo
488 488
 	    $base_price = \GV\Utils::get( $download, 'pricing/amount', 0 );
489 489
 		$base_price = \GFCommon::to_number( $base_price );
490 490
 
491
-		unset( $download['pricing']['amount'] );
491
+		unset( $download[ 'pricing' ][ 'amount' ] );
492 492
 
493 493
 		// Price options array, not single price
494
-		if ( ! $base_price && ! empty( $download['pricing'] ) ) {
495
-			$base_price = array_shift( $download['pricing'] );
494
+		if ( ! $base_price && ! empty( $download[ 'pricing' ] ) ) {
495
+			$base_price = array_shift( $download[ 'pricing' ] );
496 496
 		}
497 497
 
498 498
 		return floatval( $base_price );
@@ -506,13 +506,13 @@  discard block
 block discarded – undo
506 506
 	public function activate_download() {
507 507
 		$data = \GV\Utils::_POST( 'data', array() );
508 508
 
509
-		if ( empty( $data['path'] ) ) {
509
+		if ( empty( $data[ 'path' ] ) ) {
510 510
 			return;
511 511
 		}
512 512
 
513
-		$result = activate_plugin( $data['path'] );
513
+		$result = activate_plugin( $data[ 'path' ] );
514 514
 
515
-		if ( is_wp_error( $result ) || ! is_plugin_active( $data['path'] ) ) {
515
+		if ( is_wp_error( $result ) || ! is_plugin_active( $data[ 'path' ] ) ) {
516 516
 			wp_send_json_error( array(
517 517
                 'error' => sprintf( __( 'Plugin activation failed: %s', 'gravityview' ), $result->get_error_message() )
518 518
             ) );
@@ -529,13 +529,13 @@  discard block
 block discarded – undo
529 529
 	public function deactivate_download() {
530 530
 		$data = \GV\Utils::_POST( 'data', array() );
531 531
 
532
-		if ( empty( $data['path'] ) ) {
532
+		if ( empty( $data[ 'path' ] ) ) {
533 533
 			return;
534 534
 		}
535 535
 
536
-		deactivate_plugins( $data['path'] );
536
+		deactivate_plugins( $data[ 'path' ] );
537 537
 
538
-		if( is_plugin_active( $data['path'] ) ) {
538
+		if ( is_plugin_active( $data[ 'path' ] ) ) {
539 539
             wp_send_json_error( array(
540 540
                 'error' => sprintf( __( 'Plugin deactivation failed.', 'gravityview' ) )
541 541
             ) );
Please login to merge, or discard this patch.
future/includes/class-gv-settings-addon.php 2 patches
Indentation   +121 added lines, -121 removed lines patch added patch discarded remove patch
@@ -134,28 +134,28 @@  discard block
 block discarded – undo
134 134
 	 */
135 135
 	public function add_network_menu() {
136 136
 
137
-	    if ( ! gravityview()->plugin->is_network_activated() ) {
137
+		if ( ! gravityview()->plugin->is_network_activated() ) {
138 138
 			return;
139 139
 		}
140 140
 
141
-        add_menu_page( __( 'Settings', 'gravityview' ), __( 'GravityView', 'gravityview' ), $this->_capabilities_app_settings, "{$this->_slug}_settings", array( $this, 'app_tab_page' ), 'none' );
141
+		add_menu_page( __( 'Settings', 'gravityview' ), __( 'GravityView', 'gravityview' ), $this->_capabilities_app_settings, "{$this->_slug}_settings", array( $this, 'app_tab_page' ), 'none' );
142 142
 	}
143 143
 
144 144
 	/**
145
-     * Uninstall all traces of GravityView
146
-     *
147
-     * Note: method is public because parent method is public
148
-     *
145
+	 * Uninstall all traces of GravityView
146
+	 *
147
+	 * Note: method is public because parent method is public
148
+	 *
149 149
 	 * @return bool
150 150
 	 */
151 151
 	public function uninstall() {
152 152
 		gravityview()->plugin->uninstall();
153 153
 
154 154
 		/**
155
-         * Set the path so that Gravity Forms can de-activate GravityView
156
-         * @see GFAddOn::uninstall_addon
157
-         * @uses deactivate_plugins()
158
-         */
155
+		 * Set the path so that Gravity Forms can de-activate GravityView
156
+		 * @see GFAddOn::uninstall_addon
157
+		 * @uses deactivate_plugins()
158
+		 */
159 159
 		$this->_path = GRAVITYVIEW_FILE;
160 160
 
161 161
 		return true;
@@ -185,42 +185,42 @@  discard block
 block discarded – undo
185 185
 	}
186 186
 
187 187
 	/**
188
-     * Get an array of reasons why the plugin might be uninstalled
189
-     *
190
-     * @since 1.17.5
191
-     *
188
+	 * Get an array of reasons why the plugin might be uninstalled
189
+	 *
190
+	 * @since 1.17.5
191
+	 *
192 192
 	 * @return array Array of reasons with the label and followup questions for each uninstall reason
193 193
 	 */
194 194
 	private function get_uninstall_reasons() {
195 195
 		$reasons = array(
196 196
 			'will-continue' => array(
197
-                'label' => esc_html__( 'I am going to continue using GravityView', 'gravityview' ),
198
-            ),
197
+				'label' => esc_html__( 'I am going to continue using GravityView', 'gravityview' ),
198
+			),
199 199
 			'no-longer-need' => array(
200
-                'label' => esc_html__( 'I no longer need GravityView', 'gravityview' ),
201
-            ),
200
+				'label' => esc_html__( 'I no longer need GravityView', 'gravityview' ),
201
+			),
202 202
 			'doesnt-work' => array(
203
-                'label' => esc_html__( 'The plugin doesn\'t work', 'gravityview' ),
204
-            ),
203
+				'label' => esc_html__( 'The plugin doesn\'t work', 'gravityview' ),
204
+			),
205 205
 			'found-other' => array(
206
-                'label' => esc_html__( 'I found a better plugin', 'gravityview' ),
207
-                'followup' => esc_attr__( 'What plugin you are using, and why?', 'gravityview' ),
208
-            ),
206
+				'label' => esc_html__( 'I found a better plugin', 'gravityview' ),
207
+				'followup' => esc_attr__( 'What plugin you are using, and why?', 'gravityview' ),
208
+			),
209 209
 			'other' => array(
210
-                'label' => esc_html__( 'Other', 'gravityview' ),
211
-            ),
210
+				'label' => esc_html__( 'Other', 'gravityview' ),
211
+			),
212 212
 		);
213 213
 
214 214
 		shuffle( $reasons );
215 215
 
216 216
 		return $reasons;
217
-    }
217
+	}
218 218
 
219 219
 	/**
220
-     * Display a feedback form when the plugin is uninstalled
221
-     *
222
-     * @since 1.17.5
223
-     *
220
+	 * Display a feedback form when the plugin is uninstalled
221
+	 *
222
+	 * @since 1.17.5
223
+	 *
224 224
 	 * @return string HTML of the uninstallation form
225 225
 	 */
226 226
 	public function uninstall_form() {
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
             <h2><?php esc_html_e( 'Why did you uninstall GravityView?', 'gravityview' ); ?></h2>
301 301
             <ul>
302 302
 				<?php
303
-                $reasons = $this->get_uninstall_reasons();
303
+				$reasons = $this->get_uninstall_reasons();
304 304
 				foreach ( $reasons as $reason ) {
305 305
 					printf( '<li><label><input name="reason" type="radio" value="other" data-followup="%s"> %s</label></li>', Utils::get( $reason, 'followup' ), Utils::get( $reason, 'label' ) );
306 306
 				}
@@ -394,12 +394,12 @@  discard block
 block discarded – undo
394 394
 	}
395 395
 
396 396
 	public function app_settings_tab() {
397
-	    parent::app_settings_tab();
397
+		parent::app_settings_tab();
398 398
 
399 399
 		if ( $this->maybe_uninstall() ) {
400
-            echo $this->uninstall_form();
400
+			echo $this->uninstall_form();
401 401
 		}
402
-    }
402
+	}
403 403
 
404 404
 	/**
405 405
 	 * The Settings title
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
 	 * @return array The settings.
485 485
 	 */
486 486
 	public function all() {
487
-	    return wp_parse_args( get_option( 'gravityformsaddon_' . $this->_slug . '_app_settings', array() ), $this->defaults() );
487
+		return wp_parse_args( get_option( 'gravityformsaddon_' . $this->_slug . '_app_settings', array() ), $this->defaults() );
488 488
 	}
489 489
 
490 490
 	/**
@@ -553,8 +553,8 @@  discard block
 block discarded – undo
553 553
                     type="' . $field['type'] . '"
554 554
                     name="' . esc_attr( $name ) . '"
555 555
                     value="' . $value . '" ' .
556
-		        implode( ' ', $attributes ) .
557
-		        ' />';
556
+				implode( ' ', $attributes ) .
557
+				' />';
558 558
 
559 559
 		if ( $echo ) {
560 560
 			echo $html;
@@ -572,12 +572,12 @@  discard block
 block discarded – undo
572 572
 	}
573 573
 
574 574
 	/**
575
-     * Check whether GravityView is being saved
576
-     *
577
-     * The generic is_save_postback() is true for all addons
578
-     *
579
-     * @since 2.0.8
580
-     *
575
+	 * Check whether GravityView is being saved
576
+	 *
577
+	 * The generic is_save_postback() is true for all addons
578
+	 *
579
+	 * @since 2.0.8
580
+	 *
581 581
 	 * @return bool
582 582
 	 */
583 583
 	public function is_save_postback() {
@@ -591,16 +591,16 @@  discard block
 block discarded – undo
591 591
 	 */
592 592
 	public function license_key_notice() {
593 593
 
594
-	    if( $this->is_save_postback() ) {
595
-		    $settings = $this->get_posted_settings();
596
-		    $license_key = \GV\Utils::get( $settings, 'license_key' );
597
-		    $license_status = \GV\Utils::get( $settings, 'license_key_status', 'inactive' );
598
-        } else {
599
-		    $license_status = $this->get( 'license_key_status', 'inactive' );
600
-		    $license_key    = $this->get( 'license_key' );
601
-	    }
594
+		if( $this->is_save_postback() ) {
595
+			$settings = $this->get_posted_settings();
596
+			$license_key = \GV\Utils::get( $settings, 'license_key' );
597
+			$license_status = \GV\Utils::get( $settings, 'license_key_status', 'inactive' );
598
+		} else {
599
+			$license_status = $this->get( 'license_key_status', 'inactive' );
600
+			$license_key    = $this->get( 'license_key' );
601
+		}
602 602
 
603
-	    $license_id = empty( $license_key ) ? 'license' : $license_key;
603
+		$license_id = empty( $license_key ) ? 'license' : $license_key;
604 604
 
605 605
 		$message = esc_html__( 'Your GravityView license %s. This means you&rsquo;re missing out on updates and support! %sActivate your license%s or %sget a license here%s.', 'gravityview' );
606 606
 
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
 		$update_below = false;
618 618
 		$primary_button_link = admin_url( 'edit.php?post_type=gravityview&amp;page=gravityview_settings' );
619 619
 
620
-        switch ( $license_status ) {
620
+		switch ( $license_status ) {
621 621
 			/** @since 1.17 */
622 622
 			case 'expired':
623 623
 				$title = __( 'Expired License', 'gravityview' );
@@ -655,13 +655,13 @@  discard block
 block discarded – undo
655 655
 			return;
656 656
 		}
657 657
 
658
-        \GravityView_Admin_Notices::add_notice( array(
659
-            'message' => $message,
660
-            'class'   => 'notice notice-warning',
661
-            'title'   => $title,
662
-            'cap'     => 'gravityview_edit_settings',
663
-            'dismiss' => sha1( $license_status . '_' . $license_id . '_' . date( 'z' ) ), // Show every day, instead of every 8 weeks (which is the default)
664
-        ) );
658
+		\GravityView_Admin_Notices::add_notice( array(
659
+			'message' => $message,
660
+			'class'   => 'notice notice-warning',
661
+			'title'   => $title,
662
+			'cap'     => 'gravityview_edit_settings',
663
+			'dismiss' => sha1( $license_status . '_' . $license_id . '_' . date( 'z' ) ), // Show every day, instead of every 8 weeks (which is the default)
664
+		) );
665 665
 	}
666 666
 
667 667
 	/**
@@ -675,12 +675,12 @@  discard block
 block discarded – undo
675 675
 	}
676 676
 
677 677
 	/**
678
-     * Add tooltip script to app settings page. Not enqueued by Gravity Forms for some reason.
679
-     *
680
-     * @since 1.21.5
681
-     *
682
-     * @see GFAddOn::scripts()
683
-     *
678
+	 * Add tooltip script to app settings page. Not enqueued by Gravity Forms for some reason.
679
+	 *
680
+	 * @since 1.21.5
681
+	 *
682
+	 * @see GFAddOn::scripts()
683
+	 *
684 684
 	 * @return array Array of scripts
685 685
 	 */
686 686
 	public function scripts() {
@@ -689,10 +689,10 @@  discard block
 block discarded – undo
689 689
 		$scripts[] = array(
690 690
 			'handle'  => 'gform_tooltip_init',
691 691
 			'enqueue' => array(
692
-                array(
693
-			        'admin_page' => array( 'app_settings' )
694
-                )
695
-            )
692
+				array(
693
+					'admin_page' => array( 'app_settings' )
694
+				)
695
+			)
696 696
 		);
697 697
 
698 698
 		return $scripts;
@@ -710,10 +710,10 @@  discard block
 block discarded – undo
710 710
 			'src'     => plugins_url( 'assets/css/admin-settings.css', GRAVITYVIEW_FILE ),
711 711
 			'version' => Plugin::$version,
712 712
 			'deps' => array(
713
-                'gform_admin',
713
+				'gform_admin',
714 714
 				'gaddon_form_settings_css',
715
-                'gform_tooltip',
716
-                'gform_font_awesome',
715
+				'gform_tooltip',
716
+				'gform_font_awesome',
717 717
 			),
718 718
 			'enqueue' => array(
719 719
 				array( 'admin_page' => array(
@@ -881,7 +881,7 @@  discard block
 block discarded – undo
881 881
 					array(
882 882
 						'label' => _x( 'Show me beta versions if they are available.', 'gravityview' ),
883 883
 						'value' => '1',
884
-                        'name'  => 'beta',
884
+						'name'  => 'beta',
885 885
 					),
886 886
 				),
887 887
 				'description'   => __( 'You will have early access to the latest GravityView features and improvements. There may be bugs! If you encounter an issue, help make GravityView better by reporting it!', 'gravityview' ),
@@ -919,38 +919,38 @@  discard block
 block discarded – undo
919 919
 
920 920
 			if ( empty( $field['disabled'] ) ) {
921 921
 				unset( $field['disabled'] );
922
-            }
922
+			}
923 923
 		}
924 924
 
925
-        $sections = array(
926
-            array(
927
-                'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __( 'You are running GravityView version %s', 'gravityview' ), Plugin::$version ) ),
928
-                'fields'      => $fields,
929
-            )
930
-        );
925
+		$sections = array(
926
+			array(
927
+				'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __( 'You are running GravityView version %s', 'gravityview' ), Plugin::$version ) ),
928
+				'fields'      => $fields,
929
+			)
930
+		);
931 931
 
932
-        // custom 'update settings' button
933
-        $button = array(
934
-            'class' => 'button button-primary button-hero',
935
-            'type' => 'save',
936
-        );
932
+		// custom 'update settings' button
933
+		$button = array(
934
+			'class' => 'button button-primary button-hero',
935
+			'type' => 'save',
936
+		);
937 937
 
938 938
 		if ( $disabled_attribute ) {
939 939
 			$button['disabled'] = $disabled_attribute;
940 940
 		}
941 941
 
942
-        /**
943
-         * @filter `gravityview/settings/extension/sections` Modify the GravityView settings page
944
-         * Extensions can tap in here to insert their own section and settings.
945
-         * <code>
946
-         *   $sections[] = array(
947
-         *      'title' => __( 'GravityView My Extension Settings', 'gravityview' ),
948
-         *      'fields' => $settings,
949
-         *   );
950
-         * </code>
951
-         * @param array $extension_settings Empty array, ready for extension settings!
952
-         */
953
-        $extension_sections = apply_filters( 'gravityview/settings/extension/sections', array() );
942
+		/**
943
+		 * @filter `gravityview/settings/extension/sections` Modify the GravityView settings page
944
+		 * Extensions can tap in here to insert their own section and settings.
945
+		 * <code>
946
+		 *   $sections[] = array(
947
+		 *      'title' => __( 'GravityView My Extension Settings', 'gravityview' ),
948
+		 *      'fields' => $settings,
949
+		 *   );
950
+		 * </code>
951
+		 * @param array $extension_settings Empty array, ready for extension settings!
952
+		 */
953
+		$extension_sections = apply_filters( 'gravityview/settings/extension/sections', array() );
954 954
 
955 955
 		// If there are extensions, add a section for them
956 956
 		if ( ! empty( $extension_sections ) ) {
@@ -963,13 +963,13 @@  discard block
 block discarded – undo
963 963
 				}
964 964
 			}
965 965
 
966
-            $k = count( $extension_sections ) - 1 ;
967
-            $extension_sections[ $k ]['fields'][] = $button;
966
+			$k = count( $extension_sections ) - 1 ;
967
+			$extension_sections[ $k ]['fields'][] = $button;
968 968
 			$sections = array_merge( $sections, $extension_sections );
969 969
 		} else {
970
-            // add the 'update settings' button to the general section
971
-            $sections[0]['fields'][] = $button;
972
-        }
970
+			// add the 'update settings' button to the general section
971
+			$sections[0]['fields'][] = $button;
972
+		}
973 973
 
974 974
 		return $sections;
975 975
 	}
@@ -1023,9 +1023,9 @@  discard block
 block discarded – undo
1023 1023
 	 */
1024 1024
 	protected function settings_edd_license( $field, $echo = true ) {
1025 1025
 
1026
-	    if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) {
1027
-		    $field['input_type'] = 'password';
1028
-        }
1026
+		if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) {
1027
+			$field['input_type'] = 'password';
1028
+		}
1029 1029
 
1030 1030
 		$text = $this->settings_text( $field, false );
1031 1031
 
@@ -1042,9 +1042,9 @@  discard block
 block discarded – undo
1042 1042
 
1043 1043
 	/**
1044 1044
 	 * Allow pure HTML settings row
1045
-     *
1046
-     * @since 2.0.6
1047
-     *
1045
+	 *
1046
+	 * @since 2.0.6
1047
+	 *
1048 1048
 	 * @param array $field
1049 1049
 	 * @param bool $echo Whether to echo the
1050 1050
 	 *
@@ -1110,19 +1110,19 @@  discard block
 block discarded – undo
1110 1110
 	}
1111 1111
 
1112 1112
 	/**
1113
-     * Keep GravityView styling for `$field['description']`, even though Gravity Forms added support for it
1114
-     *
1115
-     * Converts `$field['description']` to `$field['gv_description']`
1116
-     * Converts `$field['subtitle']` to `$field['description']`
1117
-     *
1118
-     * @see \GV\Addon_Settings::single_setting_label Converts `gv_description` back to `description`
1119
-     * @see http://share.gravityview.co/P28uGp/2OIRKxog for image that shows subtitle vs description
1120
-     *
1121
-     * @since 1.21.5.2
1122
-     *
1113
+	 * Keep GravityView styling for `$field['description']`, even though Gravity Forms added support for it
1114
+	 *
1115
+	 * Converts `$field['description']` to `$field['gv_description']`
1116
+	 * Converts `$field['subtitle']` to `$field['description']`
1117
+	 *
1118
+	 * @see \GV\Addon_Settings::single_setting_label Converts `gv_description` back to `description`
1119
+	 * @see http://share.gravityview.co/P28uGp/2OIRKxog for image that shows subtitle vs description
1120
+	 *
1121
+	 * @since 1.21.5.2
1122
+	 *
1123 1123
 	 * @param array $field
1124
-     *
1125
-     * @return void
1124
+	 *
1125
+	 * @return void
1126 1126
 	 */
1127 1127
 	public function single_setting_row( $field ) {
1128 1128
 		$field['gv_description'] = Utils::get( $field, 'description' );
Please login to merge, or discard this patch.
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	 * @return array
103 103
 	 */
104 104
 	public function modify_app_settings_menu_title( $setting_tabs ) {
105
-		$setting_tabs[0]['label'] = __( 'GravityView Settings', 'gravityview' );
105
+		$setting_tabs[ 0 ][ 'label' ] = __( 'GravityView Settings', 'gravityview' );
106 106
 		return $setting_tabs;
107 107
 	}
108 108
 
@@ -308,15 +308,15 @@  discard block
 block discarded – undo
308 308
             </ul>
309 309
             <div class="gv-followup widefat">
310 310
                 <p><strong><label for="gv-reason-details"><?php esc_html_e( 'Comments', 'gravityview' ); ?></label></strong></p>
311
-                <textarea id="gv-reason-details" name="reason_details" data-default="<?php esc_attr_e('Please share your thoughts about GravityView', 'gravityview') ?>" placeholder="<?php esc_attr_e('Please share your thoughts about GravityView', 'gravityview'); ?>" class="large-text"></textarea>
311
+                <textarea id="gv-reason-details" name="reason_details" data-default="<?php esc_attr_e( 'Please share your thoughts about GravityView', 'gravityview' ) ?>" placeholder="<?php esc_attr_e( 'Please share your thoughts about GravityView', 'gravityview' ); ?>" class="large-text"></textarea>
312 312
             </div>
313 313
             <div class="scale-description">
314 314
                 <p><strong><?php esc_html_e( 'How likely are you to recommend GravityView?', 'gravityview' ); ?></strong></p>
315 315
                 <ul class="inline">
316 316
 					<?php
317 317
 					$i = 0;
318
-					while( $i < 11 ) {
319
-						echo '<li class="inline number-scale"><label><input name="likely_to_refer" id="likely_to_refer_'.$i.'" value="'.$i.'" type="radio"> '.$i.'</label></li>';
318
+					while ( $i < 11 ) {
319
+						echo '<li class="inline number-scale"><label><input name="likely_to_refer" id="likely_to_refer_' . $i . '" value="' . $i . '" type="radio"> ' . $i . '</label></li>';
320 320
 						$i++;
321 321
 					}
322 322
 					?>
@@ -533,15 +533,15 @@  discard block
 block discarded – undo
533 533
 	 * @return string The HTML
534 534
 	 */
535 535
 	public function as_html( $field, $echo = true ) {
536
-		$field['type']  = ( isset( $field['type'] ) && in_array( $field['type'], array( 'submit','reset','button' ) ) ) ? $field['type'] : 'submit';
536
+		$field[ 'type' ] = ( isset( $field[ 'type' ] ) && in_array( $field[ 'type' ], array( 'submit', 'reset', 'button' ) ) ) ? $field[ 'type' ] : 'submit';
537 537
 
538 538
 		$attributes    = $this->get_field_attributes( $field );
539 539
 		$default_value = Utils::get( $field, 'value', Utils::get( $field, 'default_value' ) );
540
-		$value         = $this->get( $field['name'], $default_value );
540
+		$value         = $this->get( $field[ 'name' ], $default_value );
541 541
 
542 542
 
543
-		$attributes['class'] = isset( $attributes['class'] ) ? esc_attr( $attributes['class'] ) : 'button-primary gfbutton';
544
-		$name    = ( $field['name'] === 'gform-settings-save' ) ? $field['name'] : '_gaddon_setting_' . $field['name'];
543
+		$attributes[ 'class' ] = isset( $attributes[ 'class' ] ) ? esc_attr( $attributes[ 'class' ] ) : 'button-primary gfbutton';
544
+		$name = ( $field[ 'name' ] === 'gform-settings-save' ) ? $field[ 'name' ] : '_gaddon_setting_' . $field[ 'name' ];
545 545
 
546 546
 		if ( empty( $value ) ) {
547 547
 			$value = __( 'Update Settings', 'gravityview' );
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
 		$attributes = $this->get_field_attributes( $field );
551 551
 
552 552
 		$html = '<input
553
-                    type="' . $field['type'] . '"
553
+                    type="' . $field[ 'type' ] . '"
554 554
                     name="' . esc_attr( $name ) . '"
555 555
                     value="' . $value . '" ' .
556 556
 		        implode( ' ', $attributes ) .
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
 	 * @return bool
582 582
 	 */
583 583
 	public function is_save_postback() {
584
-		return isset( $_POST['gform-settings-save'] ) && isset( $_POST['_gravityview_save_settings_nonce'] );
584
+		return isset( $_POST[ 'gform-settings-save' ] ) && isset( $_POST[ '_gravityview_save_settings_nonce' ] );
585 585
 	}
586 586
 
587 587
 	/**
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
 	 */
592 592
 	public function license_key_notice() {
593 593
 
594
-	    if( $this->is_save_postback() ) {
594
+	    if ( $this->is_save_postback() ) {
595 595
 		    $settings = $this->get_posted_settings();
596 596
 		    $license_key = \GV\Utils::get( $settings, 'license_key' );
597 597
 		    $license_status = \GV\Utils::get( $settings, 'license_key_status', 'inactive' );
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
 		 * but didn't want to mess up the translation strings for the translators.
613 613
 		 */
614 614
 		$message = mb_substr( $message, 0, mb_strlen( $message ) - 1 );
615
-		$title = __( 'Inactive License', 'gravityview');
615
+		$title = __( 'Inactive License', 'gravityview' );
616 616
 		$status = '';
617 617
 		$update_below = false;
618 618
 		$primary_button_link = admin_url( 'edit.php?post_type=gravityview&amp;page=gravityview_settings' );
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
 				$update_below = __( 'Activate your license key below.', 'gravityview' );
643 643
 				break;
644 644
 		}
645
-		$url = 'https://gravityview.co/pricing/?utm_source=admin_notice&utm_medium=admin&utm_content='.$license_status.'&utm_campaign=Admin%20Notice';
645
+		$url = 'https://gravityview.co/pricing/?utm_source=admin_notice&utm_medium=admin&utm_content=' . $license_status . '&utm_campaign=Admin%20Notice';
646 646
 
647 647
 		// Show a different notice on settings page for inactive licenses (hide the buttons)
648 648
 		if ( $update_below && gravityview_is_admin_page( '', 'settings' ) ) {
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
 	public function scripts() {
687 687
 		$scripts = parent::scripts();
688 688
 
689
-		$scripts[] = array(
689
+		$scripts[ ] = array(
690 690
 			'handle'  => 'gform_tooltip_init',
691 691
 			'enqueue' => array(
692 692
                 array(
@@ -705,7 +705,7 @@  discard block
 block discarded – undo
705 705
 	public function styles() {
706 706
 		$styles = parent::styles();
707 707
 
708
-		$styles[] = array(
708
+		$styles[ ] = array(
709 709
 			'handle'  => 'gravityview_settings',
710 710
 			'src'     => plugins_url( 'assets/css/admin-settings.css', GRAVITYVIEW_FILE ),
711 711
 			'version' => Plugin::$version,
@@ -736,7 +736,7 @@  discard block
 block discarded – undo
736 736
 		 * If multisite and not network admin, we don't want the settings to show.
737 737
 		 * @since 1.7.6
738 738
 		 */
739
-		$show_submenu = ( ! is_multisite() ) ||  is_main_site() || ( ! gravityview()->plugin->is_network_activated() ) || ( is_network_admin() && gravityview()->plugin->is_network_activated() );
739
+		$show_submenu = ( ! is_multisite() ) || is_main_site() || ( ! gravityview()->plugin->is_network_activated() ) || ( is_network_admin() && gravityview()->plugin->is_network_activated() );
740 740
 
741 741
 		/**
742 742
 		 * Override whether to show the Settings menu on a per-blog basis.
@@ -784,26 +784,26 @@  discard block
 block discarded – undo
784 784
 				'label' => __( 'License Key', 'gravityview' ),
785 785
 				'description' => __( 'Enter the license key that was sent to you on purchase. This enables plugin updates &amp; support.', 'gravityview' ) . $this->get_license_handler()->license_details( $this->get_app_setting( 'license_key_response' ) ),
786 786
 				'type' => 'edd_license',
787
-				'disabled' => ( defined( 'GRAVITYVIEW_LICENSE_KEY' )  && GRAVITYVIEW_LICENSE_KEY ),
787
+				'disabled' => ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ),
788 788
 				'data-pending-text' => __( 'Verifying license&hellip;', 'gravityview' ),
789
-				'default_value' => $default_settings['license_key'],
789
+				'default_value' => $default_settings[ 'license_key' ],
790 790
 				'class' => ( '' == $this->get( 'license_key' ) ) ? 'activate code regular-text edd-license-key' : 'deactivate code regular-text edd-license-key',
791 791
 			),
792 792
 			array(
793 793
 				'name' => 'license_key_response',
794
-				'default_value' => $default_settings['license_key_response'],
794
+				'default_value' => $default_settings[ 'license_key_response' ],
795 795
 				'type' => 'hidden',
796 796
 			),
797 797
 			array(
798 798
 				'name' => 'license_key_status',
799
-				'default_value' => $default_settings['license_key_status'],
799
+				'default_value' => $default_settings[ 'license_key_status' ],
800 800
 				'type' => 'hidden',
801 801
 			),
802 802
 			array(
803 803
 				'name' => 'support-email',
804 804
 				'type' => 'text',
805 805
 				'validate' => 'email',
806
-				'default_value' => $default_settings['support-email'],
806
+				'default_value' => $default_settings[ 'support-email' ],
807 807
 				'label' => __( 'Support Email', 'gravityview' ),
808 808
 				'description' => __( 'In order to provide responses to your support requests, please provide your email address.', 'gravityview' ),
809 809
 				'class' => 'code regular-text',
@@ -815,7 +815,7 @@  discard block
 block discarded – undo
815 815
 				'name' => 'support_port',
816 816
 				'type' => 'radio',
817 817
 				'label' => __( 'Show Support Port?', 'gravityview' ),
818
-				'default_value' => $default_settings['support_port'],
818
+				'default_value' => $default_settings[ 'support_port' ],
819 819
 				'horizontal' => 1,
820 820
 				'choices' => array(
821 821
 					array(
@@ -834,7 +834,7 @@  discard block
 block discarded – undo
834 834
 				'name' => 'no-conflict-mode',
835 835
 				'type' => 'radio',
836 836
 				'label' => __( 'No-Conflict Mode', 'gravityview' ),
837
-				'default_value' => $default_settings['no-conflict-mode'],
837
+				'default_value' => $default_settings[ 'no-conflict-mode' ],
838 838
 				'horizontal' => 1,
839 839
 				'choices' => array(
840 840
 					array(
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
 					'name' => 'rest_api',
857 857
 					'type' => 'radio',
858 858
 					'label' => __( 'REST API', 'gravityview' ),
859
-					'default_value' => $default_settings['rest_api'],
859
+					'default_value' => $default_settings[ 'rest_api' ],
860 860
 					'horizontal' => 1,
861 861
 					'choices' => array(
862 862
 						array(
@@ -875,7 +875,7 @@  discard block
 block discarded – undo
875 875
 				'name' => 'beta',
876 876
 				'type' => 'checkbox',
877 877
 				'label' => __( 'Become a Beta Tester', 'gravityview' ),
878
-				'default_value' => $default_settings['beta'],
878
+				'default_value' => $default_settings[ 'beta' ],
879 879
 				'horizontal' => 1,
880 880
 				'choices' => array(
881 881
 					array(
@@ -908,17 +908,17 @@  discard block
 block discarded – undo
908 908
 		 * @since 1.7.4
909 909
 		 */
910 910
 		foreach ( $fields as &$field ) {
911
-			$field['name']          = isset( $field['name'] ) ? $field['name'] : Utils::get( $field, 'id' );
912
-			$field['label']         = isset( $field['label'] ) ? $field['label'] : Utils::get( $field, 'title' );
913
-			$field['default_value'] = isset( $field['default_value'] ) ? $field['default_value'] : Utils::get( $field, 'default' );
914
-			$field['description']   = isset( $field['description'] ) ? $field['description'] : Utils::get( $field, 'subtitle' );
911
+			$field[ 'name' ]          = isset( $field[ 'name' ] ) ? $field[ 'name' ] : Utils::get( $field, 'id' );
912
+			$field[ 'label' ]         = isset( $field[ 'label' ] ) ? $field[ 'label' ] : Utils::get( $field, 'title' );
913
+			$field[ 'default_value' ] = isset( $field[ 'default_value' ] ) ? $field[ 'default_value' ] : Utils::get( $field, 'default' );
914
+			$field[ 'description' ]   = isset( $field[ 'description' ] ) ? $field[ 'description' ] : Utils::get( $field, 'subtitle' );
915 915
 
916 916
 			if ( $disabled_attribute ) {
917
-				$field['disabled']  = $disabled_attribute;
917
+				$field[ 'disabled' ] = $disabled_attribute;
918 918
 			}
919 919
 
920
-			if ( empty( $field['disabled'] ) ) {
921
-				unset( $field['disabled'] );
920
+			if ( empty( $field[ 'disabled' ] ) ) {
921
+				unset( $field[ 'disabled' ] );
922 922
             }
923 923
 		}
924 924
 
@@ -936,7 +936,7 @@  discard block
 block discarded – undo
936 936
         );
937 937
 
938 938
 		if ( $disabled_attribute ) {
939
-			$button['disabled'] = $disabled_attribute;
939
+			$button[ 'disabled' ] = $disabled_attribute;
940 940
 		}
941 941
 
942 942
         /**
@@ -955,20 +955,20 @@  discard block
 block discarded – undo
955 955
 		// If there are extensions, add a section for them
956 956
 		if ( ! empty( $extension_sections ) ) {
957 957
 
958
-			if( $disabled_attribute ) {
958
+			if ( $disabled_attribute ) {
959 959
 				foreach ( $extension_sections as &$section ) {
960
-					foreach ( $section['fields'] as &$field ) {
961
-						$field['disabled'] = $disabled_attribute;
960
+					foreach ( $section[ 'fields' ] as &$field ) {
961
+						$field[ 'disabled' ] = $disabled_attribute;
962 962
 					}
963 963
 				}
964 964
 			}
965 965
 
966
-            $k = count( $extension_sections ) - 1 ;
967
-            $extension_sections[ $k ]['fields'][] = $button;
966
+            $k = count( $extension_sections ) - 1;
967
+            $extension_sections[ $k ][ 'fields' ][ ] = $button;
968 968
 			$sections = array_merge( $sections, $extension_sections );
969 969
 		} else {
970 970
             // add the 'update settings' button to the general section
971
-            $sections[0]['fields'][] = $button;
971
+            $sections[ 0 ][ 'fields' ][ ] = $button;
972 972
         }
973 973
 
974 974
 		return $sections;
@@ -1024,7 +1024,7 @@  discard block
 block discarded – undo
1024 1024
 	protected function settings_edd_license( $field, $echo = true ) {
1025 1025
 
1026 1026
 	    if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) {
1027
-		    $field['input_type'] = 'password';
1027
+		    $field[ 'input_type' ] = 'password';
1028 1028
         }
1029 1029
 
1030 1030
 		$text = $this->settings_text( $field, false );
@@ -1073,7 +1073,7 @@  discard block
 block discarded – undo
1073 1073
 	public function single_setting_row_html( $field ) {
1074 1074
 		?>
1075 1075
 
1076
-        <tr id="gaddon-setting-row-<?php echo esc_attr( $field['name'] ); ?>">
1076
+        <tr id="gaddon-setting-row-<?php echo esc_attr( $field[ 'name' ] ); ?>">
1077 1077
             <td colspan="2">
1078 1078
 				<?php $this->single_setting( $field ); ?>
1079 1079
             </td>
@@ -1091,10 +1091,10 @@  discard block
 block discarded – undo
1091 1091
 	 * @return string
1092 1092
 	 */
1093 1093
 	public function settings_save( $field, $echo = true ) {
1094
-		$field['type']  = 'submit';
1095
-		$field['name']  = 'gform-settings-save';
1096
-		$field['class'] = isset( $field['class'] ) ? $field['class'] : 'button-primary gfbutton';
1097
-		$field['value'] = Utils::get( $field, 'value', __( 'Update Settings', 'gravityview' ) );
1094
+		$field[ 'type' ]  = 'submit';
1095
+		$field[ 'name' ]  = 'gform-settings-save';
1096
+		$field[ 'class' ] = isset( $field[ 'class' ] ) ? $field[ 'class' ] : 'button-primary gfbutton';
1097
+		$field[ 'value' ] = Utils::get( $field, 'value', __( 'Update Settings', 'gravityview' ) );
1098 1098
 
1099 1099
 		$output = $this->settings_submit( $field, false );
1100 1100
 
@@ -1125,8 +1125,8 @@  discard block
 block discarded – undo
1125 1125
      * @return void
1126 1126
 	 */
1127 1127
 	public function single_setting_row( $field ) {
1128
-		$field['gv_description'] = Utils::get( $field, 'description' );
1129
-		$field['description']    = Utils::get( $field, 'subtitle' );
1128
+		$field[ 'gv_description' ] = Utils::get( $field, 'description' );
1129
+		$field[ 'description' ]    = Utils::get( $field, 'subtitle' );
1130 1130
 		parent::single_setting_row( $field );
1131 1131
 	}
1132 1132
 
@@ -1138,7 +1138,7 @@  discard block
 block discarded – undo
1138 1138
 	public function single_setting_label( $field ) {
1139 1139
 		parent::single_setting_label( $field );
1140 1140
 		if ( $description = Utils::get( $field, 'gv_description' ) ) {
1141
-			echo '<span class="description">'. $description .'</span>';
1141
+			echo '<span class="description">' . $description . '</span>';
1142 1142
 		}
1143 1143
 	}
1144 1144
 
@@ -1175,9 +1175,9 @@  discard block
 block discarded – undo
1175 1175
 		// If the posted key doesn't match the activated/deactivated key (set using the Activate License button, AJAX response),
1176 1176
 		// then we assume it's changed. If it's changed, unset the status and the previous response.
1177 1177
 		if ( $local_key !== $response_key ) {
1178
-			unset( $posted_settings['license_key_response'] );
1179
-			unset( $posted_settings['license_key_status'] );
1180
-			\GFCommon::add_error_message( __('The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) );
1178
+			unset( $posted_settings[ 'license_key_response' ] );
1179
+			unset( $posted_settings[ 'license_key_status' ] );
1180
+			\GFCommon::add_error_message( __( 'The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) );
1181 1181
 		}
1182 1182
 		return $posted_settings;
1183 1183
 	}
Please login to merge, or discard this patch.
future/includes/class-gv-request-admin.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 			return false;
24 24
 		}
25 25
 
26
-		if( ! function_exists( '\get_current_screen' ) ) {
26
+		if ( ! function_exists( '\get_current_screen' ) ) {
27 27
 			return false;
28 28
 		}
29 29
 
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 			return true;
35 35
 		}
36 36
 
37
-		$context = $args[1];
37
+		$context = $args[ 1 ];
38 38
 
39 39
 		/**
40 40
 		 * Assume false by default.
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 				$is_page = 'single';
51 51
 			} else if ( $is_gv_settings = 'gravityview_page_gravityview_settings' === $current_screen->id ) {
52 52
 				$is_page = 'settings';
53
-			} else if( $is_extensions = 'gravityview_page_gv-admin-installer' === $current_screen->id ) {
53
+			} else if ( $is_extensions = 'gravityview_page_gv-admin-installer' === $current_screen->id ) {
54 54
 				$is_page = 'downloads';
55 55
 			}
56 56
 		}
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 		 * @param[in,out] string|bool $is_page If false, no. If string, the name of the page (`single`, `settings`, or `views`)
61 61
 		 * @param[in] string $hook The name of the page to check against. Is passed to the method.
62 62
 		 */
63
-		$is_page = apply_filters( 'gravityview_is_admin_page', $is_page, $args[0] );
63
+		$is_page = apply_filters( 'gravityview_is_admin_page', $is_page, $args[ 0 ] );
64 64
 
65 65
 		// If the current page is the same as the compared page
66 66
 		if ( ! empty( $context ) ) {
Please login to merge, or discard this patch.