Customizer: Decode HTML entities of panel/section titles.

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

fixes #32670.
Built from https://develop.svn.wordpress.org/trunk@32822


git-svn-id: http://core.svn.wordpress.org/trunk@32793 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dominik Schilling 2015-06-17 19:48:25 +00:00
parent a1f7f4fe17
commit 2d2445516c
4 changed files with 10 additions and 8 deletions

View File

@ -111,7 +111,7 @@ final class WP_Customize_Nav_Menus {
foreach ( $posts as $post ) { foreach ( $posts as $post ) {
$items[] = array( $items[] = array(
'id' => "post-{$post->ID}", 'id' => "post-{$post->ID}",
'title' => html_entity_decode( get_the_title( $post ) ), 'title' => html_entity_decode( get_the_title( $post ), ENT_QUOTES, get_bloginfo( 'charset' ) ),
'type' => 'post_type', 'type' => 'post_type',
'type_label' => get_post_type_object( $post->post_type )->labels->singular_name, 'type_label' => get_post_type_object( $post->post_type )->labels->singular_name,
'object' => $post->post_type, 'object' => $post->post_type,
@ -138,7 +138,7 @@ final class WP_Customize_Nav_Menus {
foreach ( $terms as $term ) { foreach ( $terms as $term ) {
$items[] = array( $items[] = array(
'id' => "term-{$term->term_id}", 'id' => "term-{$term->term_id}",
'title' => html_entity_decode( $term->name ), 'title' => html_entity_decode( $term->name, ENT_QUOTES, get_bloginfo( 'charset' ) ),
'type' => 'taxonomy', 'type' => 'taxonomy',
'type_label' => get_taxonomy( $term->taxonomy )->labels->singular_name, 'type_label' => get_taxonomy( $term->taxonomy )->labels->singular_name,
'object' => $term->taxonomy, 'object' => $term->taxonomy,
@ -222,7 +222,7 @@ final class WP_Customize_Nav_Menus {
'type_label' => $post_type_objects[ $post->post_type ]->labels->singular_name, 'type_label' => $post_type_objects[ $post->post_type ]->labels->singular_name,
'object' => $post->post_type, 'object' => $post->post_type,
'object_id' => intval( $post->ID ), 'object_id' => intval( $post->ID ),
'title' => html_entity_decode( get_the_title( $post ) ), 'title' => html_entity_decode( get_the_title( $post ), ENT_QUOTES, get_bloginfo( 'charset' ) ),
); );
} }
} }
@ -244,7 +244,7 @@ final class WP_Customize_Nav_Menus {
'type_label' => get_taxonomy( $term->taxonomy )->labels->singular_name, 'type_label' => get_taxonomy( $term->taxonomy )->labels->singular_name,
'object' => $term->taxonomy, 'object' => $term->taxonomy,
'object_id' => intval( $term->term_id ), 'object_id' => intval( $term->term_id ),
'title' => html_entity_decode( $term->name ), 'title' => html_entity_decode( $term->name, ENT_QUOTES, get_bloginfo( 'charset' ) ),
); );
} }
} }
@ -443,7 +443,7 @@ final class WP_Customize_Nav_Menus {
// Create a section for each menu. // Create a section for each menu.
$section_id = 'nav_menu[' . $menu_id . ']'; $section_id = 'nav_menu[' . $menu_id . ']';
$this->manager->add_section( new WP_Customize_Nav_Menu_Section( $this->manager, $section_id, array( $this->manager->add_section( new WP_Customize_Nav_Menu_Section( $this->manager, $section_id, array(
'title' => html_entity_decode( $menu->name ), 'title' => html_entity_decode( $menu->name, ENT_QUOTES, get_bloginfo( 'charset' ) ),
'priority' => 10, 'priority' => 10,
'panel' => 'nav_menus', 'panel' => 'nav_menus',
) ) ); ) ) );

View File

@ -214,7 +214,8 @@ class WP_Customize_Panel {
* @return array The array to be exported to the client as JSON. * @return array The array to be exported to the client as JSON.
*/ */
public function json() { public function json() {
$array = wp_array_slice_assoc( (array) $this, array( 'id', 'title', 'description', 'priority', 'type' ) ); $array = wp_array_slice_assoc( (array) $this, array( 'id', 'description', 'priority', 'type' ) );
$array['title'] = html_entity_decode( $this->title, ENT_QUOTES, get_bloginfo( 'charset' ) );
$array['content'] = $this->get_content(); $array['content'] = $this->get_content();
$array['active'] = $this->active(); $array['active'] = $this->active();
$array['instanceNumber'] = $this->instance_number; $array['instanceNumber'] = $this->instance_number;

View File

@ -223,7 +223,8 @@ class WP_Customize_Section {
* @return array The array to be exported to the client as JSON. * @return array The array to be exported to the client as JSON.
*/ */
public function json() { public function json() {
$array = wp_array_slice_assoc( (array) $this, array( 'id', 'title', 'description', 'priority', 'panel', 'type' ) ); $array = wp_array_slice_assoc( (array) $this, array( 'id', 'description', 'priority', 'panel', 'type' ) );
$array['title'] = html_entity_decode( $this->title, ENT_QUOTES, get_bloginfo( 'charset' ) );
$array['content'] = $this->get_content(); $array['content'] = $this->get_content();
$array['active'] = $this->active(); $array['active'] = $this->active();
$array['instanceNumber'] = $this->instance_number; $array['instanceNumber'] = $this->instance_number;

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.3-alpha-32821'; $wp_version = '4.3-alpha-32822';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.