From 81977934471f11acfba4f18dfdd8c42bbb9c0030 Mon Sep 17 00:00:00 2001 From: Nikolay Bachiyski Date: Tue, 21 Jun 2016 14:57:16 +0000 Subject: [PATCH] Admin: escape URL-encoded permalinks Merge of [37801] to the 4.0 branch. Built from https://develop.svn.wordpress.org/branches/4.0@37817 git-svn-id: http://core.svn.wordpress.org/branches/4.0@37782 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/post.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php index 0bf9917eca..393dc1250a 100644 --- a/wp-admin/includes/post.php +++ b/wp-admin/includes/post.php @@ -1220,7 +1220,7 @@ function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) { } if ( false === strpos( $permalink, '%postname%' ) && false === strpos( $permalink, '%pagename%' ) ) { - $return = '' . __('Permalink:') . "\n" . '' . $permalink . "\n"; + $return = '' . __('Permalink:') . "\n" . '' . esc_html( $permalink ) . "\n"; if ( '' == get_option( 'permalink_structure' ) && current_user_can( 'manage_options' ) && !( 'page' == get_option('show_on_front') && $id == get_option('page_on_front') ) ) { $return .= '' . __('Change Permalinks') . "\n"; } @@ -1239,14 +1239,14 @@ function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) { } } - $post_name_html = '' . $post_name_abridged . ''; - $display_link = str_replace( array( '%pagename%', '%postname%' ), $post_name_html, $permalink ); + $post_name_html = '' . esc_html( $post_name_abridged ) . ''; + $display_link = str_replace( array( '%pagename%', '%postname%' ), $post_name_html, esc_html( $permalink ) ); $return = '' . __( 'Permalink:' ) . "\n"; $return .= '' . $display_link . "\n"; $return .= '‎'; // Fix bi-directional text display defect in RTL languages. $return .= '' . __( 'Edit' ) . "\n"; - $return .= '' . $post_name . "\n"; + $return .= '' . esc_html( $post_name ) . "\n"; } if ( isset( $view_post ) ) { @@ -1256,7 +1256,7 @@ function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) { $preview_link = apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ), $post ); $return .= "$view_post\n"; } else { - $return .= "$view_post\n"; + $return .= "$view_post\n"; } }