Completed
Pull Request — develop (#1194)
by Zack
06:23
created
includes/fields/class-gravityview-field-address.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
 
61 61
 			if ( 'address' === \GV\Utils::get( $search_field, 'type' ) ) {
62 62
 
63
-				$field_id = intval( floor( $search_field['key'] ) );
64
-				$input_id = gravityview_get_input_id_from_id( $search_field['key'] );
63
+				$field_id = intval( floor( $search_field[ 'key' ] ) );
64
+				$input_id = gravityview_get_input_id_from_id( $search_field[ 'key' ] );
65 65
 				$form = GravityView_View::getInstance()->getForm();
66 66
 
67 67
 				/** @var GF_Field_Address $address_field */
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 				$choices = array();
71 71
 
72 72
 				$method_name = 'get_choices_' . self::get_input_type_from_input_id( $input_id );
73
-				if( method_exists( $this, $method_name ) ) {
73
+				if ( method_exists( $this, $method_name ) ) {
74 74
 					/**
75 75
 					 * @uses GravityView_Field_Address::get_choices_country()
76 76
 					 * @uses GravityView_Field_Address::get_choices_state()
@@ -78,12 +78,12 @@  discard block
 block discarded – undo
78 78
 					$choices = $this->{$method_name}( $address_field, $form );
79 79
 				}
80 80
 
81
-				if( ! empty( $choices ) ) {
82
-					$search_field['choices'] = $choices;
83
-					$search_field['type'] = \GV\Utils::get( $search_field, 'input');
81
+				if ( ! empty( $choices ) ) {
82
+					$search_field[ 'choices' ] = $choices;
83
+					$search_field[ 'type' ] = \GV\Utils::get( $search_field, 'input' );
84 84
 				} else {
85
-					$search_field['type'] = 'text';
86
-					$search_field['input'] = 'input_text';
85
+					$search_field[ 'type' ] = 'text';
86
+					$search_field[ 'input' ] = 'input_text';
87 87
 				}
88 88
 			}
89 89
 		}
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 		$country_choices = array();
110 110
 
111 111
 		foreach ( $countries as $key => $country ) {
112
-			$country_choices[] = array(
112
+			$country_choices[ ] = array(
113 113
 				'value' => $country,
114 114
 				'text' => $country,
115 115
 			);
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	 */
135 135
 	private function get_choices_state( $address_field, $form ) {
136 136
 
137
-		$address_type = empty( $address_field->addressType ) ? $address_field->get_default_address_type( $form['id'] ) : $address_field->addressType;
137
+		$address_type = empty( $address_field->addressType ) ? $address_field->get_default_address_type( $form[ 'id' ] ) : $address_field->addressType;
138 138
 
139 139
 		$state_choices = array();
140 140
 
@@ -146,8 +146,8 @@  discard block
 block discarded – undo
146 146
 				$states = GFCommon::get_canadian_provinces();
147 147
 				break;
148 148
 			default:
149
-				$address_types = $address_field->get_address_types( $form['id'] );
150
-				$states = empty( $address_types[ $address_type ]['states'] ) ? array() : $address_types[ $address_type ]['states'];
149
+				$address_types = $address_field->get_address_types( $form[ 'id' ] );
150
+				$states = empty( $address_types[ $address_type ][ 'states' ] ) ? array() : $address_types[ $address_type ][ 'states' ];
151 151
 				break;
152 152
 		}
153 153
 
@@ -156,19 +156,19 @@  discard block
 block discarded – undo
156 156
 				$state_subchoices = array();
157 157
 
158 158
 				foreach ( $state as $substate ) {
159
-					$state_subchoices[] = array(
159
+					$state_subchoices[ ] = array(
160 160
 						'value' => $substate,
161 161
 						'text' => $substate,
162 162
 					);
163 163
 				}
164 164
 
165
-				$state_choices[] = array(
165
+				$state_choices[ ] = array(
166 166
 					'text' => $key,
167 167
 					'value' => $state_subchoices,
168 168
 				);
169 169
 
170 170
 			} else {
171
-				$state_choices[] = array(
171
+				$state_choices[ ] = array(
172 172
 					'value' => $state,
173 173
 					'text' => $state,
174 174
 				);
@@ -192,13 +192,13 @@  discard block
 block discarded – undo
192 192
 		// Use the same inputs as the "text" input type allows
193 193
 		$text_inputs = \GV\Utils::get( $input_types, 'text' );
194 194
 
195
-		$input_types['street'] = $text_inputs;
196
-		$input_types['street2'] = $text_inputs;
197
-		$input_types['city'] = $text_inputs;
195
+		$input_types[ 'street' ] = $text_inputs;
196
+		$input_types[ 'street2' ] = $text_inputs;
197
+		$input_types[ 'city' ] = $text_inputs;
198 198
 
199
-		$input_types['state'] = array( 'select', 'radio', 'link' ) + $text_inputs;
200
-		$input_types['zip'] = array( 'input_text' );
201
-		$input_types['country'] = array( 'select', 'radio', 'link' ) + $text_inputs;
199
+		$input_types[ 'state' ] = array( 'select', 'radio', 'link' ) + $text_inputs;
200
+		$input_types[ 'zip' ] = array( 'input_text' );
201
+		$input_types[ 'country' ] = array( 'select', 'radio', 'link' ) + $text_inputs;
202 202
 
203 203
 		return $input_types;
204 204
 	}
@@ -219,10 +219,10 @@  discard block
 block discarded – undo
219 219
 		// Is this search field for an input (eg: 4.2) or the whole address field (eg: 4)?
220 220
 		$input_id = gravityview_get_input_id_from_id( $field_id );
221 221
 
222
-		if( 'address' === $field_type && $input_id ) {
222
+		if ( 'address' === $field_type && $input_id ) {
223 223
 
224 224
 			// If the input ID matches an expected address input, set to that. Otherwise, keep existing input type.
225
-			if( $address_field_name = self::get_input_type_from_input_id( $input_id ) ) {
225
+			if ( $address_field_name = self::get_input_type_from_input_id( $input_id ) ) {
226 226
 				$input_type = $address_field_name;
227 227
 			}
228 228
 		}
@@ -271,20 +271,20 @@  discard block
 block discarded – undo
271 271
 	function field_options( $field_options, $template_id = '', $field_id = '', $context = '', $input_type = '' ) {
272 272
 
273 273
 		// If this is NOT the full address field, return default options.
274
-		if( floor( $field_id ) !== floatval( $field_id ) ) {
274
+		if ( floor( $field_id ) !== floatval( $field_id ) ) {
275 275
 			return $field_options;
276 276
 		}
277 277
 
278
-		if( 'edit' === $context ) {
278
+		if ( 'edit' === $context ) {
279 279
 			return $field_options;
280 280
 		}
281 281
 
282 282
 		$add_options = array();
283 283
 
284
-		$add_options['show_map_link'] = array(
284
+		$add_options[ 'show_map_link' ] = array(
285 285
 			'type' => 'checkbox',
286 286
 			'label' => __( 'Show Map Link:', 'gravityview' ),
287
-			'desc' => __('Display a "Map It" link below the address', 'gravityview'),
287
+			'desc' => __( 'Display a "Map It" link below the address', 'gravityview' ),
288 288
 			'value' => true,
289 289
 			'merge_tags' => false,
290 290
 		);
Please login to merge, or discard this patch.
future/includes/rest/class-gv-rest-views-route.php 1 patch
Spacing   +25 added lines, -25 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
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 		// Only output the fields that should be displayed.
115 115
 		$allowed = array();
116 116
 		foreach ( $view->fields->by_position( "{$context}_*" )->by_visible()->all() as $field ) {
117
-			$allowed[] = $field;
117
+			$allowed[ ] = $field;
118 118
 		}
119 119
 
120 120
 		/**
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 
134 134
 		// Tack on additional fields if needed
135 135
 		foreach ( array_diff( $allowed_field_ids, wp_list_pluck( $allowed, 'ID' ) ) as $field_id ) {
136
-			$allowed[] = is_numeric( $field_id ) ? \GV\GF_Field::by_id( $view->form, $field_id ) : \GV\Internal_Field::by_id( $field_id );
136
+			$allowed[ ] = is_numeric( $field_id ) ? \GV\GF_Field::by_id( $view->form, $field_id ) : \GV\Internal_Field::by_id( $field_id );
137 137
 		}
138 138
 
139 139
 		$r = new Request( $request );
@@ -201,10 +201,10 @@  discard block
 block discarded – undo
201 201
 	public function get_sub_items( $request ) {
202 202
 
203 203
 		$url     = $request->get_url_params();
204
-		$view_id = intval( $url['id'] );
204
+		$view_id = intval( $url[ 'id' ] );
205 205
 		$format  = \GV\Utils::get( $url, 'format', 'json' );
206 206
 
207
-		if( $post_id = $request->get_param('post_id') ) {
207
+		if ( $post_id = $request->get_param( 'post_id' ) ) {
208 208
 			global $post;
209 209
 
210 210
 			$post = get_post( $post_id );
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 
303 303
 		$data = array( 'entries' => $entries->all(), 'total' => $entries->total() );
304 304
 
305
-		foreach ( $data['entries'] as &$entry ) {
305
+		foreach ( $data[ 'entries' ] as &$entry ) {
306 306
 			$entry = $this->prepare_entry_for_response( $view, $entry, $request, 'directory' );
307 307
 		}
308 308
 
@@ -321,8 +321,8 @@  discard block
 block discarded – undo
321 321
 	 */
322 322
 	public function get_sub_item( $request ) {
323 323
 		$url      = $request->get_url_params();
324
-		$view_id  = intval( $url['id'] );
325
-		$entry_id = intval( $url['s_id'] );
324
+		$view_id  = intval( $url[ 'id' ] );
325
+		$entry_id = intval( $url[ 's_id' ] );
326 326
 		$format   = \GV\Utils::get( $url, 'format', 'json' );
327 327
 
328 328
 		$view  = \GV\View::by_id( $view_id );
@@ -357,32 +357,32 @@  discard block
 block discarded – undo
357 357
 		// Add all the WP_Post data
358 358
 		$view_post = $view_post->to_array();
359 359
 
360
-		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'] );
360
+		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' ] );
361 361
 
362 362
 		$return = wp_parse_args( $item, $view_post );
363 363
 
364
-		$return['title'] = $return['post_title'];
364
+		$return[ 'title' ] = $return[ 'post_title' ];
365 365
 
366
-		$return['settings'] = isset( $return['atts'] ) ? $return['atts'] : array();
367
-		unset( $return['atts'], $return['view_id'] );
366
+		$return[ 'settings' ] = isset( $return[ 'atts' ] ) ? $return[ 'atts' ] : array();
367
+		unset( $return[ 'atts' ], $return[ 'view_id' ] );
368 368
 
369
-		$return['search_criteria'] = array(
369
+		$return[ 'search_criteria' ] = array(
370 370
 			'page_size' => rgars( $return, 'settings/page_size' ),
371 371
 			'sort_field' => rgars( $return, 'settings/sort_field' ),
372 372
 			'sort_direction' => rgars( $return, 'settings/sort_direction' ),
373 373
 			'offset' => rgars( $return, 'settings/offset' ),
374 374
 		);
375 375
 
376
-		unset( $return['settings']['page_size'], $return['settings']['sort_field'], $return['settings']['sort_direction'] );
376
+		unset( $return[ 'settings' ][ 'page_size' ], $return[ 'settings' ][ 'sort_field' ], $return[ 'settings' ][ 'sort_direction' ] );
377 377
 
378 378
 		// Redact for non-logged ins
379 379
 		if ( ! \GVCommon::has_cap( 'edit_others_gravityviews' ) ) {
380
-			unset( $return['settings'] );
381
-			unset( $return['search_criteria'] );
380
+			unset( $return[ 'settings' ] );
381
+			unset( $return[ 'search_criteria' ] );
382 382
 		}
383 383
 		
384 384
 		if ( ! \GFCommon::current_user_can_any( 'gravityforms_edit_forms' ) ) {
385
-			unset( $return['form'] );
385
+			unset( $return[ 'form' ] );
386 386
 		}
387 387
 
388 388
 		return $return;
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 			$view_id = func_get_arg( 1 ); // $view_id override
399 399
 		} else {
400 400
 			$url     = $request->get_url_params();
401
-			$view_id = intval( $url['id'] );
401
+			$view_id = intval( $url[ 'id' ] );
402 402
 		}
403 403
 
404 404
 		if ( ! $view = \GV\View::by_id( $view_id ) ) {
@@ -444,8 +444,8 @@  discard block
 block discarded – undo
444 444
 		}
445 445
 
446 446
 		$url     = $request->get_url_params();
447
-		$view_id = intval( $url['id'] );
448
-		$entry_id = intval( $url['s_id'] );
447
+		$view_id = intval( $url[ 'id' ] );
448
+		$entry_id = intval( $url[ 's_id' ] );
449 449
 
450 450
 		$view = \GV\View::by_id( $view_id );
451 451
 
@@ -453,11 +453,11 @@  discard block
 block discarded – undo
453 453
 			return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' );
454 454
 		}
455 455
 
456
-		if ( $entry['form_id'] != $view->form->ID ) {
456
+		if ( $entry[ 'form_id' ] != $view->form->ID ) {
457 457
 			return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' );
458 458
 		}
459 459
 
460
-		if ( $entry['status'] != 'active' ) {
460
+		if ( $entry[ 'status' ] != 'active' ) {
461 461
 			return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' );
462 462
 		}
463 463
 
@@ -465,10 +465,10 @@  discard block
 block discarded – undo
465 465
 			return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' );
466 466
 		}
467 467
 
468
-		$is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap('gravityview_moderate_entries', $view->ID );
468
+		$is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap( 'gravityview_moderate_entries', $view->ID );
469 469
 
470 470
 		if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) {
471
-			if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) )  ) {
471
+			if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) {
472 472
 				return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' );
473 473
 			}
474 474
 		}
Please login to merge, or discard this patch.
includes/admin/class-gravityview-support-port.php 2 patches
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 
14 14
 	/**
15 15
 	 * @var string The hash key used to generate secure message history
16
-     * @since 2.2.5
16
+	 * @since 2.2.5
17 17
 	 */
18 18
 	const beacon_key = 'lCXlwbQR707kipR+J0MCqcxrhGOHjGF0ldD6yNbGM0w=';
19 19
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 			'payment_id'       => '',
111 111
 			'customer_name'    => '',
112 112
 			'customer_email'   => '',
113
-            'price_id'         => '0',
113
+			'price_id'         => '0',
114 114
 		) );
115 115
 
116 116
 		// This is just HTML we don't need.
@@ -127,9 +127,9 @@  discard block
 block discarded – undo
127 127
 			case 3:
128 128
 				$package = 'All Access';
129 129
 				break;
130
-            case 4:
131
-                $package = 'Lifetime';
132
-                break;
130
+			case 4:
131
+				$package = 'Lifetime';
132
+				break;
133 133
 		}
134 134
 
135 135
 		$current_user = wp_get_current_user();
@@ -159,27 +159,27 @@  discard block
 block discarded – undo
159 159
 		// Help Scout length limit is 200 characters
160 160
 		foreach( $data as $key => $value ) {
161 161
 			if ( ! is_string( $value ) ) {
162
-                continue;
162
+				continue;
163 163
 			}
164
-		    $data[ $key ] = mb_substr( $value, 0, 200 );
165
-        }
164
+			$data[ $key ] = mb_substr( $value, 0, 200 );
165
+		}
166 166
 
167 167
 		$localization_data = array(
168 168
 			'contactEnabled' => (int)GVCommon::has_cap( 'gravityview_contact_support' ),
169 169
 			'data' => $data,
170 170
 			'translation' => $translation,
171
-            'suggest' => array(),
171
+			'suggest' => array(),
172 172
 		);
173 173
 
174 174
 		/**
175
-         * @filter `gravityview/support_port/localization_data` Filter data passed to the Support Port, before localize_script is run
175
+		 * @filter `gravityview/support_port/localization_data` Filter data passed to the Support Port, before localize_script is run
176 176
 		 * @since 2.0
177
-         * @param array $localization_data {
178
-         *   @type int $contactEnabled Can the user contact support?
179
-         *   @type array $data Support/license info
180
-         *   @type array $translation i18n strings
181
-         *   @type array $suggest Article IDs to recommend to the user (per page in the admin
182
-         * }
177
+		 * @param array $localization_data {
178
+		 *   @type int $contactEnabled Can the user contact support?
179
+		 *   @type array $data Support/license info
180
+		 *   @type array $translation i18n strings
181
+		 *   @type array $suggest Article IDs to recommend to the user (per page in the admin
182
+		 * }
183 183
 		 */
184 184
 		$localization_data = apply_filters( 'gravityview/support_port/localization_data', $localization_data );
185 185
 
@@ -193,11 +193,11 @@  discard block
 block discarded – undo
193 193
 	 *
194 194
 	 * If the user doesn't have the `gravityview_support_port` capability, returns false; then
195 195
 	 * If global setting is "hide", returns false; then
196
-     * If user preference is not set, return global setting; then
197
-     * If user preference is set, return that setting.
196
+	 * If user preference is not set, return global setting; then
197
+	 * If user preference is set, return that setting.
198 198
 	 *
199 199
 	 * @since 1.15
200
-     * @since 1.17.5 Changed behavior to respect global setting
200
+	 * @since 1.17.5 Changed behavior to respect global setting
201 201
 	 *
202 202
 	 * @param int $user Optional. ID of the user to check, defaults to 0 for current user.
203 203
 	 *
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 		$global_setting = gravityview()->plugin->settings->get( 'support_port' );
213 213
 
214 214
 		if ( empty( $global_setting ) ) {
215
-            return false;
215
+			return false;
216 216
 		}
217 217
 
218 218
 		// Get the per-user Support Port setting
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 	 * Modifies the output of profile.php to add GravityView Support preference
249 249
 	 *
250 250
 	 * @since 1.15
251
-     * @since 1.17.5 Only show if global setting is active
251
+	 * @since 1.17.5 Only show if global setting is active
252 252
 	 *
253 253
 	 * @param WP_User $user Current user info
254 254
 	 *
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 		$global_setting = gravityview()->plugin->settings->get( 'support_port' );
260 260
 
261 261
 		if ( empty( $global_setting ) ) {
262
-            return;
262
+			return;
263 263
 		}
264 264
 
265 265
 		/**
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -114,9 +114,9 @@  discard block
 block discarded – undo
114 114
 		) );
115 115
 
116 116
 		// This is just HTML we don't need.
117
-		unset( $response['message'] );
117
+		unset( $response[ 'message' ] );
118 118
 
119
-		switch ( intval( $response['price_id'] ) ) {
119
+		switch ( intval( $response[ 'price_id' ] ) ) {
120 120
 			default:
121 121
 			case 1:
122 122
 				$package = 'Core';
@@ -142,12 +142,12 @@  discard block
 block discarded – undo
142 142
 			'email'                 => $current_user->user_email,
143 143
 			'name'                  => mb_substr( $current_user->display_name, 0, 80 ),
144 144
 			'signature'             => hash_hmac( 'sha256', $current_user->user_email, self::beacon_key ),
145
-			'License Key'           => $response['license_key'] . ' (' . ucwords( $response['license'] ) . ')',
145
+			'License Key'           => $response[ 'license_key' ] . ' (' . ucwords( $response[ 'license' ] ) . ')',
146 146
 			'License Level'         => $package,
147 147
 			'Alt Emails'            => sprintf( "Admin: %s, GV Support: %s", get_bloginfo( 'admin_email' ), gravityview()->plugin->settings->get( 'support-email' ) ),
148
-			'Payment Details'       => $response['customer_name'] . ' ' . $response['customer_email'],
148
+			'Payment Details'       => $response[ 'customer_name' ] . ' ' . $response[ 'customer_email' ],
149 149
 			'WordPress Version'     => get_bloginfo( 'version', 'display' ),
150
-			'PHP Version'           => phpversion() . ' on ' . esc_html( $_SERVER['SERVER_SOFTWARE'] ),
150
+			'PHP Version'           => phpversion() . ' on ' . esc_html( $_SERVER[ 'SERVER_SOFTWARE' ] ),
151 151
 			'No-Conflict Mode'      => empty( $no_conflict_mode ) ? 'Disabled' : 'Enabled',
152 152
 			'GravityView Version'   => \GV\Plugin::$version,
153 153
 			'Gravity Forms Version' => GFForms::$version,
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 		ob_get_clean();
158 158
 
159 159
 		// Help Scout length limit is 200 characters
160
-		foreach( $data as $key => $value ) {
160
+		foreach ( $data as $key => $value ) {
161 161
 			if ( ! is_string( $value ) ) {
162 162
                 continue;
163 163
 			}
Please login to merge, or discard this patch.
includes/class-gvlogic-shortcode.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 */
95 95
 	public static function get_instance() {
96 96
 
97
-		if( empty( self::$instance ) ) {
97
+		if ( empty( self::$instance ) ) {
98 98
 			self::$instance = new self;
99 99
 		}
100 100
 
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
 
129 129
 		$operators = array_merge( self::$SUPPORTED_ARRAY_OPERATORS, self::$SUPPORTED_NUMERIC_OPERATORS, self::$SUPPORTED_SCALAR_OPERATORS, self::$SUPPORTED_CUSTOM_OPERATORS );
130 130
 
131
-		if( $with_values ) {
131
+		if ( $with_values ) {
132 132
 			$operators_with_values = array();
133
-			foreach( $operators as $key ) {
133
+			foreach ( $operators as $key ) {
134 134
 				$operators_with_values[ $key ] = '';
135 135
 			}
136 136
 			return $operators_with_values;
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 
150 150
 		$operators = $this->get_operators( false );
151 151
 
152
-		if( !in_array( $operation, $operators ) ) {
152
+		if ( ! in_array( $operation, $operators ) ) {
153 153
 			gravityview()->log->debug( ' Attempted to add invalid operation type. {operation}', array( 'operation' => $operation ) );
154 154
 			return false;
155 155
 		}
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 			return null;
202 202
 		}
203 203
 
204
-		if( empty( $atts ) ) {
204
+		if ( empty( $atts ) ) {
205 205
 			gravityview()->log->error( '$atts are empty.', array( 'data' => $atts ) );
206 206
 			return null;
207 207
 		}
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 			$setup = $this->setup_operation_and_comparison();
225 225
 
226 226
 			// We need an operation and comparison value
227
-			if( ! $setup ) {
227
+			if ( ! $setup ) {
228 228
 				gravityview()->log->error( 'No valid operators were passed.', array( 'data' => $this->atts ) );
229 229
 				return null;
230 230
 			}
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 	 */
280 280
 	private function get_output() {
281 281
 
282
-		if( $this->is_match ) {
282
+		if ( $this->is_match ) {
283 283
 			$output = $this->content;
284 284
 		} else {
285 285
 			$output = $this->else_content;
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 		 * @param string $output HTML/text output
298 298
 		 * @param GVLogic_Shortcode $this This class
299 299
 		 */
300
-		$output = apply_filters('gravityview/gvlogic/output', $output, $this );
300
+		$output = apply_filters( 'gravityview/gvlogic/output', $output, $this );
301 301
 
302 302
 		gravityview()->log->debug( 'Output: ', array( 'data' => $output ) );
303 303
 
@@ -317,14 +317,14 @@  discard block
 block discarded – undo
317 317
 		list( $before_else, $after_else ) = array_pad( explode( '[else]', $passed_content ), 2, NULL );
318 318
 		list( $before_else_if, $after_else_if ) = array_pad( explode( '[else', $passed_content ), 2, NULL );
319 319
 
320
-		$else_attr = isset( $this->atts['else'] ) ? $this->atts['else'] : NULL;
320
+		$else_attr = isset( $this->atts[ 'else' ] ) ? $this->atts[ 'else' ] : NULL;
321 321
 		$else_content = isset( $after_else ) ? $after_else : $else_attr;
322 322
 
323 323
 		// The content is everything OTHER than the [else]
324 324
 		$this->content = $before_else_if;
325 325
 
326 326
 		if ( ! $this->is_match ) {
327
-			if( $elseif_content = $this->process_elseif( $before_else ) ) {
327
+			if ( $elseif_content = $this->process_elseif( $before_else ) ) {
328 328
 				$this->else_content = $elseif_content;
329 329
 			} else {
330 330
 				$this->else_content = $else_content;
@@ -352,16 +352,16 @@  discard block
 block discarded – undo
352 352
 		foreach ( $else_if_matches as $key => $else_if_match ) {
353 353
 
354 354
 			// If $else_if_match[5] exists and has content, check for more shortcodes
355
-			preg_match_all( '/' . $regex . '/', $else_if_match[5] . '[/else]', $recursive_matches, PREG_SET_ORDER );
355
+			preg_match_all( '/' . $regex . '/', $else_if_match[ 5 ] . '[/else]', $recursive_matches, PREG_SET_ORDER );
356 356
 
357 357
 			// If the logic passes, this is the value that should be used for $this->else_content
358
-			$else_if_value = $else_if_match[5];
359
-			$check_elseif_match = $else_if_match[0];
358
+			$else_if_value = $else_if_match[ 5 ];
359
+			$check_elseif_match = $else_if_match[ 0 ];
360 360
 
361 361
 			// Retrieve the value of the match that is currently being checked, without any other [else] tags
362
-			if( ! empty( $recursive_matches[0][0] ) ) {
363
-				$else_if_value = str_replace( $recursive_matches[0][0], '', $else_if_value );
364
-				$check_elseif_match = str_replace( $recursive_matches[0][0], '', $check_elseif_match );
362
+			if ( ! empty( $recursive_matches[ 0 ][ 0 ] ) ) {
363
+				$else_if_value = str_replace( $recursive_matches[ 0 ][ 0 ], '', $else_if_value );
364
+				$check_elseif_match = str_replace( $recursive_matches[ 0 ][ 0 ], '', $check_elseif_match );
365 365
 			}
366 366
 
367 367
 			$check_elseif_match = str_replace( '[else', '[gvlogicelse', $check_elseif_match );
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
 			}
379 379
 
380 380
 			// Process any remaining [else] tags
381
-			return $this->process_elseif( $else_if_match[5] );
381
+			return $this->process_elseif( $else_if_match[ 5 ] );
382 382
 		}
383 383
 
384 384
 		return false;
@@ -405,11 +405,11 @@  discard block
 block discarded – undo
405 405
 		$this->atts = array_intersect_key( $this->passed_atts, $this->atts );
406 406
 
407 407
 		// Strip whitespace if it's not default false
408
-		$this->if = ( isset( $this->atts['if'] ) && is_string( $this->atts['if'] ) ) ? trim( $this->atts['if'] ) : false;
408
+		$this->if = ( isset( $this->atts[ 'if' ] ) && is_string( $this->atts[ 'if' ] ) ) ? trim( $this->atts[ 'if' ] ) : false;
409 409
 
410
-		if ( isset( $this->atts['logged_in'] ) ) {
410
+		if ( isset( $this->atts[ 'logged_in' ] ) ) {
411 411
 			// Truthy
412
-			if ( in_array( strtolower( $this->atts['logged_in'] ), array( '1', 'true', 'yes' ) ) ) {
412
+			if ( in_array( strtolower( $this->atts[ 'logged_in' ] ), array( '1', 'true', 'yes' ) ) ) {
413 413
 				$this->logged_in = true;
414 414
 			} else {
415 415
 				$this->logged_in = false;
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
 		do_action( 'gravityview/gvlogic/parse_atts/after', $this );
426 426
 
427 427
 		// Make sure the "if" isn't processed in self::setup_operation_and_comparison()
428
-		unset( $this->atts['if'] );
428
+		unset( $this->atts[ 'if' ] );
429 429
 	}
430 430
 }
431 431
 
Please login to merge, or discard this patch.
future/includes/class-gv-field.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 	 * @return \GV\Field The field implementation from configuration (\GV\GF_Field, \GV\Internal_Field).
167 167
 	 */
168 168
 	public static function from_configuration( $configuration ) {
169
-		if ( empty( $configuration['id'] ) ) {
169
+		if ( empty( $configuration[ 'id' ] ) ) {
170 170
 			$field = new self();
171 171
 			gravityview()->log->error( 'Trying to get field from configuration without a field ID.', array( 'data' => $configuration ) );
172 172
 			$field->update_configuration( $configuration );
@@ -179,8 +179,8 @@  discard block
 block discarded – undo
179 179
 		} else {
180 180
 			$trace = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS );
181 181
 		}
182
-		$trace = $trace[1];
183
-		if ( $trace['function'] == 'from_configuration' && $trace['class'] == __CLASS__ ) {
182
+		$trace = $trace[ 1 ];
183
+		if ( $trace[ 'function' ] == 'from_configuration' && $trace[ 'class' ] == __CLASS__ ) {
184 184
 			$field = new self();
185 185
 			gravityview()->log->error( 'Infinite loop protection tripped. Returning default class here.' );
186 186
 			$field->update_configuration( $configuration );
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 		}
189 189
 
190 190
 		/** Determine the field implementation to use, and try to use. */
191
-		$field_class = is_numeric( $configuration['id'] ) ? '\GV\GF_Field' : '\GV\Internal_Field';
191
+		$field_class = is_numeric( $configuration[ 'id' ] ) ? '\GV\GF_Field' : '\GV\Internal_Field';
192 192
 
193 193
 		/**
194 194
 		 * @filter `gravityview/field/class` Filter the field class about to be created from the configuration.
@@ -227,24 +227,24 @@  discard block
 block discarded – undo
227 227
 	public function update_configuration( $configuration ) {
228 228
 		$configuration = wp_parse_args( $configuration, $this->as_configuration() );
229 229
 
230
-		if ( $this->ID != $configuration['id'] ) {
230
+		if ( $this->ID != $configuration[ 'id' ] ) {
231 231
 			/** Smelling trouble here... */
232 232
 			gravityview()->log->warning( 'ID is being changed for {field_class} instance, but implementation is not. Use ::from_configuration instead', array( 'field_class', __CLASS__ ) );
233 233
 		}
234 234
 
235
-		$this->ID = $configuration['id'];
236
-		$this->label = $configuration['label'];
237
-		$this->show_label = $configuration['show_label'] == '1';
238
-		$this->custom_label = $configuration['custom_label'];
239
-		$this->custom_class = $configuration['custom_class'];
240
-		$this->cap = $configuration['only_loggedin'] == '1' ? $configuration['only_loggedin_cap'] : '';
241
-		$this->search_filter = $configuration['search_filter'] == '1';
242
-		$this->show_as_link = $configuration['show_as_link'] == '1';
235
+		$this->ID = $configuration[ 'id' ];
236
+		$this->label = $configuration[ 'label' ];
237
+		$this->show_label = $configuration[ 'show_label' ] == '1';
238
+		$this->custom_label = $configuration[ 'custom_label' ];
239
+		$this->custom_class = $configuration[ 'custom_class' ];
240
+		$this->cap = $configuration[ 'only_loggedin' ] == '1' ? $configuration[ 'only_loggedin_cap' ] : '';
241
+		$this->search_filter = $configuration[ 'search_filter' ] == '1';
242
+		$this->show_as_link = $configuration[ 'show_as_link' ] == '1';
243 243
 
244 244
 		/** Shared among all field types (sort of). */
245 245
 		$shared_configuration_keys = array(
246 246
 			'id', 'label', 'show_label', 'custom_label', 'custom_class',
247
-			'only_loggedin' ,'only_loggedin_cap', 'search_filter', 'show_as_link',
247
+			'only_loggedin', 'only_loggedin_cap', 'search_filter', 'show_as_link',
248 248
 		);
249 249
 
250 250
 		/** Everything else goes into the properties for now. @todo subclasses! */
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 
274 274
 		/** A custom label is available. */
275 275
 		if ( ! empty( $this->custom_label ) ) {
276
-			return \GravityView_API::replace_variables( $this->custom_label, $source ? $source->form ? : null : null, $entry ? $entry->as_entry() : null );
276
+			return \GravityView_API::replace_variables( $this->custom_label, $source ? $source->form ?: null : null, $entry ? $entry->as_entry() : null );
277 277
 		}
278 278
 
279 279
 		return '';
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 	 * @return mixed|null The value for the given configuration key, null if doesn't exist.
351 351
 	 */
352 352
 	public function __get( $key ) {
353
-		switch( $key ) {
353
+		switch ( $key ) {
354 354
 			default:
355 355
 				if ( isset( $this->configuration[ $key ] ) ) {
356 356
 					return $this->configuration[ $key ];
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 	 * @return boolean Whether this $key is set or not.
369 369
 	 */
370 370
 	public function __isset( $key ) {
371
-		switch( $key ) {
371
+		switch ( $key ) {
372 372
 			default:
373 373
 				return isset( $this->configuration[ $key ] );
374 374
 		}
Please login to merge, or discard this patch.
includes/admin/class.render.settings.php 1 patch
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 
28 28
 		$field_options = array();
29 29
 
30
-		if( 'field' === $field_type ) {
30
+		if ( 'field' === $field_type ) {
31 31
 
32 32
 			// Default options - fields
33 33
 			$field_options = array(
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 				'custom_class' => array(
46 46
 					'type' => 'text',
47 47
 					'label' => __( 'Custom CSS Class:', 'gravityview' ),
48
-					'desc' => __( 'This class will be added to the field container', 'gravityview'),
48
+					'desc' => __( 'This class will be added to the field container', 'gravityview' ),
49 49
 					'value' => '',
50 50
 					'merge_tags' => true,
51 51
 					'tooltip' => 'gv_css_merge_tags',
@@ -65,11 +65,11 @@  discard block
 block discarded – undo
65 65
 			);
66 66
 
67 67
 			// Match Table as well as DataTables
68
-			if( preg_match( '/table/ism', $template_id ) && 'directory' === $context ) {
69
-				$field_options['width'] = array(
68
+			if ( preg_match( '/table/ism', $template_id ) && 'directory' === $context ) {
69
+				$field_options[ 'width' ] = array(
70 70
 					'type' => 'number',
71
-					'label' => __('Percent Width', 'gravityview'),
72
-					'desc' => __( 'Leave blank for column width to be based on the field content.', 'gravityview'),
71
+					'label' => __( 'Percent Width', 'gravityview' ),
72
+					'desc' => __( 'Leave blank for column width to be based on the field content.', 'gravityview' ),
73 73
 					'class' => 'code widefat',
74 74
 					'value' => '',
75 75
 				);
@@ -122,8 +122,8 @@  discard block
 block discarded – undo
122 122
 			'manage_options' => __( 'Administrator', 'gravityview' ),
123 123
 		);
124 124
 
125
-		if( is_multisite() ) {
126
-			$select_cap_choices['manage_network'] = __('Multisite Super Admin', 'gravityview' );
125
+		if ( is_multisite() ) {
126
+			$select_cap_choices[ 'manage_network' ] = __( 'Multisite Super Admin', 'gravityview' );
127 127
 		}
128 128
 
129 129
 		/**
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 		 * @param  string $context     Optional. What context are we in? Example: `single` or `directory`
137 137
 		 * @param  string $input_type  Optional. (textarea, list, select, etc.)
138 138
 		 */
139
-		$select_cap_choices = apply_filters('gravityview_field_visibility_caps', $select_cap_choices, $template_id, $field_id, $context, $input_type );
139
+		$select_cap_choices = apply_filters( 'gravityview_field_visibility_caps', $select_cap_choices, $template_id, $field_id, $context, $input_type );
140 140
 
141 141
 		return $select_cap_choices;
142 142
 	}
@@ -164,27 +164,27 @@  discard block
 block discarded – undo
164 164
 	 */
165 165
 	public static function render_field_options( $form_id, $field_type, $template_id, $field_id, $field_label, $area, $input_type = NULL, $uniqid = '', $current = '', $context = 'single', $item = array() ) {
166 166
 
167
-		if( empty( $uniqid ) ) {
167
+		if ( empty( $uniqid ) ) {
168 168
 			//generate a unique field id
169
-			$uniqid = uniqid('', false);
169
+			$uniqid = uniqid( '', false );
170 170
 		}
171 171
 
172 172
 		// get field/widget options
173 173
 		$options = self::get_default_field_options( $field_type, $template_id, $field_id, $context, $input_type );
174 174
 
175 175
 		// two different post arrays, depending of the field type
176
-		$name_prefix = $field_type .'s' .'['. $area .']['. $uniqid .']';
176
+		$name_prefix = $field_type . 's' . '[' . $area . '][' . $uniqid . ']';
177 177
 
178 178
 		// build output
179 179
 		$output = '';
180
-		$output .= '<input type="hidden" class="field-key" name="'. $name_prefix .'[id]" value="'. esc_attr( $field_id ) .'">';
181
-		$output .= '<input type="hidden" class="field-label" name="'. $name_prefix .'[label]" value="'. esc_attr( $field_label ) .'">';
180
+		$output .= '<input type="hidden" class="field-key" name="' . $name_prefix . '[id]" value="' . esc_attr( $field_id ) . '">';
181
+		$output .= '<input type="hidden" class="field-label" name="' . $name_prefix . '[label]" value="' . esc_attr( $field_label ) . '">';
182 182
 		if ( $form_id ) {
183
-			$output .= '<input type="hidden" class="field-form-id" name="'. $name_prefix .'[form_id]" value="'. esc_attr( $form_id ) .'">';
183
+			$output .= '<input type="hidden" class="field-form-id" name="' . $name_prefix . '[form_id]" value="' . esc_attr( $form_id ) . '">';
184 184
 		}
185 185
 
186 186
 		// If there are no options, return what we got.
187
-		if(empty($options)) {
187
+		if ( empty( $options ) ) {
188 188
 
189 189
 			// This is here for checking if the output is empty in render_label()
190 190
 			$output .= '<!-- No Options -->';
@@ -192,33 +192,33 @@  discard block
 block discarded – undo
192 192
 			return $output;
193 193
 		}
194 194
 
195
-		$output .= '<div class="gv-dialog-options" title="'. esc_attr( sprintf( __( 'Options: %s', 'gravityview' ) , strip_tags( html_entity_decode( $field_label ) ) ) ) .'">';
195
+		$output .= '<div class="gv-dialog-options" title="' . esc_attr( sprintf( __( 'Options: %s', 'gravityview' ), strip_tags( html_entity_decode( $field_label ) ) ) ) . '">';
196 196
 
197 197
 		/**
198 198
 		 * @since 1.8
199 199
 		 */
200
-		if( !empty( $item['subtitle'] ) ) {
201
-			$output .= '<div class="subtitle">' . $item['subtitle'] . '</div>';
200
+		if ( ! empty( $item[ 'subtitle' ] ) ) {
201
+			$output .= '<div class="subtitle">' . $item[ 'subtitle' ] . '</div>';
202 202
 		}
203 203
 
204
-		foreach( $options as $key => $option ) {
204
+		foreach ( $options as $key => $option ) {
205 205
 
206 206
 			$value = isset( $current[ $key ] ) ? $current[ $key ] : NULL;
207 207
 
208
-			$field_output = self::render_field_option( $name_prefix . '['. $key .']' , $option, $value);
208
+			$field_output = self::render_field_option( $name_prefix . '[' . $key . ']', $option, $value );
209 209
 
210 210
 			// The setting is empty
211
-			if( empty( $field_output ) ) {
211
+			if ( empty( $field_output ) ) {
212 212
 				continue;
213 213
 			}
214 214
 
215
-			switch( $option['type'] ) {
215
+			switch ( $option[ 'type' ] ) {
216 216
 				// Hide hidden fields
217 217
 				case 'hidden':
218
-					$output .= '<div class="gv-setting-container gv-setting-container-'. esc_attr( $key ) . ' screen-reader-text">'. $field_output . '</div>';
218
+					$output .= '<div class="gv-setting-container gv-setting-container-' . esc_attr( $key ) . ' screen-reader-text">' . $field_output . '</div>';
219 219
 					break;
220 220
 				default:
221
-					$output .= '<div class="gv-setting-container gv-setting-container-'. esc_attr( $key ) . '">'. $field_output .'</div>';
221
+					$output .= '<div class="gv-setting-container gv-setting-container-' . esc_attr( $key ) . '">' . $field_output . '</div>';
222 222
 			}
223 223
 		}
224 224
 
@@ -247,17 +247,17 @@  discard block
 block discarded – undo
247 247
 		 * @deprecated setting index 'default' was replaced by 'value'
248 248
 		 * @see GravityView_FieldType::get_field_defaults
249 249
 		 */
250
-		if( !empty( $option['default'] ) && empty( $option['value'] ) ) {
251
-			$option['value'] = $option['default'];
252
-			_deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[value] instead of [default] when defining the setting '. $name .' details' );
250
+		if ( ! empty( $option[ 'default' ] ) && empty( $option[ 'value' ] ) ) {
251
+			$option[ 'value' ] = $option[ 'default' ];
252
+			_deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[value] instead of [default] when defining the setting ' . $name . ' details' );
253 253
 		}
254 254
 
255 255
 		// prepare to render option field type
256
-		if( isset( $option['type'] ) ) {
256
+		if ( isset( $option[ 'type' ] ) ) {
257 257
 
258 258
 			$type_class = self::load_type_class( $option );
259 259
 
260
-			if( class_exists( $type_class ) ) {
260
+			if ( class_exists( $type_class ) ) {
261 261
 
262 262
 				/** @var GravityView_FieldType $render_type */
263 263
 				$render_type = new $type_class( $name, $option, $curr_value );
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 				 * @param[in,out] string $output field class name
275 275
 				 * @param[in] array $option  option field data
276 276
 				 */
277
-				$output = apply_filters( "gravityview/option/output/{$option['type']}" , $output, $option );
277
+				$output = apply_filters( "gravityview/option/output/{$option[ 'type' ]}", $output, $option );
278 278
 			}
279 279
 
280 280
 		} // isset option[type]
@@ -309,27 +309,27 @@  discard block
 block discarded – undo
309 309
 		 * @deprecated setting index 'name' was replaced by 'label'
310 310
 		 * @see GravityView_FieldType::get_field_defaults
311 311
 		 */
312
-		if( isset( $setting['name'] ) && empty( $setting['label'] ) ) {
313
-			$setting['label'] = $setting['name'];
314
-			_deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[label] instead of [name] when defining the setting '. $key .' details' );
312
+		if ( isset( $setting[ 'name' ] ) && empty( $setting[ 'label' ] ) ) {
313
+			$setting[ 'label' ] = $setting[ 'name' ];
314
+			_deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[label] instead of [name] when defining the setting ' . $key . ' details' );
315 315
 		}
316 316
 
317 317
 		$name = esc_attr( sprintf( $name, $key ) );
318
-		$setting['id'] = esc_attr( sprintf( $id, $key ) );
319
-		$setting['tooltip'] = 'gv_' . $key;
318
+		$setting[ 'id' ] = esc_attr( sprintf( $id, $key ) );
319
+		$setting[ 'tooltip' ] = 'gv_' . $key;
320 320
 
321 321
 		// Use default if current setting isn't set.
322
-		$curr_value = isset( $current_settings[ $key ] ) ? $current_settings[ $key ] : $setting['value'];
322
+		$curr_value = isset( $current_settings[ $key ] ) ? $current_settings[ $key ] : $setting[ 'value' ];
323 323
 
324 324
 		// default setting type = text
325
-		$setting['type'] = empty( $setting['type'] ) ? 'text' : $setting['type'];
325
+		$setting[ 'type' ] = empty( $setting[ 'type' ] ) ? 'text' : $setting[ 'type' ];
326 326
 
327 327
 		// merge tags
328
-		if( !isset( $setting['merge_tags'] ) ) {
329
-			if( $setting['type'] === 'text' ) {
330
-				$setting['merge_tags'] = true;
328
+		if ( ! isset( $setting[ 'merge_tags' ] ) ) {
329
+			if ( $setting[ 'type' ] === 'text' ) {
330
+				$setting[ 'merge_tags' ] = true;
331 331
 			} else {
332
-				$setting['merge_tags'] = false;
332
+				$setting[ 'merge_tags' ] = false;
333 333
 			}
334 334
 		}
335 335
 
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 
338 338
 		// render the setting
339 339
 		$type_class = self::load_type_class( $setting );
340
-		if( class_exists( $type_class ) ) {
340
+		if ( class_exists( $type_class ) ) {
341 341
 			/** @var GravityView_FieldType $render_type */
342 342
 			$render_type = new $type_class( $name, $setting, $curr_value );
343 343
 			ob_start();
@@ -346,25 +346,25 @@  discard block
 block discarded – undo
346 346
 		}
347 347
 
348 348
 		// Check if setting is specific for a template
349
-		if( !empty( $setting['show_in_template'] ) ) {
350
-			if( !is_array( $setting['show_in_template'] ) ) {
351
-				$setting['show_in_template'] = array( $setting['show_in_template'] );
349
+		if ( ! empty( $setting[ 'show_in_template' ] ) ) {
350
+			if ( ! is_array( $setting[ 'show_in_template' ] ) ) {
351
+				$setting[ 'show_in_template' ] = array( $setting[ 'show_in_template' ] );
352 352
 			}
353
-			$show_if = ' data-show-if="'. implode( ' ', $setting['show_in_template'] ).'"';
353
+			$show_if = ' data-show-if="' . implode( ' ', $setting[ 'show_in_template' ] ) . '"';
354 354
 		} else {
355 355
 			$show_if = '';
356 356
 		}
357 357
 
358
-		if( ! empty( $setting['requires'] ) ) {
359
-			$show_if .= sprintf( ' data-requires="%s"', $setting['requires'] );
358
+		if ( ! empty( $setting[ 'requires' ] ) ) {
359
+			$show_if .= sprintf( ' data-requires="%s"', $setting[ 'requires' ] );
360 360
 		}
361 361
 
362
-		if( ! empty( $setting['requires_not'] ) ) {
363
-			$show_if .= sprintf( ' data-requires-not="%s"', $setting['requires_not'] );
362
+		if ( ! empty( $setting[ 'requires_not' ] ) ) {
363
+			$show_if .= sprintf( ' data-requires-not="%s"', $setting[ 'requires_not' ] );
364 364
 		}
365 365
 
366 366
 		// output
367
-		echo '<tr valign="top" '. $show_if .'>' . $output . '</tr>';
367
+		echo '<tr valign="top" ' . $show_if . '>' . $output . '</tr>';
368 368
 
369 369
 	}
370 370
 
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 	 */
377 377
 	public static function load_type_class( $field = NULL ) {
378 378
 
379
-		if( empty( $field['type'] ) ) {
379
+		if ( empty( $field[ 'type' ] ) ) {
380 380
 			return NULL;
381 381
 		}
382 382
 
@@ -385,19 +385,19 @@  discard block
 block discarded – undo
385 385
 		 * @param string $class_suffix  field class suffix; `GravityView_FieldType_{$class_suffix}`
386 386
 		 * @param array $field   field data
387 387
 		 */
388
-		$type_class = apply_filters( "gravityview/setting/class/{$field['type']}", 'GravityView_FieldType_' . $field['type'], $field );
388
+		$type_class = apply_filters( "gravityview/setting/class/{$field[ 'type' ]}", 'GravityView_FieldType_' . $field[ 'type' ], $field );
389 389
 
390
-		if( !class_exists( $type_class ) ) {
390
+		if ( ! class_exists( $type_class ) ) {
391 391
 
392 392
 			/**
393 393
 			 * @filter `gravityview/setting/class_file/{field_type}`
394 394
 			 * @param string  $field_type_include_path field class file path
395 395
 			 * @param array $field  field data
396 396
 			 */
397
-			$class_file = apply_filters( "gravityview/setting/class_file/{$field['type']}", GRAVITYVIEW_DIR . "includes/admin/field-types/type_{$field['type']}.php", $field );
397
+			$class_file = apply_filters( "gravityview/setting/class_file/{$field[ 'type' ]}", GRAVITYVIEW_DIR . "includes/admin/field-types/type_{$field[ 'type' ]}.php", $field );
398 398
 
399
-			if( $class_file ) {
400
-				if( file_exists( $class_file ) ) {
399
+			if ( $class_file ) {
400
+				if ( file_exists( $class_file ) ) {
401 401
 					require_once( $class_file );
402 402
 				}
403 403
 			}
@@ -422,8 +422,8 @@  discard block
 block discarded – undo
422 422
 
423 423
 		_deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_checkbox::render_input' );
424 424
 
425
-		$output  = '<input name="'. esc_attr( $name ) .'" type="hidden" value="0">';
426
-		$output .= '<input name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" type="checkbox" value="1" '. checked( $current, '1', false ) .' >';
425
+		$output  = '<input name="' . esc_attr( $name ) . '" type="hidden" value="0">';
426
+		$output .= '<input name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" type="checkbox" value="1" ' . checked( $current, '1', false ) . ' >';
427 427
 
428 428
 		return $output;
429 429
 	}
@@ -443,22 +443,22 @@  discard block
 block discarded – undo
443 443
 		_deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_text::render_input' );
444 444
 
445 445
 		// Show the merge tags if the field is a list view
446
-		$is_list = ( preg_match( '/_list-/ism', $name ));
446
+		$is_list = ( preg_match( '/_list-/ism', $name ) );
447 447
 
448 448
 		// Or is a single entry view
449
-		$is_single = ( preg_match( '/single_/ism', $name ));
449
+		$is_single = ( preg_match( '/single_/ism', $name ) );
450 450
 		$show = ( $is_single || $is_list );
451 451
 
452 452
 		$class = '';
453 453
 		// and $add_merge_tags is not false
454
-		if( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) {
454
+		if ( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) {
455 455
 			$class = 'merge-tag-support mt-position-right mt-hide_all_fields ';
456 456
 		}
457 457
 
458
-		$class .= !empty( $args['class'] ) ? $args['class'] : 'widefat';
459
-		$type = !empty( $args['type'] ) ? $args['type'] : 'text';
458
+		$class .= ! empty( $args[ 'class' ] ) ? $args[ 'class' ] : 'widefat';
459
+		$type = ! empty( $args[ 'type' ] ) ? $args[ 'type' ] : 'text';
460 460
 
461
-		return '<input name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" type="'.esc_attr($type).'" value="'. esc_attr( $current ) .'" class="'.esc_attr( $class ).'">';
461
+		return '<input name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" type="' . esc_attr( $type ) . '" value="' . esc_attr( $current ) . '" class="' . esc_attr( $class ) . '">';
462 462
 	}
463 463
 
464 464
 	/**
@@ -475,21 +475,21 @@  discard block
 block discarded – undo
475 475
 		_deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_textarea::render_input' );
476 476
 
477 477
 		// Show the merge tags if the field is a list view
478
-		$is_list = ( preg_match( '/_list-/ism', $name ));
478
+		$is_list = ( preg_match( '/_list-/ism', $name ) );
479 479
 
480 480
 		// Or is a single entry view
481
-		$is_single = ( preg_match( '/single_/ism', $name ));
481
+		$is_single = ( preg_match( '/single_/ism', $name ) );
482 482
 		$show = ( $is_single || $is_list );
483 483
 
484 484
 		$class = '';
485 485
 		// and $add_merge_tags is not false
486
-		if( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) {
486
+		if ( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) {
487 487
 			$class = 'merge-tag-support mt-position-right mt-hide_all_fields ';
488 488
 		}
489 489
 
490
-		$class .= !empty( $args['class'] ) ? 'widefat '.$args['class'] : 'widefat';
490
+		$class .= ! empty( $args[ 'class' ] ) ? 'widefat ' . $args[ 'class' ] : 'widefat';
491 491
 
492
-		return '<textarea name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" class="'.esc_attr( $class ).'">'. esc_textarea( $current ) .'</textarea>';
492
+		return '<textarea name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" class="' . esc_attr( $class ) . '">' . esc_textarea( $current ) . '</textarea>';
493 493
 	}
494 494
 
495 495
 	/**
@@ -505,9 +505,9 @@  discard block
 block discarded – undo
505 505
 
506 506
 		_deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_select::render_input' );
507 507
 
508
-		$output = '<select name="'. $name .'" id="'. $id .'">';
509
-		foreach( $choices as $value => $label ) {
510
-			$output .= '<option value="'. esc_attr( $value ) .'" '. selected( $value, $current, false ) .'>'. esc_html( $label ) .'</option>';
508
+		$output = '<select name="' . $name . '" id="' . $id . '">';
509
+		foreach ( $choices as $value => $label ) {
510
+			$output .= '<option value="' . esc_attr( $value ) . '" ' . selected( $value, $current, false ) . '>' . esc_html( $label ) . '</option>';
511 511
 		}
512 512
 		$output .= '</select>';
513 513
 
Please login to merge, or discard this patch.