| @@ -667,8 +667,15 @@ | ||
| 667 | 667 | } |
| 668 | 668 | |
| 669 | 669 | $snippet = $json['snippets'][0]; |
| 670 | 670 | |
| 671 | + // Decode HTML entities in the snippet name so imported titles show | |
| 672 | + // "&" instead of the raw entity "&". The cloud content stores the | |
| 673 | + // name HTML-encoded, and Nexter's file-based import uses it as-is. | |
| 674 | + if ( isset( $snippet['name'] ) ) { | |
| 675 | + $snippet['name'] = html_entity_decode( (string) $snippet['name'], ENT_QUOTES, 'UTF-8' ); | |
| 676 | + } | |
| 677 | + | |
| 671 | 678 | if ( empty( $snippet['post_type'] ) || 'nxt-code-snippet' !== $snippet['post_type'] ) { |
| 672 | 679 | $data = array( |
| 673 | 680 | 'success' => false, |
| 674 | 681 | 'data' => array( |
| @@ -719,9 +726,9 @@ | ||
| 719 | 726 | } else { |
| 720 | 727 | // Fallback to old post-based method if file-based failed. |
| 721 | 728 | $post_id = wp_insert_post( |
| 722 | 729 | array( |
| 723 | - 'post_title' => sanitize_text_field( html_entity_decode( wp_unslash( $snippet['name'] ) ) ), | |
| 730 | + 'post_title' => sanitize_text_field( $snippet['name'] ), | |
| 724 | 731 | 'post_type' => 'nxt-code-snippet', |
| 725 | 732 | 'post_status' => 'publish', |
| 726 | 733 | ) |
| 727 | 734 | ); |