<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[28407] trunk/src: Eliminate use of `extract()` in `get_media_item()`.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/28407">28407</a></dd>
<dt>Author</dt> <dd>wonderboymusic</dd>
<dt>Date</dt> <dd>2014-05-15 02:45:01 +0000 (Thu, 15 May 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>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 <a href="http://core.trac.wordpress.org/ticket/22400">#22400</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadminincludesmediaphp">trunk/src/wp-admin/includes/media.php</a></li>
<li><a href="#trunksrcwpincludesbookmarktemplatephp">trunk/src/wp-includes/bookmark-template.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadminincludesmediaphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/includes/media.php (28406 => 28407)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/includes/media.php 2014-05-15 02:27:55 UTC (rev 28406)
+++ trunk/src/wp-admin/includes/media.php 2014-05-15 02:45:01 UTC (rev 28407)
</span><span class="lines">@@ -1285,7 +1285,13 @@
</span><span class="cx"> $post = get_post( $attachment_id );
</span><span class="cx"> $current_post_id = !empty( $_GET['post_id'] ) ? (int) $_GET['post_id'] : 0;
</span><span class="cx">
</span><del>- $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 );
</del><ins>+ $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
+ );
</ins><span class="cx"> $args = wp_parse_args( $args, $default_args );
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -1297,8 +1303,7 @@
</span><span class="cx"> *
</span><span class="cx"> * @param array $args An array of arguments.
</span><span class="cx"> */
</span><del>- $args = apply_filters( 'get_media_item_args', $args );
- extract( $args, EXTR_SKIP );
</del><ins>+ $r = apply_filters( 'get_media_item_args', $args );
</ins><span class="cx">
</span><span class="cx"> $toggle_on = __( 'Show' );
</span><span class="cx"> $toggle_off = __( 'Hide' );
</span><span class="lines">@@ -1311,10 +1316,10 @@
</span><span class="cx"> $type = array_shift( $keys );
</span><span class="cx"> $type_html = "<input type='hidden' id='type-of-$attachment_id' value='" . esc_attr( $type ) . "' />";
</span><span class="cx">
</span><del>- $form_fields = get_attachment_fields_to_edit( $post, $errors );
</del><ins>+ $form_fields = get_attachment_fields_to_edit( $post, $r['errors'] );
</ins><span class="cx">
</span><del>- if ( $toggle ) {
- $class = empty( $errors ) ? 'startclosed' : 'startopen';
</del><ins>+ if ( $r['toggle'] ) {
+ $class = empty( $r['errors'] ) ? 'startclosed' : 'startopen';
</ins><span class="cx"> $toggle_links = "
</span><span class="cx"> <a class='toggle describe-toggle-on' href='#'>$toggle_on</a>
</span><span class="cx"> <a class='toggle describe-toggle-off' href='#'>$toggle_off</a>";
</span><span class="lines">@@ -1324,7 +1329,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> $display_title = ( !empty( $title ) ) ? $title : $filename; // $title shouldn't ever be empty, but just in case
</span><del>- $display_title = $show_title ? "<div class='filename new'><span class='title'>" . wp_html_excerpt( $display_title, 60, '…' ) . "</span></div>" : '';
</del><ins>+ $display_title = $r['show_title'] ? "<div class='filename new'><span class='title'>" . wp_html_excerpt( $display_title, 60, '…' ) . "</span></div>" : '';
</ins><span class="cx">
</span><span class="cx"> $gallery = ( ( isset( $_REQUEST['tab'] ) && 'gallery' == $_REQUEST['tab'] ) || ( isset( $redir_tab ) && 'gallery' == $redir_tab ) );
</span><span class="cx"> $order = '';
</span><span class="lines">@@ -1398,8 +1403,11 @@
</span><span class="cx"> 'extra_rows' => array(),
</span><span class="cx"> );
</span><span class="cx">
</span><del>- if ( $send )
- $send = get_submit_button( __( 'Insert into Post' ), 'button', "send[$attachment_id]", false );
</del><ins>+ if ( $r['send'] ) {
+ $r['send'] = get_submit_button( __( 'Insert into Post' ), 'button', "send[$attachment_id]", false );
+ }
+
+ $delete = empty( $r['delete'] ) ? '' : $r['delete'];
</ins><span class="cx"> if ( $delete && current_user_can( 'delete_post', $attachment_id ) ) {
</span><span class="cx"> if ( !EMPTY_TRASH_DAYS ) {
</span><span class="cx"> $delete = "<a href='" . wp_nonce_url( "post.php?action=delete&post=$attachment_id", 'delete-post_' . $attachment_id ) . "' id='del[$attachment_id]' class='delete-permanently'>" . __( 'Delete Permanently' ) . '</a>';
</span><span class="lines">@@ -1419,19 +1427,20 @@
</span><span class="cx">
</span><span class="cx"> $thumbnail = '';
</span><span class="cx"> $calling_post_id = 0;
</span><del>- if ( isset( $_GET['post_id'] ) )
</del><ins>+ if ( isset( $_GET['post_id'] ) ) {
</ins><span class="cx"> $calling_post_id = absint( $_GET['post_id'] );
</span><del>- elseif ( isset( $_POST ) && count( $_POST ) ) // Like for async-upload where $_GET['post_id'] isn't set
</del><ins>+ } elseif ( isset( $_POST ) && count( $_POST ) ) {// Like for async-upload where $_GET['post_id'] isn't set
</ins><span class="cx"> $calling_post_id = $post->post_parent;
</span><ins>+ }
</ins><span class="cx"> if ( 'image' == $type && $calling_post_id && current_theme_supports( 'post-thumbnails', get_post_type( $calling_post_id ) )
</span><span class="cx"> && post_type_supports( get_post_type( $calling_post_id ), 'thumbnail' ) && get_post_thumbnail_id( $calling_post_id ) != $attachment_id ) {
</span><span class="cx"> $ajax_nonce = wp_create_nonce( "set_post_thumbnail-$calling_post_id" );
</span><span class="cx"> $thumbnail = "<a class='wp-post-thumbnail' id='wp-post-thumbnail-" . $attachment_id . "' href='#' onclick='WPSetAsThumbnail(\"$attachment_id\", \"$ajax_nonce\");return false;'>" . esc_html__( "Use as featured image" ) . "</a>";
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if ( ( $send || $thumbnail || $delete ) && !isset( $form_fields['buttons'] ) )
- $form_fields['buttons'] = array( 'tr' => "\t\t<tr class='submit'><td></td><td class='savesend'>$send $thumbnail $delete</td></tr>\n" );
-
</del><ins>+ if ( ( $r['send'] || $thumbnail || $delete ) && !isset( $form_fields['buttons'] ) ) {
+ $form_fields['buttons'] = array( 'tr' => "\t\t<tr class='submit'><td></td><td class='savesend'>" . $r['send'] . " $thumbnail $delete</td></tr>\n" );
+ }
</ins><span class="cx"> $hidden_fields = array();
</span><span class="cx">
</span><span class="cx"> foreach ( $form_fields as $id => $field ) {
</span></span></pre></div>
<a id="trunksrcwpincludesbookmarktemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/bookmark-template.php (28406 => 28407)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/bookmark-template.php 2014-05-15 02:27:55 UTC (rev 28406)
+++ trunk/src/wp-includes/bookmark-template.php 2014-05-15 02:45:01 UTC (rev 28407)
</span><span class="lines">@@ -241,7 +241,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if ( $categorize ) {
</del><ins>+ if ( $r['categorize'] ) {
</ins><span class="cx"> // Split the bookmarks into ul's for each category
</span><span class="cx"> foreach ( (array) $cats as $cat ) {
</span><span class="cx"> $params = array_merge( $r, array( 'category' => $cat->term_id ) );
</span></span></pre>
</div>
</div>
</body>
</html>