Completed
Pull Request — develop (#1504)
by Zack
17:49
created
includes/admin/class.render.settings.php 1 patch
Spacing   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
 		$is_table_layout = preg_match( '/table/ism', $template_id );
32 32
 
33
-		if( 'field' === $field_type ) {
33
+		if ( 'field' === $field_type ) {
34 34
 
35 35
 			// Default options - fields
36 36
 			$field_options = array(
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 				'custom_class' => array(
50 50
 					'type' => 'text',
51 51
 					'label' => __( 'Custom CSS Class:', 'gravityview' ),
52
-					'desc' => __( 'This class will be added to the field container', 'gravityview'),
52
+					'desc' => __( 'This class will be added to the field container', 'gravityview' ),
53 53
 					'value' => '',
54 54
 					'merge_tags' => true,
55 55
 					'tooltip' => 'gv_css_merge_tags',
@@ -70,11 +70,11 @@  discard block
 block discarded – undo
70 70
 			);
71 71
 
72 72
 			// Match Table as well as DataTables
73
-			if( $is_table_layout && 'directory' === $context ) {
74
-				$field_options['width'] = array(
73
+			if ( $is_table_layout && 'directory' === $context ) {
74
+				$field_options[ 'width' ] = array(
75 75
 					'type' => 'number',
76
-					'label' => __('Percent Width', 'gravityview'),
77
-					'desc' => __( 'Leave blank for column width to be based on the field content.', 'gravityview'),
76
+					'label' => __( 'Percent Width', 'gravityview' ),
77
+					'desc' => __( 'Leave blank for column width to be based on the field content.', 'gravityview' ),
78 78
 					'class' => 'code widefat',
79 79
 					'value' => '',
80 80
 				);
@@ -129,8 +129,8 @@  discard block
 block discarded – undo
129 129
 			'manage_options' => __( 'Administrator', 'gravityview' ),
130 130
 		);
131 131
 
132
-		if( is_multisite() ) {
133
-			$select_cap_choices['manage_network'] = __('Multisite Super Admin', 'gravityview' );
132
+		if ( is_multisite() ) {
133
+			$select_cap_choices[ 'manage_network' ] = __( 'Multisite Super Admin', 'gravityview' );
134 134
 		}
135 135
 
136 136
 		/**
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 		 * @param  string $context     Optional. What context are we in? Example: `single` or `directory`
144 144
 		 * @param  string $input_type  Optional. (textarea, list, select, etc.)
145 145
 		 */
146
-		$select_cap_choices = apply_filters('gravityview_field_visibility_caps', $select_cap_choices, $template_id, $field_id, $context, $input_type );
146
+		$select_cap_choices = apply_filters( 'gravityview_field_visibility_caps', $select_cap_choices, $template_id, $field_id, $context, $input_type );
147 147
 
148 148
 		return $select_cap_choices;
149 149
 	}
@@ -170,27 +170,27 @@  discard block
 block discarded – undo
170 170
 	 */
171 171
 	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() ) {
172 172
 
173
-		if( empty( $uniqid ) ) {
173
+		if ( empty( $uniqid ) ) {
174 174
 			//generate a unique field id
175
-			$uniqid = uniqid('', false);
175
+			$uniqid = uniqid( '', false );
176 176
 		}
177 177
 
178 178
 		// get field/widget options
179 179
 		$options = self::get_default_field_options( $field_type, $template_id, $field_id, $context, $input_type, $form_id );
180 180
 
181 181
 		// two different post arrays, depending of the field type
182
-		$name_prefix = $field_type .'s' .'['. $area .']['. $uniqid .']';
182
+		$name_prefix = $field_type . 's' . '[' . $area . '][' . $uniqid . ']';
183 183
 
184 184
 		// build output
185 185
 		$output = '';
186
-		$output .= '<input type="hidden" class="field-key" name="'. $name_prefix .'[id]" value="'. esc_attr( $field_id ) .'">';
187
-		$output .= '<input type="hidden" class="field-label" name="'. $name_prefix .'[label]" value="'. esc_attr( $field_label ) .'">';
186
+		$output .= '<input type="hidden" class="field-key" name="' . $name_prefix . '[id]" value="' . esc_attr( $field_id ) . '">';
187
+		$output .= '<input type="hidden" class="field-label" name="' . $name_prefix . '[label]" value="' . esc_attr( $field_label ) . '">';
188 188
 		if ( $form_id ) {
189
-			$output .= '<input type="hidden" class="field-form-id" name="'. $name_prefix .'[form_id]" value="'. esc_attr( $form_id ) .'">';
189
+			$output .= '<input type="hidden" class="field-form-id" name="' . $name_prefix . '[form_id]" value="' . esc_attr( $form_id ) . '">';
190 190
 		}
191 191
 
192 192
 		// If there are no options, return what we got.
193
-		if(empty($options)) {
193
+		if ( empty( $options ) ) {
194 194
 
195 195
 			// This is here for checking if the output is empty in render_label()
196 196
 			$output .= '<!-- No Options -->';
@@ -198,33 +198,33 @@  discard block
 block discarded – undo
198 198
 			return $output;
199 199
 		}
200 200
 
201
-		$output .= '<div class="gv-dialog-options" title="'. esc_attr( sprintf( __( 'Options: %s', 'gravityview' ) , strip_tags( html_entity_decode( $field_label ) ) ) ) .'">';
201
+		$output .= '<div class="gv-dialog-options" title="' . esc_attr( sprintf( __( 'Options: %s', 'gravityview' ), strip_tags( html_entity_decode( $field_label ) ) ) ) . '">';
202 202
 
203 203
 		/**
204 204
 		 * @since 1.8
205 205
 		 */
206
-		if( !empty( $item['subtitle'] ) ) {
207
-			$output .= '<div class="subtitle">' . $item['subtitle'] . '</div>';
206
+		if ( ! empty( $item[ 'subtitle' ] ) ) {
207
+			$output .= '<div class="subtitle">' . $item[ 'subtitle' ] . '</div>';
208 208
 		}
209 209
 
210
-		foreach( $options as $key => $option ) {
210
+		foreach ( $options as $key => $option ) {
211 211
 
212 212
 			$value = isset( $current[ $key ] ) ? $current[ $key ] : NULL;
213 213
 
214
-			$field_output = self::render_field_option( $name_prefix . '['. $key .']' , $option, $value);
214
+			$field_output = self::render_field_option( $name_prefix . '[' . $key . ']', $option, $value );
215 215
 
216 216
 			// The setting is empty
217
-			if( empty( $field_output ) ) {
217
+			if ( empty( $field_output ) ) {
218 218
 				continue;
219 219
 			}
220 220
 
221
-			switch( $option['type'] ) {
221
+			switch ( $option[ 'type' ] ) {
222 222
 				// Hide hidden fields
223 223
 				case 'hidden':
224
-					$output .= '<div class="gv-setting-container gv-setting-container-'. esc_attr( $key ) . ' screen-reader-text">'. $field_output . '</div>';
224
+					$output .= '<div class="gv-setting-container gv-setting-container-' . esc_attr( $key ) . ' screen-reader-text">' . $field_output . '</div>';
225 225
 					break;
226 226
 				default:
227
-					$output .= '<div class="gv-setting-container gv-setting-container-'. esc_attr( $key ) . '">'. $field_output .'</div>';
227
+					$output .= '<div class="gv-setting-container gv-setting-container-' . esc_attr( $key ) . '">' . $field_output . '</div>';
228 228
 			}
229 229
 		}
230 230
 
@@ -253,17 +253,17 @@  discard block
 block discarded – undo
253 253
 		 * @deprecated setting index 'default' was replaced by 'value'
254 254
 		 * @see GravityView_FieldType::get_field_defaults
255 255
 		 */
256
-		if( !empty( $option['default'] ) && empty( $option['value'] ) ) {
257
-			$option['value'] = $option['default'];
258
-			_deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[value] instead of [default] when defining the setting '. $name .' details' );
256
+		if ( ! empty( $option[ 'default' ] ) && empty( $option[ 'value' ] ) ) {
257
+			$option[ 'value' ] = $option[ 'default' ];
258
+			_deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[value] instead of [default] when defining the setting ' . $name . ' details' );
259 259
 		}
260 260
 
261 261
 		// prepare to render option field type
262
-		if( isset( $option['type'] ) ) {
262
+		if ( isset( $option[ 'type' ] ) ) {
263 263
 
264 264
 			$type_class = self::load_type_class( $option );
265 265
 
266
-			if( class_exists( $type_class ) ) {
266
+			if ( class_exists( $type_class ) ) {
267 267
 
268 268
 				/** @type GravityView_FieldType $render_type */
269 269
 				$render_type = new $type_class( $name, $option, $curr_value );
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 				 * @param[in,out] string $output field class name
281 281
 				 * @param[in] array $option  option field data
282 282
 				 */
283
-				$output = apply_filters( "gravityview/option/output/{$option['type']}" , $output, $option );
283
+				$output = apply_filters( "gravityview/option/output/{$option[ 'type' ]}", $output, $option );
284 284
 			}
285 285
 
286 286
 		} // isset option[type]
@@ -315,27 +315,27 @@  discard block
 block discarded – undo
315 315
 		 * @deprecated setting index 'name' was replaced by 'label'
316 316
 		 * @see GravityView_FieldType::get_field_defaults
317 317
 		 */
318
-		if( isset( $setting['name'] ) && empty( $setting['label'] ) ) {
319
-			$setting['label'] = $setting['name'];
320
-			_deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[label] instead of [name] when defining the setting '. $key .' details' );
318
+		if ( isset( $setting[ 'name' ] ) && empty( $setting[ 'label' ] ) ) {
319
+			$setting[ 'label' ] = $setting[ 'name' ];
320
+			_deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[label] instead of [name] when defining the setting ' . $key . ' details' );
321 321
 		}
322 322
 
323 323
 		$name = esc_attr( sprintf( $name, $key ) );
324
-		$setting['id'] = esc_attr( sprintf( $id, $key ) );
325
-		$setting['tooltip'] = 'gv_' . $key;
324
+		$setting[ 'id' ] = esc_attr( sprintf( $id, $key ) );
325
+		$setting[ 'tooltip' ] = 'gv_' . $key;
326 326
 
327 327
 		// Use default if current setting isn't set.
328
-		$curr_value = isset( $current_settings[ $key ] ) ? $current_settings[ $key ] : $setting['value'];
328
+		$curr_value = isset( $current_settings[ $key ] ) ? $current_settings[ $key ] : $setting[ 'value' ];
329 329
 
330 330
 		// default setting type = text
331
-		$setting['type'] = empty( $setting['type'] ) ? 'text' : $setting['type'];
331
+		$setting[ 'type' ] = empty( $setting[ 'type' ] ) ? 'text' : $setting[ 'type' ];
332 332
 
333 333
 		// merge tags
334
-		if( !isset( $setting['merge_tags'] ) ) {
335
-			if( $setting['type'] === 'text' ) {
336
-				$setting['merge_tags'] = true;
334
+		if ( ! isset( $setting[ 'merge_tags' ] ) ) {
335
+			if ( $setting[ 'type' ] === 'text' ) {
336
+				$setting[ 'merge_tags' ] = true;
337 337
 			} else {
338
-				$setting['merge_tags'] = false;
338
+				$setting[ 'merge_tags' ] = false;
339 339
 			}
340 340
 		}
341 341
 
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 
344 344
 		// render the setting
345 345
 		$type_class = self::load_type_class( $setting );
346
-		if( class_exists( $type_class ) ) {
346
+		if ( class_exists( $type_class ) ) {
347 347
 			/** @type GravityView_FieldType $render_type */
348 348
 			$render_type = new $type_class( $name, $setting, $curr_value );
349 349
 			ob_start();
@@ -352,25 +352,25 @@  discard block
 block discarded – undo
352 352
 		}
353 353
 
354 354
 		// Check if setting is specific for a template
355
-		if( !empty( $setting['show_in_template'] ) ) {
356
-			if( !is_array( $setting['show_in_template'] ) ) {
357
-				$setting['show_in_template'] = array( $setting['show_in_template'] );
355
+		if ( ! empty( $setting[ 'show_in_template' ] ) ) {
356
+			if ( ! is_array( $setting[ 'show_in_template' ] ) ) {
357
+				$setting[ 'show_in_template' ] = array( $setting[ 'show_in_template' ] );
358 358
 			}
359
-			$show_if = ' data-show-if="'. implode( ' ', $setting['show_in_template'] ).'"';
359
+			$show_if = ' data-show-if="' . implode( ' ', $setting[ 'show_in_template' ] ) . '"';
360 360
 		} else {
361 361
 			$show_if = '';
362 362
 		}
363 363
 
364
-		if( ! empty( $setting['requires'] ) ) {
365
-			$show_if .= sprintf( ' data-requires="%s"', $setting['requires'] );
364
+		if ( ! empty( $setting[ 'requires' ] ) ) {
365
+			$show_if .= sprintf( ' data-requires="%s"', $setting[ 'requires' ] );
366 366
 		}
367 367
 
368
-		if( ! empty( $setting['requires_not'] ) ) {
369
-			$show_if .= sprintf( ' data-requires-not="%s"', $setting['requires_not'] );
368
+		if ( ! empty( $setting[ 'requires_not' ] ) ) {
369
+			$show_if .= sprintf( ' data-requires-not="%s"', $setting[ 'requires_not' ] );
370 370
 		}
371 371
 
372 372
 		// output
373
-		echo '<tr style="vertical-align: top;" '. $show_if .'>' . $output . '</tr>';
373
+		echo '<tr style="vertical-align: top;" ' . $show_if . '>' . $output . '</tr>';
374 374
 
375 375
 	}
376 376
 
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
 	 */
383 383
 	public static function load_type_class( $field = NULL ) {
384 384
 
385
-		if( empty( $field['type'] ) ) {
385
+		if ( empty( $field[ 'type' ] ) ) {
386 386
 			return NULL;
387 387
 		}
388 388
 
@@ -391,9 +391,9 @@  discard block
 block discarded – undo
391 391
 		 * @param string $class_suffix  field class suffix; `GravityView_FieldType_{$class_suffix}`
392 392
 		 * @param array $field   field data
393 393
 		 */
394
-		$type_class = apply_filters( "gravityview/setting/class/{$field['type']}", 'GravityView_FieldType_' . $field['type'], $field );
394
+		$type_class = apply_filters( "gravityview/setting/class/{$field[ 'type' ]}", 'GravityView_FieldType_' . $field[ 'type' ], $field );
395 395
 
396
-		if( class_exists( $type_class ) ) {
396
+		if ( class_exists( $type_class ) ) {
397 397
 			return $type_class;
398 398
 		}
399 399
 
@@ -402,9 +402,9 @@  discard block
 block discarded – undo
402 402
 		 * @param string  $field_type_include_path field class file path
403 403
 		 * @param array $field  field data
404 404
 		 */
405
-		$class_file = apply_filters( "gravityview/setting/class_file/{$field['type']}", GRAVITYVIEW_DIR . "includes/admin/field-types/type_{$field['type']}.php", $field );
405
+		$class_file = apply_filters( "gravityview/setting/class_file/{$field[ 'type' ]}", GRAVITYVIEW_DIR . "includes/admin/field-types/type_{$field[ 'type' ]}.php", $field );
406 406
 
407
-		if( $class_file && file_exists( $class_file ) ) {
407
+		if ( $class_file && file_exists( $class_file ) ) {
408 408
 			require_once( $class_file );
409 409
 		}
410 410
 
@@ -426,8 +426,8 @@  discard block
 block discarded – undo
426 426
 
427 427
 		_deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_checkbox::render_input' );
428 428
 
429
-		$output  = '<input name="'. esc_attr( $name ) .'" type="hidden" value="0">';
430
-		$output .= '<input name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" type="checkbox" value="1" '. checked( $current, '1', false ) .' >';
429
+		$output  = '<input name="' . esc_attr( $name ) . '" type="hidden" value="0">';
430
+		$output .= '<input name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" type="checkbox" value="1" ' . checked( $current, '1', false ) . ' >';
431 431
 
432 432
 		return $output;
433 433
 	}
@@ -447,22 +447,22 @@  discard block
 block discarded – undo
447 447
 		_deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_text::render_input' );
448 448
 
449 449
 		// Show the merge tags if the field is a list view
450
-		$is_list = ( preg_match( '/_list-/ism', $name ));
450
+		$is_list = ( preg_match( '/_list-/ism', $name ) );
451 451
 
452 452
 		// Or is a single entry view
453
-		$is_single = ( preg_match( '/single_/ism', $name ));
453
+		$is_single = ( preg_match( '/single_/ism', $name ) );
454 454
 		$show = ( $is_single || $is_list );
455 455
 
456 456
 		$class = '';
457 457
 		// and $add_merge_tags is not false
458
-		if( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) {
458
+		if ( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) {
459 459
 			$class = 'merge-tag-support mt-position-right mt-hide_all_fields ';
460 460
 		}
461 461
 
462
-		$class .= !empty( $args['class'] ) ? $args['class'] : 'widefat';
463
-		$type = !empty( $args['type'] ) ? $args['type'] : 'text';
462
+		$class .= ! empty( $args[ 'class' ] ) ? $args[ 'class' ] : 'widefat';
463
+		$type = ! empty( $args[ 'type' ] ) ? $args[ 'type' ] : 'text';
464 464
 
465
-		return '<input name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" type="'.esc_attr($type).'" value="'. esc_attr( $current ) .'" class="'.esc_attr( $class ).'">';
465
+		return '<input name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" type="' . esc_attr( $type ) . '" value="' . esc_attr( $current ) . '" class="' . esc_attr( $class ) . '">';
466 466
 	}
467 467
 
468 468
 	/**
@@ -479,21 +479,21 @@  discard block
 block discarded – undo
479 479
 		_deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_textarea::render_input' );
480 480
 
481 481
 		// Show the merge tags if the field is a list view
482
-		$is_list = ( preg_match( '/_list-/ism', $name ));
482
+		$is_list = ( preg_match( '/_list-/ism', $name ) );
483 483
 
484 484
 		// Or is a single entry view
485
-		$is_single = ( preg_match( '/single_/ism', $name ));
485
+		$is_single = ( preg_match( '/single_/ism', $name ) );
486 486
 		$show = ( $is_single || $is_list );
487 487
 
488 488
 		$class = '';
489 489
 		// and $add_merge_tags is not false
490
-		if( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) {
490
+		if ( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) {
491 491
 			$class = 'merge-tag-support mt-position-right mt-hide_all_fields ';
492 492
 		}
493 493
 
494
-		$class .= !empty( $args['class'] ) ? 'widefat '.$args['class'] : 'widefat';
494
+		$class .= ! empty( $args[ 'class' ] ) ? 'widefat ' . $args[ 'class' ] : 'widefat';
495 495
 
496
-		return '<textarea name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" class="'.esc_attr( $class ).'">'. esc_textarea( $current ) .'</textarea>';
496
+		return '<textarea name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" class="' . esc_attr( $class ) . '">' . esc_textarea( $current ) . '</textarea>';
497 497
 	}
498 498
 
499 499
 	/**
@@ -509,9 +509,9 @@  discard block
 block discarded – undo
509 509
 
510 510
 		_deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_select::render_input' );
511 511
 
512
-		$output = '<select name="'. $name .'" id="'. $id .'">';
513
-		foreach( $choices as $value => $label ) {
514
-			$output .= '<option value="'. esc_attr( $value ) .'" '. selected( $value, $current, false ) .'>'. esc_html( $label ) .'</option>';
512
+		$output = '<select name="' . $name . '" id="' . $id . '">';
513
+		foreach ( $choices as $value => $label ) {
514
+			$output .= '<option value="' . esc_attr( $value ) . '" ' . selected( $value, $current, false ) . '>' . esc_html( $label ) . '</option>';
515 515
 		}
516 516
 		$output .= '</select>';
517 517
 
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-address.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
 				continue;
63 63
 			}
64 64
 
65
-			$field_id = intval( floor( $search_field['key'] ) );
66
-			$input_id = gravityview_get_input_id_from_id( $search_field['key'] );
65
+			$field_id = intval( floor( $search_field[ 'key' ] ) );
66
+			$input_id = gravityview_get_input_id_from_id( $search_field[ 'key' ] );
67 67
 			$form = GravityView_View::getInstance()->getForm();
68 68
 
69 69
 			/** @type GF_Field_Address $address_field */
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 			$choices = array();
73 73
 
74 74
 			$method_name = 'get_choices_' . self::get_input_type_from_input_id( $input_id );
75
-			if( method_exists( $this, $method_name ) ) {
75
+			if ( method_exists( $this, $method_name ) ) {
76 76
 				/**
77 77
 				 * @uses GravityView_Field_Address::get_choices_country()
78 78
 				 * @uses GravityView_Field_Address::get_choices_state()
@@ -80,12 +80,12 @@  discard block
 block discarded – undo
80 80
 				$choices = $this->{$method_name}( $address_field, $form );
81 81
 			}
82 82
 
83
-			if( ! empty( $choices ) ) {
84
-				$search_field['choices'] = $choices;
85
-				$search_field['type'] = \GV\Utils::get( $search_field, 'input');
83
+			if ( ! empty( $choices ) ) {
84
+				$search_field[ 'choices' ] = $choices;
85
+				$search_field[ 'type' ] = \GV\Utils::get( $search_field, 'input' );
86 86
 			} else {
87
-				$search_field['type'] = 'text';
88
-				$search_field['input'] = 'input_text';
87
+				$search_field[ 'type' ] = 'text';
88
+				$search_field[ 'input' ] = 'input_text';
89 89
 			}
90 90
 		}
91 91
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 		$country_choices = array();
111 111
 
112 112
 		foreach ( $countries as $key => $country ) {
113
-			$country_choices[] = array(
113
+			$country_choices[ ] = array(
114 114
 				'value' => $country,
115 115
 				'text' => $country,
116 116
 			);
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	 */
136 136
 	private function get_choices_state( $address_field, $form ) {
137 137
 
138
-		$address_type = empty( $address_field->addressType ) ? $address_field->get_default_address_type( $form['id'] ) : $address_field->addressType;
138
+		$address_type = empty( $address_field->addressType ) ? $address_field->get_default_address_type( $form[ 'id' ] ) : $address_field->addressType;
139 139
 
140 140
 		$state_choices = array();
141 141
 
@@ -147,8 +147,8 @@  discard block
 block discarded – undo
147 147
 				$states = GFCommon::get_canadian_provinces();
148 148
 				break;
149 149
 			default:
150
-				$address_types = $address_field->get_address_types( $form['id'] );
151
-				$states = empty( $address_types[ $address_type ]['states'] ) ? array() : $address_types[ $address_type ]['states'];
150
+				$address_types = $address_field->get_address_types( $form[ 'id' ] );
151
+				$states = empty( $address_types[ $address_type ][ 'states' ] ) ? array() : $address_types[ $address_type ][ 'states' ];
152 152
 				break;
153 153
 		}
154 154
 
@@ -157,19 +157,19 @@  discard block
 block discarded – undo
157 157
 				$state_subchoices = array();
158 158
 
159 159
 				foreach ( $state as $key => $substate ) {
160
-					$state_subchoices[] = array(
160
+					$state_subchoices[ ] = array(
161 161
 						'value' => is_numeric( $key ) ? $substate : $key,
162 162
 						'text' => $substate,
163 163
 					);
164 164
 				}
165 165
 
166
-				$state_choices[] = array(
166
+				$state_choices[ ] = array(
167 167
 					'text' => $key,
168 168
 					'value' => $state_subchoices,
169 169
 				);
170 170
 
171 171
 			} else {
172
-				$state_choices[] = array(
172
+				$state_choices[ ] = array(
173 173
 					'value' => is_numeric( $key ) ? $state : $key,
174 174
 					'text' => $state,
175 175
 				);
@@ -193,13 +193,13 @@  discard block
 block discarded – undo
193 193
 		// Use the same inputs as the "text" input type allows
194 194
 		$text_inputs = \GV\Utils::get( $input_types, 'text' );
195 195
 
196
-		$input_types['street'] = $text_inputs;
197
-		$input_types['street2'] = $text_inputs;
198
-		$input_types['city'] = $text_inputs;
196
+		$input_types[ 'street' ] = $text_inputs;
197
+		$input_types[ 'street2' ] = $text_inputs;
198
+		$input_types[ 'city' ] = $text_inputs;
199 199
 
200
-		$input_types['state'] = array( 'select', 'radio', 'link' ) + $text_inputs;
201
-		$input_types['zip'] = array( 'input_text' );
202
-		$input_types['country'] = array( 'select', 'radio', 'link' ) + $text_inputs;
200
+		$input_types[ 'state' ] = array( 'select', 'radio', 'link' ) + $text_inputs;
201
+		$input_types[ 'zip' ] = array( 'input_text' );
202
+		$input_types[ 'country' ] = array( 'select', 'radio', 'link' ) + $text_inputs;
203 203
 
204 204
 		return $input_types;
205 205
 	}
@@ -220,12 +220,12 @@  discard block
 block discarded – undo
220 220
 		// Is this search field for an input (eg: 4.2) or the whole address field (eg: 4)?
221 221
 		$input_id = gravityview_get_input_id_from_id( $field_id );
222 222
 
223
-		if( 'address' !== $field_type && $input_id ) {
223
+		if ( 'address' !== $field_type && $input_id ) {
224 224
 			return $input_type;
225 225
 		}
226 226
 
227 227
 		// If the input ID matches an expected address input, set to that. Otherwise, keep existing input type.
228
-		if( $address_field_name = self::get_input_type_from_input_id( $input_id ) ) {
228
+		if ( $address_field_name = self::get_input_type_from_input_id( $input_id ) ) {
229 229
 			$input_type = $address_field_name;
230 230
 		}
231 231
 
@@ -273,20 +273,20 @@  discard block
 block discarded – undo
273 273
 	public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) {
274 274
 
275 275
 		// If this is NOT the full address field, return default options.
276
-		if( floor( $field_id ) !== floatval( $field_id ) ) {
276
+		if ( floor( $field_id ) !== floatval( $field_id ) ) {
277 277
 			return $field_options;
278 278
 		}
279 279
 
280
-		if( 'edit' === $context ) {
280
+		if ( 'edit' === $context ) {
281 281
 			return $field_options;
282 282
 		}
283 283
 
284 284
 		$add_options = array();
285 285
 
286
-		$add_options['show_map_link'] = array(
286
+		$add_options[ 'show_map_link' ] = array(
287 287
 			'type' => 'checkbox',
288 288
 			'label' => __( 'Show Map Link:', 'gravityview' ),
289
-			'desc' => __('Display a "Map It" link below the address', 'gravityview'),
289
+			'desc' => __( 'Display a "Map It" link below the address', 'gravityview' ),
290 290
 			'value' => true,
291 291
 			'merge_tags' => false,
292 292
 		);
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-hidden.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	function edit_entry_fix_hidden_fields( $fields ) {
50 50
 
51 51
 		/** @type GF_Field $field */
52
-		foreach( $fields as &$field ) {
52
+		foreach ( $fields as &$field ) {
53 53
 
54 54
 			if ( 'hidden' === $field->type ) {
55 55
 
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 				 */
63 63
 				$reveal_hidden_field = apply_filters( 'gravityview/edit_entry/reveal_hidden_field', false, $field );
64 64
 
65
-				if( ! $reveal_hidden_field ) {
65
+				if ( ! $reveal_hidden_field ) {
66 66
 					continue;
67 67
 				}
68 68
 
Please login to merge, or discard this patch.
plugin-and-theme-hooks/class-gravityview-plugin-hooks-gravity-perks.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
 	public function edit_entry_fix_uid_fields( $fields ) {
51 51
 
52 52
 		/** @type \GF_Field $field */
53
-		foreach( $fields as &$field ) {
53
+		foreach ( $fields as &$field ) {
54 54
 			if ( 'uid' === $field->type ) {
55 55
 
56 56
 				// Replace GF_Field with GF_Field_Text, copying all the data from $field
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
 		/** @type \GV\GF_Field|\GV\Internal_Field $field_class 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 '';
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 	 * @return mixed|null The value for the given configuration key, null if doesn't exist.
360 360
 	 */
361 361
 	public function __get( $key ) {
362
-		switch( $key ) {
362
+		switch ( $key ) {
363 363
 			default:
364 364
 				if ( isset( $this->configuration[ $key ] ) ) {
365 365
 					return $this->configuration[ $key ];
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 	 * @return boolean Whether this $key is set or not.
378 378
 	 */
379 379
 	public function __isset( $key ) {
380
-		switch( $key ) {
380
+		switch ( $key ) {
381 381
 			default:
382 382
 				return isset( $this->configuration[ $key ] );
383 383
 		}
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-website.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
 	public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) {
30 30
 
31 31
 		// It makes no sense to use this as the link.
32
-		unset( $field_options['show_as_link'] );
32
+		unset( $field_options[ 'show_as_link' ] );
33 33
 
34
-		if( 'edit' === $context ) {
34
+		if ( 'edit' === $context ) {
35 35
 			return $field_options;
36 36
 		}
37 37
 
@@ -39,12 +39,12 @@  discard block
 block discarded – undo
39 39
 		 * Set default to opening in new links for back-compatibility with Version 1.5.1
40 40
 		 * @link https://github.com/gravityview/GravityView/commit/e12e76e2d032754227728d41e65103042d4f75ec
41 41
 		 */
42
-		$field_options['new_window']['value'] = true;
42
+		$field_options[ 'new_window' ][ 'value' ] = true;
43 43
 
44 44
 		/**
45 45
 		 * @since 1.8
46 46
 		 */
47
-		$field_options['anchor_text'] = array(
47
+		$field_options[ 'anchor_text' ] = array(
48 48
 			'type' => 'text',
49 49
 			'label' => __( 'Link Text:', 'gravityview' ),
50 50
 			'desc' => __( 'Define custom link text. Leave blank to display the URL', 'gravityview' ),
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 			'merge_tags' => 'force',
53 53
 		);
54 54
 
55
-		$field_options['truncatelink'] = array(
55
+		$field_options[ 'truncatelink' ] = array(
56 56
 			'type' => 'checkbox',
57 57
 			'value' => true,
58 58
 			'label' => __( 'Shorten Link Display', 'gravityview' ),
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-other-entries.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
 	public function __construct() {
27 27
 		$this->label = esc_html__( 'Other Entries', 'gravityview' );
28
-		$this->description = esc_html__('Display other entries created by the entry creator.', 'gravityview');
28
+		$this->description = esc_html__( 'Display other entries created by the entry creator.', 'gravityview' );
29 29
 		parent::__construct();
30 30
 	}
31 31
 
@@ -35,32 +35,32 @@  discard block
 block discarded – undo
35 35
 	 */
36 36
 	public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) {
37 37
 
38
-		if( 'edit' === $context ) {
38
+		if ( 'edit' === $context ) {
39 39
 			return $field_options;
40 40
 		}
41 41
 
42 42
 		// No "Link to single entry"; all the items will be links to entries!
43
-		unset( $field_options['show_as_link'] );
43
+		unset( $field_options[ 'show_as_link' ] );
44 44
 
45 45
 		$new_options = array();
46 46
 
47
-		$new_options['link_format'] = array(
47
+		$new_options[ 'link_format' ] = array(
48 48
 			'type'  => 'text',
49 49
 			'label' => __( 'Entry link text (required)', 'gravityview' ),
50
-			'value' => __('Entry #{entry_id}', 'gravityview'),
50
+			'value' => __( 'Entry #{entry_id}', 'gravityview' ),
51 51
 			'merge_tags' => 'force',
52 52
 		);
53 53
 
54
-		$new_options['after_link'] = array(
54
+		$new_options[ 'after_link' ] = array(
55 55
 			'type'  => 'textarea',
56 56
 			'label' => __( 'Text or HTML to display after the link (optional)', 'gravityview' ),
57
-			'desc'  => __('This content will be displayed below each entry link.', 'gravityview'),
57
+			'desc'  => __( 'This content will be displayed below each entry link.', 'gravityview' ),
58 58
 			'value' => '',
59 59
 			'merge_tags' => 'force',
60 60
 			'class' => 'widefat code',
61 61
 		);
62 62
 
63
-		$new_options['page_size'] = array(
63
+		$new_options[ 'page_size' ] = array(
64 64
 			'type'  => 'number',
65 65
 			'label' => __( 'Entries to Display', 'gravityview' ),
66 66
 			'desc'  => __( 'What is the maximum number of entries that should be shown?', 'gravityview' ) . ' ' . sprintf( _x( 'Set to %s for no maximum.', '%s replaced with a formatted 0', 'gravityview' ), '<code>0</code>' ),
@@ -69,14 +69,14 @@  discard block
 block discarded – undo
69 69
 			'min'   => 0,
70 70
 		);
71 71
 
72
-		$new_options['no_entries_hide'] = array(
72
+		$new_options[ 'no_entries_hide' ] = array(
73 73
 			'type'  => 'checkbox',
74 74
 			'label' => __( 'Hide if no entries', 'gravityview' ),
75 75
 			'desc'  => __( 'Don\'t display this field if the entry creator has no other entries', 'gravityview' ),
76 76
 			'value' => false,
77 77
 		);
78 78
 
79
-		$new_options['no_entries_text'] = array(
79
+		$new_options[ 'no_entries_text' ] = array(
80 80
 			'type'  => 'text',
81 81
 			'label' => __( 'No Entries Text', 'gravityview' ),
82 82
 			'desc'  => __( 'The text that is shown if the entry creator has no other entries (and "Hide if no entries" is disabled).', 'gravityview' ),
@@ -110,11 +110,11 @@  discard block
 block discarded – undo
110 110
 		foreach ( $filters as $filter ) {
111 111
 			foreach ( $wp_filter[ $filter ] as $priority => $callbacks ) {
112 112
 				foreach ( $callbacks as $id => $callback ) {
113
-					if ( ! is_array( $callback['function'] ) ) {
113
+					if ( ! is_array( $callback[ 'function' ] ) ) {
114 114
 						continue;
115 115
 					}
116
-					if ( $callback['function'][0] instanceof \GV\Widget ) {
117
-						$remove[] = array( $filter, $priority, $id );
116
+					if ( $callback[ 'function' ][ 0 ] instanceof \GV\Widget ) {
117
+						$remove[ ] = array( $filter, $priority, $id );
118 118
 					}
119 119
 				}
120 120
 			}
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 
123 123
 		foreach ( $remove as $r ) {
124 124
 			list( $filter, $priority, $id ) = $r;
125
-			$removed[] = array( $filter, $priority, $id, $wp_filter[ $filter ]->callbacks[ $priority ][ $id ] );
125
+			$removed[ ] = array( $filter, $priority, $id, $wp_filter[ $filter ]->callbacks[ $priority ][ $id ] );
126 126
 			unset( $wp_filter[ $filter ]->callbacks[ $priority ][ $id ] );
127 127
 		}
128 128
 
@@ -146,10 +146,10 @@  discard block
 block discarded – undo
146 146
 	public function filter_entries( $search_criteria, $form_id = null, $args = array(), $force_search_criteria = false ) {
147 147
 		$context = $this->context;
148 148
 
149
-		$created_by = $context->entry['created_by'];
149
+		$created_by = $context->entry[ 'created_by' ];
150 150
 
151 151
 		/** Filter entries by approved and created_by. */
152
-		$search_criteria['field_filters'][] = array(
152
+		$search_criteria[ 'field_filters' ][ ] = array(
153 153
 			'key' => 'created_by',
154 154
 			'value' => $created_by,
155 155
 			'operator' => 'is'
@@ -169,14 +169,14 @@  discard block
 block discarded – undo
169 169
 		$criteria = apply_filters( 'gravityview/field/other_entries/criteria', $search_criteria, $context->view->settings->as_atts(), $context->view->form->ID, $context );
170 170
 
171 171
 		/** Force mode all and filter out our own entry. */
172
-		$search_criteria['field_filters']['mode'] = 'all';
173
-		$search_criteria['field_filters'][] = array(
172
+		$search_criteria[ 'field_filters' ][ 'mode' ] = 'all';
173
+		$search_criteria[ 'field_filters' ][ ] = array(
174 174
 			'key' => 'id',
175 175
 			'value' => $context->entry->ID,
176 176
 			'operator' => 'isnot'
177 177
 		);
178 178
 
179
-		$search_criteria['paging']['page_size'] = $context->field->page_size ? : 10;
179
+		$search_criteria[ 'paging' ][ 'page_size' ] = $context->field->page_size ?: 10;
180 180
 
181 181
 		return $search_criteria;
182 182
 	}
Please login to merge, or discard this patch.
includes/extensions/delete-entry/class-delete-entry.php 3 patches
Doc Comments   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,6 +39,9 @@  discard block
 block discarded – undo
39 39
 		$this->add_hooks();
40 40
 	}
41 41
 
42
+	/**
43
+	 * @param string $component
44
+	 */
42 45
 	private function load_components( $component ) {
43 46
 
44 47
 		$dir = trailingslashit( self::$file );
@@ -255,7 +258,6 @@  discard block
 block discarded – undo
255 258
 	 *
256 259
 	 * @since 1.5.1
257 260
 	 * @param  array       $visibility_caps        Array of capabilities to display in field dropdown.
258
-	 * @param  string      $field_type  Type of field options to render (`field` or `widget`)
259 261
 	 * @param  string      $template_id Table slug
260 262
 	 * @param  float       $field_id    GF Field ID - Example: `3`, `5.2`, `entry_link`, `created_by`
261 263
 	 * @param  string      $context     What context are we in? Example: `single` or `directory`
@@ -717,7 +719,7 @@  discard block
 block discarded – undo
717 719
 	 *
718 720
 	 * @param  array $entry Gravity Forms entry array
719 721
 	 * @param array $field Field settings (optional)
720
-	 * @param int|\GV\View $view Pass a View ID to check caps against. If not set, check against current View (@deprecated no longer optional)
722
+	 * @param integer $view Pass a View ID to check caps against. If not set, check against current View (@deprecated no longer optional)
721 723
 	 * @return bool
722 724
 	 */
723 725
 	public static function check_user_cap_delete_entry( $entry, $field = array(), $view = 0 ) {
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -532,7 +532,7 @@
 block discarded – undo
532 532
 				 * @since 1.16.4
533 533
 				 * @param  int $entry_id ID of the Gravity Forms entry
534 534
 				 * @param  array $entry Deleted entry array
535
-				*/
535
+				 */
536 536
 				do_action( 'gravityview/delete-entry/deleted', $entry_id, $entry );
537 537
 			}
538 538
 
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 
150 150
 		// Index 100 is the default GravityView template path.
151 151
 		// Index 110 is Edit Entry link
152
-		$file_paths[115] = self::$file;
152
+		$file_paths[ 115 ] = self::$file;
153 153
 
154 154
 		return $file_paths;
155 155
 	}
@@ -170,12 +170,12 @@  discard block
 block discarded – undo
170 170
 	function delete_link_field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
171 171
 
172 172
 		// Always a link, never a filter
173
-		unset( $field_options['show_as_link'], $field_options['search_filter'] );
173
+		unset( $field_options[ 'show_as_link' ], $field_options[ 'search_filter' ] );
174 174
 
175 175
 		// Delete Entry link should only appear to visitors capable of editing entries
176
-		unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] );
176
+		unset( $field_options[ 'only_loggedin' ], $field_options[ 'only_loggedin_cap' ] );
177 177
 
178
-		$add_option['delete_link'] = array(
178
+		$add_option[ 'delete_link' ] = array(
179 179
 			'type' => 'text',
180 180
 			'label' => __( 'Delete Link Text', 'gravityview' ),
181 181
 			'desc' => null,
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 			'merge_tags' => true,
184 184
 		);
185 185
 
186
-		$field_options['allow_edit_cap'] = array(
186
+		$field_options[ 'allow_edit_cap' ] = array(
187 187
 			'type' => 'select',
188 188
 			'label' => __( 'Allow the following users to delete the entry:', 'gravityview' ),
189 189
 			'choices' => GravityView_Render_Settings::get_cap_choices( $template_id, $field_id, $context, $input_type ),
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 	function add_default_field( $entry_default_fields, $form = array(), $zone = '' ) {
208 208
 
209 209
 		if ( 'edit' !== $zone ) {
210
-			$entry_default_fields['delete_link'] = array(
210
+			$entry_default_fields[ 'delete_link' ] = array(
211 211
 				'label' => __( 'Delete Entry', 'gravityview' ),
212 212
 				'type'  => 'delete_link',
213 213
 				'desc'  => __( 'A link to delete the entry. Respects the Delete Entry permissions.', 'gravityview' ),
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 	 */
225 225
 	function add_available_field( $available_fields = array() ) {
226 226
 
227
-		$available_fields['delete_link'] = array(
227
+		$available_fields[ 'delete_link' ] = array(
228 228
 			'label_text' => __( 'Delete Entry', 'gravityview' ),
229 229
 			'field_id' => 'delete_link',
230 230
 			'label_type' => 'field',
@@ -270,9 +270,9 @@  discard block
 block discarded – undo
270 270
 		if ( $field_id === 'delete_link' ) {
271 271
 
272 272
 			// Remove other built-in caps.
273
-			unset( $caps['publish_posts'], $caps['gravityforms_view_entries'], $caps['delete_others_posts'] );
273
+			unset( $caps[ 'publish_posts' ], $caps[ 'gravityforms_view_entries' ], $caps[ 'delete_others_posts' ] );
274 274
 
275
-			$caps['read'] = _x( 'Entry Creator', 'User capability', 'gravityview' );
275
+			$caps[ 'read' ] = _x( 'Entry Creator', 'User capability', 'gravityview' );
276 276
 		}
277 277
 
278 278
 		return $caps;
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 	 * @param [type] $entry [description]
286 286
 	 */
287 287
 	function set_entry( $entry = null ) {
288
-		$this->entry = empty( $entry ) ? GravityView_View::getInstance()->entries[0] : $entry;
288
+		$this->entry = empty( $entry ) ? GravityView_View::getInstance()->entries[ 0 ] : $entry;
289 289
 	}
290 290
 
291 291
 	/**
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 
319 319
 		self::getInstance()->set_entry( $entry );
320 320
 
321
-		$base = GravityView_API::directory_link( $post_id ? : $view_id, true );
321
+		$base = GravityView_API::directory_link( $post_id ?: $view_id, true );
322 322
 
323 323
 		if ( empty( $base ) ) {
324 324
 			gravityview()->log->error( 'Post ID does not exist: {post_id}', array( 'post_id' => $post_id ) );
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 
380 380
 		$attributes = array(
381 381
 			'class' => 'btn btn-sm button button-small alignright pull-right btn-danger gv-button-delete',
382
-			'tabindex' => ( GFCommon::$tab_index ++ ),
382
+			'tabindex' => ( GFCommon::$tab_index++ ),
383 383
 			'onclick' => self::get_confirm_dialog(),
384 384
 		);
385 385
 
@@ -415,10 +415,10 @@  discard block
 block discarded – undo
415 415
 		);
416 416
 
417 417
 		// If the form is submitted
418
-		if ( 'delete' === $get_fields['action'] && ! empty( $get_fields['entry_id'] ) ) {
418
+		if ( 'delete' === $get_fields[ 'action' ] && ! empty( $get_fields[ 'entry_id' ] ) ) {
419 419
 
420 420
 			// Make sure it's a GravityView request
421
-			$valid_nonce_key = wp_verify_nonce( $get_fields['delete'], self::get_nonce_key( $get_fields['entry_id'] ) );
421
+			$valid_nonce_key = wp_verify_nonce( $get_fields[ 'delete' ], self::get_nonce_key( $get_fields[ 'entry_id' ] ) );
422 422
 
423 423
 			if ( ! $valid_nonce_key ) {
424 424
 				gravityview()->log->debug( 'Delete entry not processed: nonce validation failed.' );
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
 			}
427 427
 
428 428
 			// Get the entry slug
429
-			$entry_slug = esc_attr( $get_fields['entry_id'] );
429
+			$entry_slug = esc_attr( $get_fields[ 'entry_id' ] );
430 430
 
431 431
 			// See if there's an entry there
432 432
 			$entry = gravityview_get_entry( $entry_slug, true, false );
@@ -473,12 +473,12 @@  discard block
 block discarded – undo
473 473
 			}
474 474
 
475 475
 			// Redirect after deleting the entry.
476
-			$view                = \GV\View::by_id( $get_fields['view_id'] );
476
+			$view                = \GV\View::by_id( $get_fields[ 'view_id' ] );
477 477
 			$delete_redirect     = $view->settings->get( 'delete_redirect' );
478 478
 			$delete_redirect_url = $view->settings->get( 'delete_redirect_url' );
479 479
 
480 480
 			if ( '1' !== $delete_redirect ) {
481
-				$delete_redirect_url = get_post_permalink( $get_fields['view_id'] );
481
+				$delete_redirect_url = get_post_permalink( $get_fields[ 'view_id' ] );
482 482
 			}
483 483
 
484 484
 			wp_safe_redirect( $delete_redirect_url );
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
 	 */
514 514
 	private function delete_or_trash_entry( $entry ) {
515 515
 
516
-		$entry_id = $entry['id'];
516
+		$entry_id = $entry[ 'id' ];
517 517
 
518 518
 		$mode = $this->get_delete_mode();
519 519
 
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
 	public function process_connected_posts( $entry_id = 0, $entry = array() ) {
578 578
 
579 579
 		// The entry had no connected post
580
-		if ( empty( $entry['post_id'] ) ) {
580
+		if ( empty( $entry[ 'post_id' ] ) ) {
581 581
 			return;
582 582
 		}
583 583
 
@@ -595,9 +595,9 @@  discard block
 block discarded – undo
595 595
 		$action = current_action();
596 596
 
597 597
 		if ( 'gravityview/delete-entry/deleted' === $action ) {
598
-			$result = wp_delete_post( $entry['post_id'], true );
598
+			$result = wp_delete_post( $entry[ 'post_id' ], true );
599 599
 		} else {
600
-			$result = wp_trash_post( $entry['post_id'] );
600
+			$result = wp_trash_post( $entry[ 'post_id' ] );
601 601
 		}
602 602
 
603 603
 		if ( false === $result ) {
@@ -628,13 +628,13 @@  discard block
 block discarded – undo
628 628
 	public function verify_nonce() {
629 629
 
630 630
 		// No delete entry request was made
631
-		if ( empty( $_GET['entry_id'] ) || empty( $_GET['delete'] ) ) {
631
+		if ( empty( $_GET[ 'entry_id' ] ) || empty( $_GET[ 'delete' ] ) ) {
632 632
 			return false;
633 633
 		}
634 634
 
635
-		$nonce_key = self::get_nonce_key( $_GET['entry_id'] );
635
+		$nonce_key = self::get_nonce_key( $_GET[ 'entry_id' ] );
636 636
 
637
-		$valid = wp_verify_nonce( $_GET['delete'], $nonce_key );
637
+		$valid = wp_verify_nonce( $_GET[ 'delete' ], $nonce_key );
638 638
 
639 639
 		/**
640 640
 		 * @filter `gravityview/delete-entry/verify_nonce` Override Delete Entry nonce validation. Return true to declare nonce valid.
@@ -690,7 +690,7 @@  discard block
 block discarded – undo
690 690
 			$error = __( 'You do not have permission to delete this entry.', 'gravityview' );
691 691
 		}
692 692
 
693
-		if ( $entry['status'] === 'trash' ) {
693
+		if ( $entry[ 'status' ] === 'trash' ) {
694 694
 			if ( 'trash' === $this->get_delete_mode() ) {
695 695
 				$error = __( 'The entry is already in the trash.', 'gravityview' );
696 696
 			} else {
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
 
735 735
 		$current_user = wp_get_current_user();
736 736
 
737
-		$entry_id = isset( $entry['id'] ) ? $entry['id'] : null;
737
+		$entry_id = isset( $entry[ 'id' ] ) ? $entry[ 'id' ] : null;
738 738
 
739 739
 		// Or if they can delete any entries (as defined in Gravity Forms), we're good.
740 740
 		if ( GVCommon::has_cap( array( 'gravityforms_delete_entries', 'gravityview_delete_others_entries' ), $entry_id ) ) {
@@ -748,17 +748,17 @@  discard block
 block discarded – undo
748 748
 		if ( ! empty( $field ) ) {
749 749
 
750 750
 			// If capability is not defined, something is not right!
751
-			if ( empty( $field['allow_edit_cap'] ) ) {
751
+			if ( empty( $field[ 'allow_edit_cap' ] ) ) {
752 752
 
753 753
 				gravityview()->log->error( 'Cannot read delete entry field caps', array( 'data' => $field ) );
754 754
 
755 755
 				return false;
756 756
 			}
757 757
 
758
-			if ( GVCommon::has_cap( $field['allow_edit_cap'] ) ) {
758
+			if ( GVCommon::has_cap( $field[ 'allow_edit_cap' ] ) ) {
759 759
 
760 760
 				// Do not return true if cap is read, as we need to check if the current user created the entry
761
-				if ( $field['allow_edit_cap'] !== 'read' ) {
761
+				if ( $field[ 'allow_edit_cap' ] !== 'read' ) {
762 762
 					return true;
763 763
 				}
764 764
 			} else {
@@ -769,7 +769,7 @@  discard block
 block discarded – undo
769 769
 			}
770 770
 		}
771 771
 
772
-		if ( ! isset( $entry['created_by'] ) ) {
772
+		if ( ! isset( $entry[ 'created_by' ] ) ) {
773 773
 
774 774
 			gravityview()->log->error( 'Entry `created_by` doesn\'t exist.' );
775 775
 
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
 		}
786 786
 
787 787
 		// If the logged-in user is the same as the user who created the entry, we're good.
788
-		if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) {
788
+		if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry[ 'created_by' ] ) ) {
789 789
 
790 790
 			gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id' => $current_user->ID ) );
791 791
 
@@ -809,12 +809,12 @@  discard block
 block discarded – undo
809 809
 	 * @return void
810 810
 	 */
811 811
 	public function maybe_display_message( $current_view_id = 0 ) {
812
-		if ( empty( $_GET['status'] ) || ! self::verify_nonce() ) {
812
+		if ( empty( $_GET[ 'status' ] ) || ! self::verify_nonce() ) {
813 813
 			return;
814 814
 		}
815 815
 
816 816
 		// Entry wasn't deleted from current View
817
-		if ( isset( $_GET['view_id'] ) && intval( $_GET['view_id'] ) !== intval( $current_view_id ) ) {
817
+		if ( isset( $_GET[ 'view_id' ] ) && intval( $_GET[ 'view_id' ] ) !== intval( $current_view_id ) ) {
818 818
 			return;
819 819
 		}
820 820
 
@@ -823,11 +823,11 @@  discard block
 block discarded – undo
823 823
 
824 824
 	public function display_message() {
825 825
 
826
-		if ( empty( $_GET['status'] ) || empty( $_GET['delete'] ) ) {
826
+		if ( empty( $_GET[ 'status' ] ) || empty( $_GET[ 'delete' ] ) ) {
827 827
 			return;
828 828
 		}
829 829
 
830
-		$status = esc_attr( $_GET['status'] );
830
+		$status = esc_attr( $_GET[ 'status' ] );
831 831
 		$message_from_url = \GV\Utils::_GET( 'message' );
832 832
 		$message_from_url = rawurldecode( stripslashes_deep( $message_from_url ) );
833 833
 		$class = '';
Please login to merge, or discard this patch.
includes/admin/metaboxes/class-gravityview-admin-metaboxes.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -52,13 +52,13 @@  discard block
 block discarded – undo
52 52
 	function update_priority() {
53 53
 		global $wp_meta_boxes;
54 54
 
55
-		if ( ! empty( $wp_meta_boxes['gravityview'] ) ) {
55
+		if ( ! empty( $wp_meta_boxes[ 'gravityview' ] ) ) {
56 56
 			foreach ( array( 'high', 'core', 'low' ) as $position ) {
57
-				if ( isset( $wp_meta_boxes['gravityview']['normal'][ $position ] ) ) {
58
-					foreach ( $wp_meta_boxes['gravityview']['normal'][ $position ] as $key => $meta_box ) {
57
+				if ( isset( $wp_meta_boxes[ 'gravityview' ][ 'normal' ][ $position ] ) ) {
58
+					foreach ( $wp_meta_boxes[ 'gravityview' ][ 'normal' ][ $position ] as $key => $meta_box ) {
59 59
 						if ( ! preg_match( '/^gravityview_/ism', $key ) ) {
60
-							$wp_meta_boxes['gravityview']['advanced'][ $position ][ $key ] = $meta_box;
61
-							unset( $wp_meta_boxes['gravityview']['normal'][ $position ][ $key ] );
60
+							$wp_meta_boxes[ 'gravityview' ][ 'advanced' ][ $position ][ $key ] = $meta_box;
61
+							unset( $wp_meta_boxes[ 'gravityview' ][ 'normal' ][ $position ][ $key ] );
62 62
 						}
63 63
 					}
64 64
 				}
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 
192 192
 		foreach ( $metaboxes as $m ) {
193 193
 
194
-			$tab = new GravityView_Metabox_Tab( $m['id'], $m['title'], $m['file'], $m['icon-class'], $m['callback'], $m['callback_args'] );
194
+			$tab = new GravityView_Metabox_Tab( $m[ 'id' ], $m[ 'title' ], $m[ 'file' ], $m[ 'icon-class' ], $m[ 'callback' ], $m[ 'callback_args' ] );
195 195
 
196 196
 			GravityView_Metabox_Tabs::add( $tab );
197 197
 
@@ -261,13 +261,13 @@  discard block
 block discarded – undo
261 261
 
262 262
 		$form = gravityview_get_form( $curr_form );
263 263
 
264
-		$get_id_backup = isset( $_GET['id'] ) ? $_GET['id'] : null;
264
+		$get_id_backup = isset( $_GET[ 'id' ] ) ? $_GET[ 'id' ] : null;
265 265
 
266
-		if ( isset( $form['id'] ) ) {
266
+		if ( isset( $form[ 'id' ] ) ) {
267 267
 			$form_script = 'var form = ' . GFCommon::json_encode( $form ) . ';';
268 268
 
269 269
 			// The `gf_vars()` method needs a $_GET[id] variable set with the form ID.
270
-			$_GET['id'] = $form['id'];
270
+			$_GET[ 'id' ] = $form[ 'id' ];
271 271
 
272 272
 		} else {
273 273
 			$form_script = 'var form = new Form();';
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 		$output = '<script type="text/javascript" data-gv-merge-tags="1">' . $form_script . "\n" . GFCommon::gf_vars( false ) . '</script>';
277 277
 
278 278
 		// Restore previous $_GET setting
279
-		$_GET['id'] = $get_id_backup;
279
+		$_GET[ 'id' ] = $get_id_backup;
280 280
 
281 281
 		return $output;
282 282
 	}
Please login to merge, or discard this patch.