| @@ -673,9 +673,12 @@ | ||
| 673 | 673 | |
| 674 | 674 | /** |
| 675 | 675 | * @since 4.0 |
| 676 | 676 | * |
| 677 | - * @param array $args | |
| 677 | + * @param array $args Includes 'id', 'key', 'name', 'type' and 'class'. Optionally 'id_label' | |
| 678 | + * and 'key_label' to show something other than the id or key, and | |
| 679 | + * 'name_suffix'/'key_suffix' for text appended after the name or key is | |
| 680 | + * truncated, so a shortcode option like ' show=first' survives the truncation. | |
| 678 | 681 | * |
| 679 | 682 | * @return void |
| 680 | 683 | */ |
| 681 | 684 | public static function insert_opt_html( $args ) { |
| @@ -698,9 +701,10 @@ | ||
| 698 | 701 | if ( 'url' === $args['type'] ) { |
| 699 | 702 | $class .= ' frm_insert_url'; |
| 700 | 703 | } |
| 701 | 704 | |
| 702 | - $truncated_name = FrmAppHelper::truncate( $args['name'], 60 ); | |
| 705 | + $full_name = $args['name'] . ( $args['name_suffix'] ?? '' ); | |
| 706 | + $truncated_name = FrmAppHelper::truncate( $args['name'], 60 ) . ( $args['name_suffix'] ?? '' ); | |
| 703 | 707 | |
| 704 | 708 | // phpcs:disable Generic.WhiteSpace.ScopeIndent |
| 705 | 709 | ?> |
| 706 | 710 | <li class="<?php echo esc_attr( $class ); ?>"> |
| @@ -709,9 +713,13 @@ | ||
| 709 | 713 | if ( isset( $field['icon'] ) ) { |
| 710 | 714 | FrmAppHelper::icon_by_class( $field['icon'], array( 'aria-hidden' => 'true' ) ); |
| 711 | 715 | } |
| 712 | 716 | |
| 713 | - echo esc_html( $truncated_name ); | |
| 717 | + printf( | |
| 718 | + '<span title="%s">%s</span>', | |
| 719 | + esc_attr( $full_name ), | |
| 720 | + esc_html( $truncated_name ) | |
| 721 | + ); | |
| 714 | 722 | ?> |
| 715 | 723 | <span>[<?php echo esc_html( $args['id_label'] ?? $args['id'] ); ?>]</span> |
| 716 | 724 | </a> |
| 717 | 725 | <a href="javascript:void(0)" class="frmkeys frm_insert_code frm_hidden" data-code="<?php echo esc_attr( $args['key'] ); ?>"> |
| @@ -719,11 +727,15 @@ | ||
| 719 | 727 | if ( isset( $field['icon'] ) ) { |
| 720 | 728 | FrmAppHelper::icon_by_class( $field['icon'], array( 'aria-hidden' => 'true' ) ); |
| 721 | 729 | } |
| 722 | 730 | |
| 723 | - echo esc_html( $truncated_name ); | |
| 731 | + printf( | |
| 732 | + '<span title="%s">%s</span>', | |
| 733 | + esc_attr( $full_name ), | |
| 734 | + esc_html( $truncated_name ) | |
| 735 | + ); | |
| 724 | 736 | ?> |
| 725 | - <span>[<?php echo esc_html( FrmAppHelper::truncate( $args['key_label'] ?? $args['key'], 7 ) ); ?>]</span> | |
| 737 | + <span>[<?php echo esc_html( FrmAppHelper::truncate( $args['key_label'] ?? $args['key'], 7 ) . ( $args['key_suffix'] ?? '' ) ); ?>]</span> | |
| 726 | 738 | </a> |
| 727 | 739 | </li> |
| 728 | 740 | <?php |
| 729 | 741 | // phpcs:enable Generic.WhiteSpace.ScopeIndent |
| @@ -913,9 +925,9 @@ | ||
| 913 | 925 | $replace_with = $form->name; |
| 914 | 926 | } elseif ( $code === 'form_description' ) { |
| 915 | 927 | $replace_with = FrmAppHelper::use_wpautop( $form->description ); |
| 916 | 928 | } elseif ( $code === 'entry_key' && ! empty( $_GET ) && isset( $_GET['entry'] ) ) { |
| 917 | - $replace_with = FrmAppHelper::simple_get( 'entry' ); | |
| 929 | + $replace_with = FrmAppHelper::simple_get( 'entry', 'sanitize_title' ); | |
| 918 | 930 | } else { |
| 919 | 931 | $replace_with = ''; |
| 920 | 932 | } |
| 921 | 933 | |