WordPress.org

Make WordPress Core

Changeset 37820


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

Admin: escape URL-encoded permalinks

Merge of [37801] to the 3.9 branch.

File:
1 edited

Legend:

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

    r37784 r37820  
    12141214
    12151215    if ( false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%') ) {
    1216         $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . $permalink . "</span>\n";
     1216        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . esc_html( $permalink ) . "</span>\n";
    12171217        if ( '' == get_option( 'permalink_structure' ) && current_user_can( 'manage_options' ) && !( 'page' == get_option('show_on_front') && $id == get_option('page_on_front') ) )
    12181218            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
    12191219        if ( isset( $view_post ) )
    1220             $return .= "<span id='view-post-btn'><a href='$permalink' class='button button-small'>$view_post</a></span>\n";
     1220            $return .= "<span id='view-post-btn'><a href='" . esc_url( $permalink ) . "' class='button button-small'>$view_post</a></span>\n";
    12211221
    12221222        /**
     
    12491249    }
    12501250
    1251     $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>';
    1252     $display_link = str_replace(array('%pagename%','%postname%'), $post_name_html, $permalink);
    1253     $view_link = str_replace(array('%pagename%','%postname%'), $post_name, $permalink);
     1251    $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . esc_html( $post_name_abridged ) . '</span>';
     1252    $display_link = str_replace(array('%pagename%','%postname%'), $post_name_html, esc_html( $permalink ) );
     1253    $view_link = str_replace(array('%pagename%','%postname%'), $post_name, esc_html( $permalink ) );
    12541254    $return =  '<strong>' . __('Permalink:') . "</strong>\n";
    12551255    $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
    12561256    $return .= '&lrm;'; // Fix bi-directional text display defect in RTL languages.
    12571257    $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
    1258     $return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n";
     1258    $return .= '<span id="editable-post-name-full">' . esc_html( $post_name ) . "</span>\n";
    12591259
    12601260    if ( isset( $view_post ) ) {
    1261         $return .= "<span id='view-post-btn'><a href='" . get_permalink( $post ) . "' class='button button-small'>$view_post</a></span>\n";
     1261        $return .= "<span id='view-post-btn'><a href='" . esc_url( get_permalink( $post ) ) . "' class='button button-small'>$view_post</a></span>\n";
    12621262    }
    12631263
Note: See TracChangeset for help on using the changeset viewer.