WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#32670 closed defect (bug) (fixed)

Menu names in customizer shows HTML entities

Reported by: markoheijnen Owned by: ocean90
Milestone: 4.3 Priority: normal
Severity: normal Version: 4.3
Component: Customize Keywords: has-patch
Focuses: Cc:

Description

Currently when "Menus" is translated with entities like ' for Dutch "Menu's" then it's not correctly parsed due to the usage of {{menu.title}}. When this is menu.title then the value is displayed correctly.

I only fixed it for menus but I saw other places with only 2 brackets too. Unsure when to use what.

Attachments (2)

32670.diff (2.8 KB) - added by markoheijnen 5 years ago.
32670.patch (3.9 KB) - added by ocean90 5 years ago.
html_entity_decode()

Download all attachments as: .zip

Change History (9)

@markoheijnen
5 years ago

#1 @markoheijnen
5 years ago

  • Keywords has-patch added

#2 @ocean90
5 years ago

  • Keywords needs-patch added; has-patch removed

{{}} is needed for escaping. We probably missed an instance of html_entity_decode().

#3 @markoheijnen
5 years ago

Looking over the code, I do see places where it's placed but it doesn't work. It still could placed when WP_Customize_Nav_Menus_Panel get's created but the title of WP_Customize_Nav_Menu_Section already get's it but still fails to parse correctly.

#4 @markoheijnen
5 years ago

The following code does work. I placed it inside WP_Customize_Panel->json();

$array['title'] = $output = preg_replace_callback("/(&#[0-9]+;)/", function($m) { return mb_convert_encoding($m[1], "UTF-8", "HTML-ENTITIES"); }, $array['title']);

@ocean90
5 years ago

html_entity_decode()

#5 @ocean90
5 years ago

  • Keywords has-patch added; needs-patch removed

Related: #30737, #29572

32670.patch adds html_entity_decode() to section/panel titles.

#6 @markoheijnen
5 years ago

Works for me.

#7 @ocean90
5 years ago

  • Owner set to ocean90
  • Resolution set to fixed
  • Status changed from new to closed

In 32822:

Customizer: Decode HTML entities of panel/section titles.

Titles are now passed into Underscore templates but HTML-escaped, see #30737.

fixes #32670.

Note: See TracTickets for help on using tickets.