From 4fffaf4b61dc3b118a47634c0797fadeba6de4a4 Mon Sep 17 00:00:00 2001 From: Boro Sitnikovski Date: Sun, 13 Oct 2024 04:05:47 +0200 Subject: [PATCH 1/4] Fix special chars display in SMP The Site Management Panel may break when special chars are included in the blog's name (quotes, ampersands, etc.). This commit fixes that. --- .../wpcom-dashboard-widgets/wpcom-dashboard-widgets.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-dashboard-widgets/wpcom-dashboard-widgets.php b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-dashboard-widgets/wpcom-dashboard-widgets.php index c627f966f295a..a49ae0496c70f 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-dashboard-widgets/wpcom-dashboard-widgets.php +++ b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-dashboard-widgets/wpcom-dashboard-widgets.php @@ -48,7 +48,7 @@ function enqueue_wpcom_dashboard_widgets() { $data = wp_json_encode( array( - 'siteName' => get_bloginfo( 'name' ), + 'siteName' => htmlspecialchars_decode( get_bloginfo( 'name' ) ), 'siteDomain' => wp_parse_url( home_url(), PHP_URL_HOST ), 'siteIconUrl' => get_site_icon_url( 38 ), ) From aa55e0abebbcf0a758964e9452dc58c13db12599 Mon Sep 17 00:00:00 2001 From: Boro Sitnikovski Date: Sun, 13 Oct 2024 04:18:25 +0200 Subject: [PATCH 2/4] Add ENT_QUOTES --- .../wpcom-dashboard-widgets/wpcom-dashboard-widgets.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-dashboard-widgets/wpcom-dashboard-widgets.php b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-dashboard-widgets/wpcom-dashboard-widgets.php index a49ae0496c70f..0ad8bcdc61dca 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-dashboard-widgets/wpcom-dashboard-widgets.php +++ b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-dashboard-widgets/wpcom-dashboard-widgets.php @@ -48,7 +48,7 @@ function enqueue_wpcom_dashboard_widgets() { $data = wp_json_encode( array( - 'siteName' => htmlspecialchars_decode( get_bloginfo( 'name' ) ), + 'siteName' => htmlspecialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ), 'siteDomain' => wp_parse_url( home_url(), PHP_URL_HOST ), 'siteIconUrl' => get_site_icon_url( 38 ), ) From a341c2beab866b55907021de2b0238bc45b9ab6f Mon Sep 17 00:00:00 2001 From: Boro Sitnikovski Date: Sun, 13 Oct 2024 04:20:43 +0200 Subject: [PATCH 3/4] Changelog --- .../packages/jetpack-mu-wpcom/changelog/fix-smp-special-chars | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 projects/packages/jetpack-mu-wpcom/changelog/fix-smp-special-chars diff --git a/projects/packages/jetpack-mu-wpcom/changelog/fix-smp-special-chars b/projects/packages/jetpack-mu-wpcom/changelog/fix-smp-special-chars new file mode 100644 index 0000000000000..0bfb660b10d0f --- /dev/null +++ b/projects/packages/jetpack-mu-wpcom/changelog/fix-smp-special-chars @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +Site Management Panel: fix site name encoding display From 21769e3ede4ea63573d504d4f4d8fd6241cabddf Mon Sep 17 00:00:00 2001 From: Boro Sitnikovski Date: Thu, 24 Oct 2024 15:42:07 +0200 Subject: [PATCH 4/4] Use wp_specialchars_decode instead --- .../wpcom-dashboard-widgets/wpcom-dashboard-widgets.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-dashboard-widgets/wpcom-dashboard-widgets.php b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-dashboard-widgets/wpcom-dashboard-widgets.php index 0ad8bcdc61dca..5312a26f24cde 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-dashboard-widgets/wpcom-dashboard-widgets.php +++ b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-dashboard-widgets/wpcom-dashboard-widgets.php @@ -48,7 +48,7 @@ function enqueue_wpcom_dashboard_widgets() { $data = wp_json_encode( array( - 'siteName' => htmlspecialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ), + 'siteName' => wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ), 'siteDomain' => wp_parse_url( home_url(), PHP_URL_HOST ), 'siteIconUrl' => get_site_icon_url( 38 ), )