@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | $is_table_layout = preg_match( '/table/ism', $template_id ); |
55 | 55 | |
56 | - if( 'field' === $field_type ) { |
|
56 | + if ( 'field' === $field_type ) { |
|
57 | 57 | |
58 | 58 | // Default options - fields |
59 | 59 | $field_options = array( |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | ); |
106 | 106 | |
107 | 107 | if ( 'directory' === $context ) { |
108 | - $field_options['new_window'] = array( |
|
108 | + $field_options[ 'new_window' ] = array( |
|
109 | 109 | 'type' => 'checkbox', |
110 | 110 | 'label' => __( 'Open link in a new tab or window?', 'gravityview' ), |
111 | 111 | 'value' => false, |
@@ -115,11 +115,11 @@ discard block |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | // Match Table as well as DataTables |
118 | - if( $is_table_layout && 'directory' === $context ) { |
|
119 | - $field_options['width'] = array( |
|
118 | + if ( $is_table_layout && 'directory' === $context ) { |
|
119 | + $field_options[ 'width' ] = array( |
|
120 | 120 | 'type' => 'number', |
121 | - 'label' => __('Percent Width', 'gravityview'), |
|
122 | - 'desc' => __( 'Leave blank for column width to be based on the field content.', 'gravityview'), |
|
121 | + 'label' => __( 'Percent Width', 'gravityview' ), |
|
122 | + 'desc' => __( 'Leave blank for column width to be based on the field content.', 'gravityview' ), |
|
123 | 123 | 'class' => 'code widefat', |
124 | 124 | 'value' => '', |
125 | 125 | 'priority' => 200, |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | |
132 | 132 | // Remove suffix ":" from the labels to standardize style. Using trim() instead of rtrim() for i18n. |
133 | 133 | foreach ( $field_options as $key => $field_option ) { |
134 | - $field_options[ $key ]['label'] = trim( $field_options[ $key ]['label'], ':' ); |
|
134 | + $field_options[ $key ][ 'label' ] = trim( $field_options[ $key ][ 'label' ], ':' ); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | switch ( $key ) { |
167 | 167 | case 'show_as_link': |
168 | 168 | $_group = 'display'; |
169 | - $field_option['priority'] = 100; |
|
169 | + $field_option[ 'priority' ] = 100; |
|
170 | 170 | break; |
171 | 171 | default: |
172 | 172 | $_group = \GV\Utils::get( $field_option, 'group', 'display' ); |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | } |
182 | 182 | |
183 | 183 | $field_options = array(); |
184 | - foreach ( self::get_field_groups() as $group_key => $group_name ) { |
|
184 | + foreach ( self::get_field_groups() as $group_key => $group_name ) { |
|
185 | 185 | $field_options[ $group_key ] = \GV\Utils::get( $option_groups, $group_key, array() ); |
186 | 186 | } |
187 | 187 | |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | return 0; |
213 | 213 | } |
214 | 214 | |
215 | - return ( $a_priority < $b_priority ) ? - 1 : 1; |
|
215 | + return ( $a_priority < $b_priority ) ? -1 : 1; |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | /** |
@@ -237,8 +237,8 @@ discard block |
||
237 | 237 | 'manage_options' => __( 'Administrator', 'gravityview' ), |
238 | 238 | ); |
239 | 239 | |
240 | - if( is_multisite() ) { |
|
241 | - $select_cap_choices['manage_network'] = __('Multisite Super Admin', 'gravityview' ); |
|
240 | + if ( is_multisite() ) { |
|
241 | + $select_cap_choices[ 'manage_network' ] = __( 'Multisite Super Admin', 'gravityview' ); |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | /** |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | * @param string $context Optional. What context are we in? Example: `single` or `directory` |
252 | 252 | * @param string $input_type Optional. (textarea, list, select, etc.) |
253 | 253 | */ |
254 | - $select_cap_choices = apply_filters('gravityview_field_visibility_caps', $select_cap_choices, $template_id, $field_id, $context, $input_type ); |
|
254 | + $select_cap_choices = apply_filters( 'gravityview_field_visibility_caps', $select_cap_choices, $template_id, $field_id, $context, $input_type ); |
|
255 | 255 | |
256 | 256 | return $select_cap_choices; |
257 | 257 | } |
@@ -278,9 +278,9 @@ discard block |
||
278 | 278 | */ |
279 | 279 | 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() ) { |
280 | 280 | |
281 | - if( empty( $uniqid ) ) { |
|
281 | + if ( empty( $uniqid ) ) { |
|
282 | 282 | //generate a unique field id |
283 | - $uniqid = uniqid('', false); |
|
283 | + $uniqid = uniqid( '', false ); |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | $grouped = ( 'field' === $field_type ); |
@@ -288,24 +288,24 @@ discard block |
||
288 | 288 | // get field/widget options |
289 | 289 | $option_groups = self::get_default_field_options( $field_type, $template_id, $field_id, $context, $input_type, $form_id, $grouped ); |
290 | 290 | |
291 | - if( ! $grouped ) { |
|
291 | + if ( ! $grouped ) { |
|
292 | 292 | $option_groups = array( $option_groups ); |
293 | 293 | } |
294 | 294 | |
295 | 295 | $option_groups = array_filter( $option_groups ); |
296 | 296 | |
297 | 297 | // two different post arrays, depending of the field type |
298 | - $name_prefix = $field_type .'s' .'['. $area .']['. $uniqid .']'; |
|
298 | + $name_prefix = $field_type . 's' . '[' . $area . '][' . $uniqid . ']'; |
|
299 | 299 | |
300 | 300 | // build output |
301 | - $hidden_fields = '<input type="hidden" class="field-key" name="'. $name_prefix .'[id]" value="'. esc_attr( $field_id ) .'">'; |
|
302 | - $hidden_fields .= '<input type="hidden" class="field-label" name="'. $name_prefix .'[label]" value="'. esc_attr( $field_label ) .'">'; |
|
301 | + $hidden_fields = '<input type="hidden" class="field-key" name="' . $name_prefix . '[id]" value="' . esc_attr( $field_id ) . '">'; |
|
302 | + $hidden_fields .= '<input type="hidden" class="field-label" name="' . $name_prefix . '[label]" value="' . esc_attr( $field_label ) . '">'; |
|
303 | 303 | |
304 | 304 | $form_title = ''; |
305 | 305 | if ( $form_id ) { |
306 | - $hidden_fields .= '<input type="hidden" class="field-form-id" name="'. $name_prefix .'[form_id]" value="'. esc_attr( $form_id ) .'">'; |
|
306 | + $hidden_fields .= '<input type="hidden" class="field-form-id" name="' . $name_prefix . '[form_id]" value="' . esc_attr( $form_id ) . '">'; |
|
307 | 307 | $form = GVCommon::get_form( $form_id ); |
308 | - $form_title = $form['title']; |
|
308 | + $form_title = $form[ 'title' ]; |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | // If there are no options, return what we got. |
@@ -313,14 +313,14 @@ discard block |
||
313 | 313 | return $hidden_fields . '<!-- No Options -->'; // The HTML comment is here for checking if the output is empty in render_label() |
314 | 314 | } |
315 | 315 | |
316 | - $settings_title = esc_attr( sprintf( __( '%s Settings', 'gravityview' ) , strip_tags( html_entity_decode( $field_label ) ) ) ); |
|
316 | + $settings_title = esc_attr( sprintf( __( '%s Settings', 'gravityview' ), strip_tags( html_entity_decode( $field_label ) ) ) ); |
|
317 | 317 | |
318 | 318 | $field_details = ''; |
319 | 319 | |
320 | 320 | // Get the pretty name for the input type |
321 | 321 | $gv_field = GravityView_Fields::get( $input_type ); |
322 | 322 | |
323 | - if( $gv_field ) { |
|
323 | + if ( $gv_field ) { |
|
324 | 324 | $input_type_label = $gv_field->label; |
325 | 325 | } else { |
326 | 326 | $input_type_label = $input_type; |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | } |
335 | 335 | |
336 | 336 | if ( $grouped ) { |
337 | - $group_name = rgar( self::get_field_groups(), $group_key, '' ); |
|
337 | + $group_name = rgar( self::get_field_groups(), $group_key, '' ); |
|
338 | 338 | $field_settings .= '<fieldset class="item-settings-group item-settings-group-' . esc_attr( $group_key ) . '">'; |
339 | 339 | $field_settings .= '<legend>' . esc_attr( $group_name ) . '</legend>'; |
340 | 340 | } |
@@ -351,15 +351,15 @@ discard block |
||
351 | 351 | } |
352 | 352 | |
353 | 353 | $show_if = ''; |
354 | - if ( ! empty( $option['requires'] ) ) { |
|
355 | - $show_if .= sprintf( ' data-requires="%s"', $option['requires'] ); |
|
354 | + if ( ! empty( $option[ 'requires' ] ) ) { |
|
355 | + $show_if .= sprintf( ' data-requires="%s"', $option[ 'requires' ] ); |
|
356 | 356 | } |
357 | 357 | |
358 | - if ( ! empty( $option['requires_not'] ) ) { |
|
359 | - $show_if .= sprintf( ' data-requires-not="%s"', $option['requires_not'] ); |
|
358 | + if ( ! empty( $option[ 'requires_not' ] ) ) { |
|
359 | + $show_if .= sprintf( ' data-requires-not="%s"', $option[ 'requires_not' ] ); |
|
360 | 360 | } |
361 | 361 | |
362 | - switch ( $option['type'] ) { |
|
362 | + switch ( $option[ 'type' ] ) { |
|
363 | 363 | // Hide hidden fields |
364 | 364 | case 'hidden': |
365 | 365 | $field_settings .= '<div class="gv-setting-container gv-setting-container-' . esc_attr( $key ) . ' screen-reader-text">' . $field_output . '</div>'; |
@@ -377,30 +377,30 @@ discard block |
||
377 | 377 | $item_details = ''; |
378 | 378 | $subtitle = ''; |
379 | 379 | |
380 | - if( 'field' === $field_type ) { |
|
381 | - $subtitle = ! empty( $item['subtitle'] ) ? '<div class="subtitle">' . $item['subtitle'] . '</div>' : ''; |
|
380 | + if ( 'field' === $field_type ) { |
|
381 | + $subtitle = ! empty( $item[ 'subtitle' ] ) ? '<div class="subtitle">' . $item[ 'subtitle' ] . '</div>' : ''; |
|
382 | 382 | |
383 | 383 | $item_details .= ' |
384 | 384 | <div class="gv-field-details--container"> |
385 | - <label class="gv-field-details--toggle">' . esc_html__( 'Field Details', 'gravityview' ) .' <i class="dashicons dashicons-arrow-down"></i></label> |
|
385 | + <label class="gv-field-details--toggle">' . esc_html__( 'Field Details', 'gravityview' ) . ' <i class="dashicons dashicons-arrow-down"></i></label> |
|
386 | 386 | <section class="gv-field-details gv-field-details--closed">'; |
387 | 387 | |
388 | 388 | if ( $field_id && is_numeric( $field_id ) ) { |
389 | 389 | $item_details .= ' |
390 | 390 | <div class="gv-field-detail gv-field-detail--field"> |
391 | - <span class="gv-field-detail--label">' . esc_html__( 'Field ID', 'gravityview' ) .'</span><span class="gv-field-detail--value">#{{field_id}}</span> |
|
391 | + <span class="gv-field-detail--label">' . esc_html__( 'Field ID', 'gravityview' ) . '</span><span class="gv-field-detail--value">#{{field_id}}</span> |
|
392 | 392 | </div>'; |
393 | 393 | } |
394 | 394 | |
395 | 395 | $item_details .= ' |
396 | 396 | <div class="gv-field-detail gv-field-detail--type"> |
397 | - <span class="gv-field-detail--label">' . esc_html_x( 'Type', 'The type of field being configured (eg: "Single Line Text")', 'gravityview' ) .'</span><span class="gv-field-detail--value">{{input_type_label}}</span> |
|
397 | + <span class="gv-field-detail--label">' . esc_html_x( 'Type', 'The type of field being configured (eg: "Single Line Text")', 'gravityview' ) . '</span><span class="gv-field-detail--value">{{input_type_label}}</span> |
|
398 | 398 | </div>'; |
399 | 399 | |
400 | - if( $form_id ) { |
|
400 | + if ( $form_id ) { |
|
401 | 401 | $item_details .= ' |
402 | 402 | <div class="gv-field-detail gv-field-detail--form"> |
403 | - <span class="gv-field-detail--label">' . esc_html__( 'Form', 'gravityview' ) .'</span><span class="gv-field-detail--value">{{form_title}} (#{{form_id}})</span> |
|
403 | + <span class="gv-field-detail--label">' . esc_html__( 'Form', 'gravityview' ) . '</span><span class="gv-field-detail--value">{{form_title}} (#{{form_id}})</span> |
|
404 | 404 | </div>'; |
405 | 405 | } |
406 | 406 | $item_details .= ' |
@@ -408,8 +408,8 @@ discard block |
||
408 | 408 | </div>'; |
409 | 409 | } else { |
410 | 410 | $widget_details_content = rgar( $item, 'description', '' ); |
411 | - if ( ! empty( $item['subtitle'] ) ) { |
|
412 | - $widget_details_content .= ( '' !== $widget_details_content ) ? "\n\n" . $item['subtitle'] : $item['subtitle']; |
|
411 | + if ( ! empty( $item[ 'subtitle' ] ) ) { |
|
412 | + $widget_details_content .= ( '' !== $widget_details_content ) ? "\n\n" . $item[ 'subtitle' ] : $item[ 'subtitle' ]; |
|
413 | 413 | } |
414 | 414 | |
415 | 415 | // Intentionally not escaping to allow HTML. |
@@ -465,17 +465,17 @@ discard block |
||
465 | 465 | * @deprecated setting index 'default' was replaced by 'value' |
466 | 466 | * @see GravityView_FieldType::get_field_defaults |
467 | 467 | */ |
468 | - if( !empty( $option['default'] ) && empty( $option['value'] ) ) { |
|
469 | - $option['value'] = $option['default']; |
|
470 | - _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[value] instead of [default] when defining the setting '. $name .' details' ); |
|
468 | + if ( ! empty( $option[ 'default' ] ) && empty( $option[ 'value' ] ) ) { |
|
469 | + $option[ 'value' ] = $option[ 'default' ]; |
|
470 | + _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[value] instead of [default] when defining the setting ' . $name . ' details' ); |
|
471 | 471 | } |
472 | 472 | |
473 | 473 | // prepare to render option field type |
474 | - if( isset( $option['type'] ) ) { |
|
474 | + if ( isset( $option[ 'type' ] ) ) { |
|
475 | 475 | |
476 | 476 | $type_class = self::load_type_class( $option ); |
477 | 477 | |
478 | - if( class_exists( $type_class ) ) { |
|
478 | + if ( class_exists( $type_class ) ) { |
|
479 | 479 | |
480 | 480 | /** @type GravityView_FieldType $render_type */ |
481 | 481 | $render_type = new $type_class( $name, $option, $curr_value ); |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | * @param[in,out] string $output field class name |
493 | 493 | * @param[in] array $option option field data |
494 | 494 | */ |
495 | - $output = apply_filters( "gravityview/option/output/{$option['type']}" , $output, $option ); |
|
495 | + $output = apply_filters( "gravityview/option/output/{$option[ 'type' ]}", $output, $option ); |
|
496 | 496 | } |
497 | 497 | |
498 | 498 | } // isset option[type] |
@@ -527,27 +527,27 @@ discard block |
||
527 | 527 | * @deprecated setting index 'name' was replaced by 'label' |
528 | 528 | * @see GravityView_FieldType::get_field_defaults |
529 | 529 | */ |
530 | - if( isset( $setting['name'] ) && empty( $setting['label'] ) ) { |
|
531 | - $setting['label'] = $setting['name']; |
|
532 | - _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[label] instead of [name] when defining the setting '. $key .' details' ); |
|
530 | + if ( isset( $setting[ 'name' ] ) && empty( $setting[ 'label' ] ) ) { |
|
531 | + $setting[ 'label' ] = $setting[ 'name' ]; |
|
532 | + _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[label] instead of [name] when defining the setting ' . $key . ' details' ); |
|
533 | 533 | } |
534 | 534 | |
535 | 535 | $name = esc_attr( sprintf( $name, $key ) ); |
536 | - $setting['id'] = esc_attr( sprintf( $id, $key ) ); |
|
537 | - $setting['tooltip'] = 'gv_' . $key; |
|
536 | + $setting[ 'id' ] = esc_attr( sprintf( $id, $key ) ); |
|
537 | + $setting[ 'tooltip' ] = 'gv_' . $key; |
|
538 | 538 | |
539 | 539 | // Use default if current setting isn't set. |
540 | - $curr_value = isset( $current_settings[ $key ] ) ? $current_settings[ $key ] : $setting['value']; |
|
540 | + $curr_value = isset( $current_settings[ $key ] ) ? $current_settings[ $key ] : $setting[ 'value' ]; |
|
541 | 541 | |
542 | 542 | // default setting type = text |
543 | - $setting['type'] = empty( $setting['type'] ) ? 'text' : $setting['type']; |
|
543 | + $setting[ 'type' ] = empty( $setting[ 'type' ] ) ? 'text' : $setting[ 'type' ]; |
|
544 | 544 | |
545 | 545 | // merge tags |
546 | - if( !isset( $setting['merge_tags'] ) ) { |
|
547 | - if( $setting['type'] === 'text' ) { |
|
548 | - $setting['merge_tags'] = true; |
|
546 | + if ( ! isset( $setting[ 'merge_tags' ] ) ) { |
|
547 | + if ( $setting[ 'type' ] === 'text' ) { |
|
548 | + $setting[ 'merge_tags' ] = true; |
|
549 | 549 | } else { |
550 | - $setting['merge_tags'] = false; |
|
550 | + $setting[ 'merge_tags' ] = false; |
|
551 | 551 | } |
552 | 552 | } |
553 | 553 | |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | |
556 | 556 | // render the setting |
557 | 557 | $type_class = self::load_type_class( $setting ); |
558 | - if( class_exists( $type_class ) ) { |
|
558 | + if ( class_exists( $type_class ) ) { |
|
559 | 559 | /** @type GravityView_FieldType $render_type */ |
560 | 560 | $render_type = new $type_class( $name, $setting, $curr_value ); |
561 | 561 | ob_start(); |
@@ -564,25 +564,25 @@ discard block |
||
564 | 564 | } |
565 | 565 | |
566 | 566 | // Check if setting is specific for a template |
567 | - if( !empty( $setting['show_in_template'] ) ) { |
|
568 | - if( !is_array( $setting['show_in_template'] ) ) { |
|
569 | - $setting['show_in_template'] = array( $setting['show_in_template'] ); |
|
567 | + if ( ! empty( $setting[ 'show_in_template' ] ) ) { |
|
568 | + if ( ! is_array( $setting[ 'show_in_template' ] ) ) { |
|
569 | + $setting[ 'show_in_template' ] = array( $setting[ 'show_in_template' ] ); |
|
570 | 570 | } |
571 | - $show_if = ' data-show-if="'. implode( ' ', $setting['show_in_template'] ).'"'; |
|
571 | + $show_if = ' data-show-if="' . implode( ' ', $setting[ 'show_in_template' ] ) . '"'; |
|
572 | 572 | } else { |
573 | 573 | $show_if = ''; |
574 | 574 | } |
575 | 575 | |
576 | - if( ! empty( $setting['requires'] ) ) { |
|
577 | - $show_if .= sprintf( ' data-requires="%s"', $setting['requires'] ); |
|
576 | + if ( ! empty( $setting[ 'requires' ] ) ) { |
|
577 | + $show_if .= sprintf( ' data-requires="%s"', $setting[ 'requires' ] ); |
|
578 | 578 | } |
579 | 579 | |
580 | - if( ! empty( $setting['requires_not'] ) ) { |
|
581 | - $show_if .= sprintf( ' data-requires-not="%s"', $setting['requires_not'] ); |
|
580 | + if ( ! empty( $setting[ 'requires_not' ] ) ) { |
|
581 | + $show_if .= sprintf( ' data-requires-not="%s"', $setting[ 'requires_not' ] ); |
|
582 | 582 | } |
583 | 583 | |
584 | 584 | // output |
585 | - echo '<tr style="vertical-align: top;" '. $show_if .'>' . $output . '</tr>'; |
|
585 | + echo '<tr style="vertical-align: top;" ' . $show_if . '>' . $output . '</tr>'; |
|
586 | 586 | |
587 | 587 | } |
588 | 588 | |
@@ -594,7 +594,7 @@ discard block |
||
594 | 594 | */ |
595 | 595 | public static function load_type_class( $field = NULL ) { |
596 | 596 | |
597 | - if( empty( $field['type'] ) ) { |
|
597 | + if ( empty( $field[ 'type' ] ) ) { |
|
598 | 598 | return NULL; |
599 | 599 | } |
600 | 600 | |
@@ -603,9 +603,9 @@ discard block |
||
603 | 603 | * @param string $class_suffix field class suffix; `GravityView_FieldType_{$class_suffix}` |
604 | 604 | * @param array $field field data |
605 | 605 | */ |
606 | - $type_class = apply_filters( "gravityview/setting/class/{$field['type']}", 'GravityView_FieldType_' . $field['type'], $field ); |
|
606 | + $type_class = apply_filters( "gravityview/setting/class/{$field[ 'type' ]}", 'GravityView_FieldType_' . $field[ 'type' ], $field ); |
|
607 | 607 | |
608 | - if( class_exists( $type_class ) ) { |
|
608 | + if ( class_exists( $type_class ) ) { |
|
609 | 609 | return $type_class; |
610 | 610 | } |
611 | 611 | |
@@ -614,9 +614,9 @@ discard block |
||
614 | 614 | * @param string $field_type_include_path field class file path |
615 | 615 | * @param array $field field data |
616 | 616 | */ |
617 | - $class_file = apply_filters( "gravityview/setting/class_file/{$field['type']}", GRAVITYVIEW_DIR . "includes/admin/field-types/type_{$field['type']}.php", $field ); |
|
617 | + $class_file = apply_filters( "gravityview/setting/class_file/{$field[ 'type' ]}", GRAVITYVIEW_DIR . "includes/admin/field-types/type_{$field[ 'type' ]}.php", $field ); |
|
618 | 618 | |
619 | - if( $class_file && file_exists( $class_file ) ) { |
|
619 | + if ( $class_file && file_exists( $class_file ) ) { |
|
620 | 620 | require_once( $class_file ); |
621 | 621 | } |
622 | 622 | |
@@ -638,8 +638,8 @@ discard block |
||
638 | 638 | |
639 | 639 | _deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_checkbox::render_input' ); |
640 | 640 | |
641 | - $output = '<input name="'. esc_attr( $name ) .'" type="hidden" value="0">'; |
|
642 | - $output .= '<input name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" type="checkbox" value="1" '. checked( $current, '1', false ) .' >'; |
|
641 | + $output = '<input name="' . esc_attr( $name ) . '" type="hidden" value="0">'; |
|
642 | + $output .= '<input name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" type="checkbox" value="1" ' . checked( $current, '1', false ) . ' >'; |
|
643 | 643 | |
644 | 644 | return $output; |
645 | 645 | } |
@@ -659,22 +659,22 @@ discard block |
||
659 | 659 | _deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_text::render_input' ); |
660 | 660 | |
661 | 661 | // Show the merge tags if the field is a list view |
662 | - $is_list = ( preg_match( '/_list-/ism', $name )); |
|
662 | + $is_list = ( preg_match( '/_list-/ism', $name ) ); |
|
663 | 663 | |
664 | 664 | // Or is a single entry view |
665 | - $is_single = ( preg_match( '/single_/ism', $name )); |
|
665 | + $is_single = ( preg_match( '/single_/ism', $name ) ); |
|
666 | 666 | $show = ( $is_single || $is_list ); |
667 | 667 | |
668 | 668 | $class = ''; |
669 | 669 | // and $add_merge_tags is not false |
670 | - if( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
670 | + if ( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
671 | 671 | $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
672 | 672 | } |
673 | 673 | |
674 | - $class .= !empty( $args['class'] ) ? $args['class'] : 'widefat'; |
|
675 | - $type = !empty( $args['type'] ) ? $args['type'] : 'text'; |
|
674 | + $class .= ! empty( $args[ 'class' ] ) ? $args[ 'class' ] : 'widefat'; |
|
675 | + $type = ! empty( $args[ 'type' ] ) ? $args[ 'type' ] : 'text'; |
|
676 | 676 | |
677 | - return '<input name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" type="'.esc_attr($type).'" value="'. esc_attr( $current ) .'" class="'.esc_attr( $class ).'">'; |
|
677 | + return '<input name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" type="' . esc_attr( $type ) . '" value="' . esc_attr( $current ) . '" class="' . esc_attr( $class ) . '">'; |
|
678 | 678 | } |
679 | 679 | |
680 | 680 | /** |
@@ -691,21 +691,21 @@ discard block |
||
691 | 691 | _deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_textarea::render_input' ); |
692 | 692 | |
693 | 693 | // Show the merge tags if the field is a list view |
694 | - $is_list = ( preg_match( '/_list-/ism', $name )); |
|
694 | + $is_list = ( preg_match( '/_list-/ism', $name ) ); |
|
695 | 695 | |
696 | 696 | // Or is a single entry view |
697 | - $is_single = ( preg_match( '/single_/ism', $name )); |
|
697 | + $is_single = ( preg_match( '/single_/ism', $name ) ); |
|
698 | 698 | $show = ( $is_single || $is_list ); |
699 | 699 | |
700 | 700 | $class = ''; |
701 | 701 | // and $add_merge_tags is not false |
702 | - if( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
702 | + if ( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
703 | 703 | $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
704 | 704 | } |
705 | 705 | |
706 | - $class .= !empty( $args['class'] ) ? 'widefat '.$args['class'] : 'widefat'; |
|
706 | + $class .= ! empty( $args[ 'class' ] ) ? 'widefat ' . $args[ 'class' ] : 'widefat'; |
|
707 | 707 | |
708 | - return '<textarea name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" class="'.esc_attr( $class ).'">'. esc_textarea( $current ) .'</textarea>'; |
|
708 | + return '<textarea name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" class="' . esc_attr( $class ) . '">' . esc_textarea( $current ) . '</textarea>'; |
|
709 | 709 | } |
710 | 710 | |
711 | 711 | /** |
@@ -721,9 +721,9 @@ discard block |
||
721 | 721 | |
722 | 722 | _deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_select::render_input' ); |
723 | 723 | |
724 | - $output = '<select name="'. $name .'" id="'. $id .'">'; |
|
725 | - foreach( $choices as $value => $label ) { |
|
726 | - $output .= '<option value="'. esc_attr( $value ) .'" '. selected( $value, $current, false ) .'>'. esc_html( $label ) .'</option>'; |
|
724 | + $output = '<select name="' . $name . '" id="' . $id . '">'; |
|
725 | + foreach ( $choices as $value => $label ) { |
|
726 | + $output .= '<option value="' . esc_attr( $value ) . '" ' . selected( $value, $current, false ) . '>' . esc_html( $label ) . '</option>'; |
|
727 | 727 | } |
728 | 728 | $output .= '</select>'; |
729 | 729 |