From fd3703563e96637687b8265f21895d80b0525230 Mon Sep 17 00:00:00 2001 From: Nikolay Bachiyski Date: Tue, 21 Jun 2016 14:59:08 +0000 Subject: [PATCH] Admin: escape URL-encoded permalinks Merge of [37801] to the 3.7 branch. git-svn-id: https://develop.svn.wordpress.org/branches/3.7@37823 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/post.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/wp-admin/includes/post.php b/src/wp-admin/includes/post.php index 1be0fc6b9f..e691045a34 100644 --- a/src/wp-admin/includes/post.php +++ b/src/wp-admin/includes/post.php @@ -1154,11 +1154,11 @@ 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"; if ( isset( $view_post ) ) - $return .= "$view_post\n"; + $return .= "$view_post\n"; $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug); @@ -1179,16 +1179,16 @@ 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 ) ); $view_link = str_replace(array('%pagename%','%postname%'), $post_name, $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) ) - $return .= "$view_post\n"; + $return .= "$view_post\n"; $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);