Make WordPress Core

Changeset 20594


Ignore:
Timestamp:
04/25/2012 08:24:20 PM (12 years ago)
Author:
ryan
Message:

Pass the upload iframe src url as an arg to sprintf to avoid treating octets as
format specifiers. Fixes setting the featured image on blogs containing spaces in the install path. Props rosshanney. fixes #20443

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/post.php

    r20440 r20594  
    11461146        $post_id = $post_ID;
    11471147
    1148     $set_thumbnail_link = '<p class="hide-if-no-js"><a title="' . esc_attr__( 'Set featured image' ) . '" href="' . esc_url( get_upload_iframe_src('image', $post_id) ) . '" id="set-post-thumbnail" class="thickbox">%s</a></p>';
    1149     $content = sprintf($set_thumbnail_link, esc_html__( 'Set featured image' ));
     1148    $upload_iframe_src = esc_url( get_upload_iframe_src('image', $post_id) );
     1149    $set_thumbnail_link = '<p class="hide-if-no-js"><a title="' . esc_attr__( 'Set featured image' ) . '" href="%s" id="set-post-thumbnail" class="thickbox">%s</a></p>';
     1150    $content = sprintf( $set_thumbnail_link, $upload_iframe_src, esc_html__( 'Set featured image' ) );
    11501151
    11511152    if ( $thumbnail_id && get_post( $thumbnail_id ) ) {
     
    11581159        if ( !empty( $thumbnail_html ) ) {
    11591160            $ajax_nonce = wp_create_nonce( "set_post_thumbnail-$post_id" );
    1160             $content = sprintf($set_thumbnail_link, $thumbnail_html);
     1161            $content = sprintf( $set_thumbnail_link, $upload_iframe_src, $thumbnail_html );
    11611162            $content .= '<p class="hide-if-no-js"><a href="#" id="remove-post-thumbnail" onclick="WPRemoveThumbnail(\'' . $ajax_nonce . '\');return false;">' . esc_html__( 'Remove featured image' ) . '</a></p>';
    11621163        }
Note: See TracChangeset for help on using the changeset viewer.