WordPress.org

Make WordPress Core

Changeset 37817


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

Admin: escape URL-encoded permalinks

Merge of [37801] to the 4.0 branch.

File:
1 edited

Legend:

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

    r37782 r37817  
    12211221
    12221222    if ( false === strpos( $permalink, '%postname%' ) && false === strpos( $permalink, '%pagename%' ) ) {
    1223         $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . $permalink . "</span>\n";
     1223        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . esc_html( $permalink ) . "</span>\n";
    12241224        if ( '' == get_option( 'permalink_structure' ) && current_user_can( 'manage_options' ) && !( 'page' == get_option('show_on_front') && $id == get_option('page_on_front') ) ) {
    12251225            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
     
    12401240        }
    12411241
    1242         $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>';
    1243         $display_link = str_replace( array( '%pagename%', '%postname%' ), $post_name_html, $permalink );
     1242        $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . esc_html( $post_name_abridged ) . '</span>';
     1243        $display_link = str_replace( array( '%pagename%', '%postname%' ), $post_name_html, esc_html( $permalink ) );
    12441244
    12451245        $return =  '<strong>' . __( 'Permalink:' ) . "</strong>\n";
     
    12471247        $return .= '&lrm;'; // Fix bi-directional text display defect in RTL languages.
    12481248        $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";
    1249         $return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n";
     1249        $return .= '<span id="editable-post-name-full">' . esc_html( $post_name ) . "</span>\n";
    12501250    }
    12511251
     
    12571257            $return .= "<span id='view-post-btn'><a href='" . esc_url( $preview_link ) . "' class='button button-small' target='wp-preview-{$post->ID}'>$view_post</a></span>\n";
    12581258        } else {
    1259             $return .= "<span id='view-post-btn'><a href='" . get_permalink( $post ) . "' class='button button-small'>$view_post</a></span>\n";
     1259            $return .= "<span id='view-post-btn'><a href='" . esc_url( get_permalink( $post ) ) . "' class='button button-small'>$view_post</a></span>\n";
    12601260        }
    12611261    }
Note: See TracChangeset for help on using the changeset viewer.