Make WordPress Core

Changeset 28407


Ignore:
Timestamp:
05/15/2014 02:45:01 AM (9 years ago)
Author:
wonderboymusic
Message:

Eliminate use of extract() in get_media_item().

To test, fire open the old media in the console: tb_show('Old Media is Weird', 'media-upload.php?type=image&TB_iframe=true&post_id=0');

See #22400.

Location:
trunk/src
Files:
2 edited

Legend:

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

    r28368 r28407  
    12861286    $current_post_id = !empty( $_GET['post_id'] ) ? (int) $_GET['post_id'] : 0;
    12871287
    1288     $default_args = array( 'errors' => null, 'send' => $current_post_id ? post_type_supports( get_post_type( $current_post_id ), 'editor' ) : true, 'delete' => true, 'toggle' => true, 'show_title' => true );
     1288    $default_args = array(
     1289        'errors' => null,
     1290        'send' => $current_post_id ? post_type_supports( get_post_type( $current_post_id ), 'editor' ) : true,
     1291        'delete' => true,
     1292        'toggle' => true,
     1293        'show_title' => true
     1294    );
    12891295    $args = wp_parse_args( $args, $default_args );
    12901296
     
    12981304     * @param array $args An array of arguments.
    12991305     */
    1300     $args = apply_filters( 'get_media_item_args', $args );
    1301     extract( $args, EXTR_SKIP );
     1306    $r = apply_filters( 'get_media_item_args', $args );
    13021307
    13031308    $toggle_on  = __( 'Show' );
     
    13121317    $type_html = "<input type='hidden' id='type-of-$attachment_id' value='" . esc_attr( $type ) . "' />";
    13131318
    1314     $form_fields = get_attachment_fields_to_edit( $post, $errors );
    1315 
    1316     if ( $toggle ) {
    1317         $class = empty( $errors ) ? 'startclosed' : 'startopen';
     1319    $form_fields = get_attachment_fields_to_edit( $post, $r['errors'] );
     1320
     1321    if ( $r['toggle'] ) {
     1322        $class = empty( $r['errors'] ) ? 'startclosed' : 'startopen';
    13181323        $toggle_links = "
    13191324    <a class='toggle describe-toggle-on' href='#'>$toggle_on</a>
     
    13251330
    13261331    $display_title = ( !empty( $title ) ) ? $title : $filename; // $title shouldn't ever be empty, but just in case
    1327     $display_title = $show_title ? "<div class='filename new'><span class='title'>" . wp_html_excerpt( $display_title, 60, '&hellip;' ) . "</span></div>" : '';
     1332    $display_title = $r['show_title'] ? "<div class='filename new'><span class='title'>" . wp_html_excerpt( $display_title, 60, '&hellip;' ) . "</span></div>" : '';
    13281333
    13291334    $gallery = ( ( isset( $_REQUEST['tab'] ) && 'gallery' == $_REQUEST['tab'] ) || ( isset( $redir_tab ) && 'gallery' == $redir_tab ) );
     
    13991404    );
    14001405
    1401     if ( $send )
    1402         $send = get_submit_button( __( 'Insert into Post' ), 'button', "send[$attachment_id]", false );
     1406    if ( $r['send'] ) {
     1407        $r['send'] = get_submit_button( __( 'Insert into Post' ), 'button', "send[$attachment_id]", false );
     1408    }
     1409
     1410    $delete = empty( $r['delete'] ) ? '' : $r['delete'];
    14031411    if ( $delete && current_user_can( 'delete_post', $attachment_id ) ) {
    14041412        if ( !EMPTY_TRASH_DAYS ) {
     
    14201428    $thumbnail = '';
    14211429    $calling_post_id = 0;
    1422     if ( isset( $_GET['post_id'] ) )
     1430    if ( isset( $_GET['post_id'] ) ) {
    14231431        $calling_post_id = absint( $_GET['post_id'] );
    1424     elseif ( isset( $_POST ) && count( $_POST ) ) // Like for async-upload where $_GET['post_id'] isn't set
     1432    } elseif ( isset( $_POST ) && count( $_POST ) ) {// Like for async-upload where $_GET['post_id'] isn't set
    14251433        $calling_post_id = $post->post_parent;
     1434    }
    14261435    if ( 'image' == $type && $calling_post_id && current_theme_supports( 'post-thumbnails', get_post_type( $calling_post_id ) )
    14271436        && post_type_supports( get_post_type( $calling_post_id ), 'thumbnail' ) && get_post_thumbnail_id( $calling_post_id ) != $attachment_id ) {
     
    14301439    }
    14311440
    1432     if ( ( $send || $thumbnail || $delete ) && !isset( $form_fields['buttons'] ) )
    1433         $form_fields['buttons'] = array( 'tr' => "\t\t<tr class='submit'><td></td><td class='savesend'>$send $thumbnail $delete</td></tr>\n" );
    1434 
     1441    if ( ( $r['send'] || $thumbnail || $delete ) && !isset( $form_fields['buttons'] ) ) {
     1442        $form_fields['buttons'] = array( 'tr' => "\t\t<tr class='submit'><td></td><td class='savesend'>" . $r['send'] . " $thumbnail $delete</td></tr>\n" );
     1443    }
    14351444    $hidden_fields = array();
    14361445
  • trunk/src/wp-includes/bookmark-template.php

    r28405 r28407  
    242242    }
    243243
    244     if ( $categorize ) {
     244    if ( $r['categorize'] ) {
    245245        // Split the bookmarks into ul's for each category
    246246        foreach ( (array) $cats as $cat ) {
Note: See TracChangeset for help on using the changeset viewer.