WordPress.org

Make WordPress Core

Changeset 37807


Ignore:
Timestamp:
06/21/2016 02:49:37 PM (3 years ago)
Author:
nbachiyski
Message:

Admin: escape URL-encoded permalinks

Merge of [37801] to the 4.4 branch.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/4.4/src/wp-admin/includes/post.php

    r37767 r37807  
    13101310            } else {
    13111311                // Allow non-published (private, future) to be viewed at a pretty permalink.
    1312                 $view_link = str_replace( array( '%pagename%', '%postname%' ), $post->post_name, urldecode( $permalink ) );
     1312                $view_link = str_replace( array( '%pagename%', '%postname%' ), $post->post_name, $permalink );
    13131313            }
    13141314        }
     
    13201320
    13211321        if ( false !== $view_link ) {
    1322             $return .= '<a id="sample-permalink" href="' . esc_url( $view_link ) . '"' . $preview_target . '>' . $view_link . "</a>\n";
     1322            $display_link = urldecode( $view_link );
     1323            $return .= '<a id="sample-permalink" href="' . esc_url( $view_link ) . '"' . $preview_target . '>' . esc_html( $display_link ) . "</a>\n";
    13231324        } else {
    13241325            $return .= '<span id="sample-permalink">' . $permalink . "</span>\n";
     
    13441345        }
    13451346
    1346         $post_name_html = '<span id="editable-post-name">' . $post_name_abridged . '</span>';
    1347         $display_link = str_replace( array( '%pagename%', '%postname%' ), $post_name_html, urldecode( $permalink ) );
     1347        $post_name_html = '<span id="editable-post-name">' . esc_html( $post_name_abridged ) . '</span>';
     1348        $display_link = str_replace( array( '%pagename%', '%postname%' ), $post_name_html, esc_html( urldecode( $permalink ) ) );
    13481349
    13491350        $return = '<strong>' . __( 'Permalink:' ) . "</strong>\n";
     
    13511352        $return .= '&lrm;'; // Fix bi-directional text display defect in RTL languages.
    13521353        $return .= '<span id="edit-slug-buttons"><button type="button" class="edit-slug button button-small hide-if-no-js" aria-label="' . __( 'Edit permalink' ) . '">' . __( 'Edit' ) . "</button></span>\n";
    1353         $return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n";
     1354        $return .= '<span id="editable-post-name-full">' . esc_html( $post_name ) . "</span>\n";
    13541355    }
    13551356
Note: See TracChangeset for help on using the changeset viewer.