WordPress.org

Make WordPress Core

Ticket #5911: 5911-3.diff

File 5911-3.diff, 49.9 KB (added by andy, 7 years ago)
  • wp-includes/default-filters.php

     
    125125add_filter('list_cats', 'wptexturize'); 
    126126add_filter('single_post_title', 'wptexturize'); 
    127127 
     128add_filter('wp_sprintf', 'wp_sprintf_l', 10, 2); 
     129 
    128130// RSS filters 
    129131add_filter('the_title_rss', 'strip_tags'); 
    130132add_filter('the_title_rss', 'ent2ncr', 8); 
  • wp-includes/post-template.php

     
    362362// Attachments 
    363363// 
    364364 
    365 function the_attachment_link($id = 0, $fullsize = false, $max_dims = false) { 
    366         echo get_the_attachment_link($id, $fullsize, $max_dims); 
     365function the_attachment_link($id = 0, $fullsize = false, $max_dims = false, $permalink = false) { 
     366        echo get_the_attachment_link($id, $fullsize, $max_dims, $permalink); 
    367367} 
    368368 
    369369function get_the_attachment_link($id = 0, $fullsize = false, $max_dims = false, $permalink = false) { 
  • wp-includes/post.php

     
    23022302 */ 
    23032303function wp_mime_type_icon( $mime = 0 ) { 
    23042304        $post_id = 0; 
    2305         if ( is_numeric($mime) ) { 
    2306                 $mime = (int) $mime; 
    2307                 if ( !$post =& get_post( $mime ) ) 
    2308                         return false; 
    2309                 $post_id = (int) $post->ID; 
    2310                 $mime = $post->post_mime_type; 
    2311         } 
    23122305 
    2313         if ( empty($mime) ) 
    2314                 return false; 
     2306        $icon = wp_cache_get('mime_type_icon'); 
     2307         
     2308        if ( empty($icon) ) { 
     2309                if ( is_numeric($mime) ) { 
     2310                        $mime = (int) $mime; 
     2311                        if ( !$post =& get_post( $mime ) ) 
     2312                                return false; 
     2313                        $post_id = (int) $post->ID; 
     2314                        $mime = $post->post_mime_type; 
     2315                        $ext = preg_replace('/^.+?\.([^.]+)$/', '$1', $post->guid); 
     2316                } 
     2317         
     2318                $types = array(); 
     2319         
     2320                if ( !empty($ext) ) 
     2321                        $types[] = $ext; 
     2322         
     2323                $icon_dir = apply_filters( 'icon_dir', get_template_directory() . '/images' ); 
     2324                $icon_dir_uri = apply_filters( 'icon_dir_uri', get_template_directory_uri() . '/images' ); 
     2325                $image_dir = apply_filters( 'image_dir', ABSPATH . WPINC . '/images' ); 
     2326                $image_dir_uri = apply_filters( 'image_dir', get_option('siteurl') . '/' . WPINC . '/images' ); 
     2327                $dirs = array($icon_dir => $icon_dir_uri, $image_dir => $image_dir_uri); 
     2328         
     2329         
     2330                if ( ! empty($mime) ) { 
     2331                        $types[] = substr($mime, 0, strpos($mime, '/')); 
     2332                        $types[] = substr($mime, strpos($mime, '/') + 1); 
     2333                        $types[] = str_replace('/', '_', $mime); 
     2334                } 
     2335         
     2336                $types[] = 'default'; 
     2337         
     2338                $exts = array('png', 'gif', 'jpg'); 
    23152339 
    2316         $icon_dir = apply_filters( 'icon_dir', get_template_directory() . '/images' ); 
    2317         $icon_dir_uri = apply_filters( 'icon_dir_uri', get_template_directory_uri() . '/images' ); 
    2318  
    2319         $types = array( 
    2320                 substr($mime, 0, strpos($mime, '/')), 
    2321                 substr($mime, strpos($mime, '/') + 1), 
    2322                 str_replace('/', '_', $mime) 
    2323         ); 
    2324  
    2325         $exts = array('jpg', 'gif', 'png'); 
    2326  
    2327         $src = false; 
    2328  
    2329         foreach ( $types as $type ) { 
    2330                 foreach ( $exts as $ext ) { 
    2331                         $src_file = "$icon_dir/$type.$ext"; 
    2332                         if ( file_exists($src_file) ) { 
    2333                                 $src = "$icon_dir_uri/$type.$ext"; 
    2334                                 break 2; 
     2340                foreach ( $types as $type ) { 
     2341                        foreach ( $exts as $ext ) { 
     2342                                foreach ( $dirs as $dir => $uri ) { 
     2343                                        $src_file = "$dir/$type.$ext"; 
     2344                                        if ( file_exists($src_file) ) { 
     2345                                                $icon = "$uri/$type.$ext"; 
     2346                                                break 3; 
     2347                                        } 
     2348                                } 
    23352349                        } 
    23362350                } 
    23372351        } 
    23382352 
    2339         return apply_filters( 'wp_mime_type_icon', $src, $mime, $post_id ); // Last arg is 0 if function pass mime type. 
     2353        return apply_filters( 'wp_mime_type_icon', $icon, $mime, $post_id ); // Last arg is 0 if function pass mime type. 
    23402354} 
    23412355 
    23422356/** 
  • wp-includes/js/swfupload/handlers.js

     
    1 function uploadLoadedMultimedia() { 
    2         jQuery("#html-upload-ui").empty(); 
     1function uploadLoaded() { 
     2        jQuery("#html-upload-ui").remove(); 
     3        jQuery("#flash-upload-ui").show(); 
    34} 
    45 
    56function fileDialogStart() { 
     
    78} 
    89 
    910// progress and success handlers for multimedia multi uploads 
    10 function fileQueuedMultimedia(fileObj) { 
     11function fileQueued(fileObj) { 
    1112        // Create a progress bar containing the filename 
    1213        jQuery('#multimedia-items').append('<div id="multimedia-item-' + fileObj.id + '" class="multimedia-item"><span class="filename original">' + fileObj.name + '</span><div class="progress"><div class="bar"></div></div></div>'); 
    1314 
     
    1516        jQuery('#insert-multimedia').attr('disabled', 'disabled'); 
    1617} 
    1718 
    18 function uploadProgressMultimedia(fileObj, bytesDone, bytesTotal) { 
     19function uploadStart(fileObj) { return true; } 
     20 
     21function uploadProgress(fileObj, bytesDone, bytesTotal) { 
    1922        // Lengthen the progress bar 
    2023        jQuery('#multimedia-item-' + fileObj.id + ' .bar').width(620*bytesDone/bytesTotal); 
    2124} 
    2225 
    23 function uploadSuccessMultimedia(fileObj, serverData) { 
     26function uploadSuccess(fileObj, serverData) { 
    2427        // if async-upload returned an error message, place it in the multimedia item div and return 
    2528        if ( serverData.match('media-upload-error') ) { 
    2629                jQuery('#multimedia-item-' + fileObj.id).html(serverData); 
     
    3437        jQuery('#multimedia-item-' + fileObj.id).append(serverData); 
    3538 
    3639        // Clone the thumbnail as a "pinkynail" -- a tiny image to the left of the filename 
    37         jQuery('#multimedia-item-' + fileObj.id + ' .thumbnail').clone().attr('className', 'pinkynail').prependTo('#multimedia-item-' + fileObj.id); 
     40        jQuery('#multimedia-item-' + fileObj.id + ' .thumbnail').clone().attr('className', 'pinkynail toggle').prependTo('#multimedia-item-' + fileObj.id); 
    3841 
    3942        // Replace the original filename with the new (unique) one assigned during upload 
    4043        jQuery('#multimedia-item-' + fileObj.id + ' .filename.original').replaceWith(jQuery('#multimedia-item-' + fileObj.id + ' .filename.new')); 
     
    4649        jQuery('#multimedia-item-' + fileObj.id + ' a.toggle').bind('click', function(){jQuery(this).siblings('.slidetoggle').slideToggle(150);jQuery(this).parent().eq(0).children('.toggle').toggle();jQuery(this).siblings('a.toggle').focus();return false;}); 
    4750 
    4851        // Bind AJAX to the new Delete button 
    49         jQuery('#multimedia-item-' + fileObj.id + ' a.delete').bind('click',function(){jQuery.ajax({url:'admin-ajax.php',type:'post',data:{id:this.id.replace(/[^0-9]/g,''),action:'delete-post',_ajax_nonce:this.href.replace(/^.*wpnonce=/,'')}});jQuery(this).parents(".multimedia-item").eq(0).slideToggle(300, function(){jQuery(this).remove();});return false;}); 
     52        jQuery('#multimedia-item-' + fileObj.id + ' a.delete').bind('click',function(){jQuery.ajax({url:'admin-ajax.php',type:'post',data:{id:this.id.replace(/[^0-9]/g,''),action:'delete-post',_ajax_nonce:this.href.replace(/^.*wpnonce=/,'')}});jQuery(this).parents(".multimedia-item").eq(0).slideToggle(300, function(){jQuery(this).remove();if(jQuery('.multimedia-item').length==0)jQuery('.insert-gallery').hide();});return false;}); 
    5053 
    5154        // Open this item if it says to start open 
    5255        jQuery('#multimedia-item-' + fileObj.id + ' .startopen') 
    5356                .removeClass('startopen') 
    5457                .slideToggle(500) 
    5558                .parent().eq(0).children('.toggle').toggle(); 
     59 
     60        jQuery('.insert-gallery').show(); 
    5661} 
    5762 
    58 function uploadCompleteMultimedia(fileObj) { 
     63function uploadComplete(fileObj) { 
    5964        // If no more uploads queued, enable the submit button 
    6065        if ( swfu.getStats().files_queued == 0 ) 
    6166                jQuery('#insert-multimedia').attr('disabled', ''); 
    6267} 
    6368 
    6469 
    65 // progress and success handlers for single image upload 
    66  
    67 function uploadLoadedImage() { 
    68         jQuery('#image-alt').attr('disabled', true); 
    69         jQuery('#image-url').attr('disabled', true); 
    70         jQuery('#image-title').attr('disabled', true); 
    71         jQuery('#image-add').attr('disabled', true); 
    72 } 
    73  
    74 function fileQueuedImage(fileObj) { 
    75         jQuery('#flash-upload-ui').append('<div id="image-progress"><p class="filename">' + fileObj.name + '</p><div class="progress"><div class="bar"></div></div></div>'); 
    76 } 
    77  
    78 function uploadProgressImage(fileObj, bytesDone, bytesTotal) { 
    79         jQuery('#image-progress .bar').width(450*bytesDone/bytesTotal); 
    80 } 
    81  
    82 function uploadSuccessImage(fileObj, serverData) { 
    83         if ( serverData.match('media-upload-error') ) { 
    84                 jQuery('#media-upload-error').replaceWith(serverData); 
    85                 jQuery('#image-progress').replaceWith(''); 
    86         } 
    87         else { 
    88                 jQuery('#media-upload-error').replaceWith(''); 
    89                 jQuery('#flash-upload-ui').replaceWith(serverData); 
    90         } 
    91 } 
    92  
    9370// wp-specific error handlers 
    9471 
    9572// generic message 
     
    12198        } 
    12299} 
    123100 
    124 function fileQueued(fileObj) { 
    125         try { 
    126                 var txtFileName = document.getElementById("txtFileName"); 
    127                 txtFileName.value = fileObj.name; 
    128         } catch (e) { } 
    129  
    130 } 
    131  
    132101function fileDialogComplete(num_files_queued) { 
    133102        try { 
    134103                if (num_files_queued > 0) { 
     
    139108        } 
    140109} 
    141110 
    142 function uploadProgress(fileObj, bytesLoaded, bytesTotal) { 
    143  
    144         try { 
    145                 var percent = Math.ceil((bytesLoaded / bytesTotal) * 100) 
    146  
    147                 fileObj.id = "singlefile";      // This makes it so FileProgress only makes a single UI element, instead of one for each file 
    148                 var progress = new FileProgress(fileObj, this.customSettings.progress_target); 
    149                 progress.SetProgress(percent); 
    150                 progress.SetStatus("Uploading..."); 
    151         } catch (e) { } 
    152 } 
    153  
    154 function uploadSuccess(fileObj, server_data) { 
    155         try { 
    156                 fileObj.id = "singlefile";      // This makes it so FileProgress only makes a single UI element, instead of one for each file 
    157                 var progress = new FileProgress(fileObj, this.customSettings.progress_target); 
    158                 progress.SetComplete(); 
    159                 progress.SetStatus("Complete."); 
    160                 progress.ToggleCancel(false); 
    161                  
    162                 if (server_data === " ") { 
    163                         this.customSettings.upload_successful = false; 
    164                 } else { 
    165                         this.customSettings.upload_successful = true; 
    166                         document.getElementById("hidFileID").value = server_data; 
    167                 } 
    168                  
    169         } catch (e) { } 
    170 } 
    171  
    172 function uploadComplete(fileObj) { 
    173         try { 
    174                 if (this.customSettings.upload_successful) { 
    175                         document.getElementById("btnBrowse").disabled = "true"; 
    176                         uploadDone(); 
    177                 } else { 
    178                         fileObj.id = "singlefile";      // This makes it so FileProgress only makes a single UI element, instead of one for each file 
    179                         var progress = new FileProgress(fileObj, this.customSettings.progress_target); 
    180                         progress.SetError(); 
    181                         progress.SetStatus("File rejected"); 
    182                         progress.ToggleCancel(false); 
    183                          
    184                         var txtFileName = document.getElementById("txtFileName"); 
    185                         txtFileName.value = ""; 
    186                         //validateForm(); 
    187  
    188                         alert("There was a problem with the upload.\nThe server did not accept it."); 
    189                 } 
    190         } catch (e) {  } 
    191 } 
    192  
    193111function uploadError(fileObj, error_code, message) { 
    194                  
    195                 // first the file specific error 
    196                 if ( error_code == SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL ) { 
    197                         wpFileError(fileObj, swfuploadL10n.missing_upload_url); 
    198                 } 
    199                 else if ( error_code == SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED ) { 
    200                         wpFileError(fileObj, swfuploadL10n.upload_limit_exceeded); 
    201                 } 
    202                 else { 
    203                         wpFileError(fileObj, swfuploadL10n.default_error); 
    204                 } 
    205                  
    206                 // not sure if this is needed 
    207                 fileObj.id = "singlefile";      // This makes it so FileProgress only makes a single UI element, instead of one for each file 
    208                 var progress = new FileProgress(fileObj, this.customSettings.progress_target); 
    209                 progress.SetError(); 
    210                 progress.ToggleCancel(false); 
     112alert(message);return; 
     113        // first the file specific error 
     114        if ( error_code == SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL ) { 
     115                wpFileError(fileObj, swfuploadL10n.missing_upload_url); 
     116        } 
     117        else if ( error_code == SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED ) { 
     118                wpFileError(fileObj, swfuploadL10n.upload_limit_exceeded); 
     119        } 
     120        else { 
     121                wpFileError(fileObj, swfuploadL10n.default_error); 
     122        } 
    211123 
    212                 // now the general upload status 
    213                 if ( error_code == SWFUpload.UPLOAD_ERROR.HTTP_ERROR ) { 
    214                         wpQueueError(swfuploadL10n.http_error); 
    215                 } 
    216                 else if ( error_code == SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED ) { 
    217                         wpQueueError(swfuploadL10n.upload_failed); 
    218                 } 
    219                 else if ( error_code == SWFUpload.UPLOAD_ERROR.IO_ERROR ) { 
    220                         wpQueueError(swfuploadL10n.io_error); 
    221                 } 
    222                 else if ( error_code == SWFUpload.UPLOAD_ERROR.SECURITY_ERROR ) { 
    223                         wpQueueError(swfuploadL10n.security_error); 
    224                 } 
    225                 else if ( error_code == SWFUpload.UPLOAD_ERROR.FILE_CANCELLED ) { 
    226                         wpQueueError(swfuploadL10n.security_error); 
    227                 } 
     124        // now the general upload status 
     125        if ( error_code == SWFUpload.UPLOAD_ERROR.HTTP_ERROR ) { 
     126                wpQueueError(swfuploadL10n.http_error); 
     127        } 
     128        else if ( error_code == SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED ) { 
     129                wpQueueError(swfuploadL10n.upload_failed); 
     130        } 
     131        else if ( error_code == SWFUpload.UPLOAD_ERROR.IO_ERROR ) { 
     132                wpQueueError(swfuploadL10n.io_error); 
     133        } 
     134        else if ( error_code == SWFUpload.UPLOAD_ERROR.SECURITY_ERROR ) { 
     135                wpQueueError(swfuploadL10n.security_error); 
     136        } 
     137        else if ( error_code == SWFUpload.UPLOAD_ERROR.FILE_CANCELLED ) { 
     138                wpQueueError(swfuploadL10n.security_error); 
     139        } 
    228140} 
    229  
    230  
    231 /* ******************************************************** 
    232  *  Utility for displaying the file upload information 
    233  *  This is not part of SWFUpload, just part of the demo 
    234  * ******************************************************** */ 
    235 function FileProgress(fileObj, target_id) { 
    236                 this.file_progress_id = fileObj.id; 
    237  
    238                 this.fileProgressElement = document.getElementById(this.file_progress_id); 
    239                 if (!this.fileProgressElement) { 
    240                         this.fileProgressElement = document.createElement("div"); 
    241                         this.fileProgressElement.className = "progressContainer"; 
    242                         this.fileProgressElement.id = this.file_progress_id; 
    243  
    244                         var progressCancel = document.createElement("a"); 
    245                         progressCancel.className = "progressCancel"; 
    246                         progressCancel.href = "#"; 
    247                         progressCancel.style.visibility = "hidden"; 
    248                         progressCancel.appendChild(document.createTextNode(" ")); 
    249  
    250                         var progressText = document.createElement("div"); 
    251                         progressText.className = "progressName"; 
    252                         progressText.appendChild(document.createTextNode(fileObj.name)); 
    253  
    254                         var progressBar = document.createElement("div"); 
    255                         progressBar.className = "progressBarInProgress"; 
    256  
    257                         var progressStatus = document.createElement("div"); 
    258                         progressStatus.className = "progressBarStatus"; 
    259                         progressStatus.innerHTML = "&nbsp;"; 
    260  
    261                         this.fileProgressElement.appendChild(progressCancel); 
    262                         this.fileProgressElement.appendChild(progressText); 
    263                         this.fileProgressElement.appendChild(progressStatus); 
    264                         this.fileProgressElement.appendChild(progressBar); 
    265  
    266                         document.getElementById(target_id).appendChild(this.fileProgressElement); 
    267  
    268                 } 
    269  
    270 } 
    271 FileProgress.prototype.SetStart = function() { 
    272                 this.fileProgressElement.className = "progressContainer"; 
    273                 this.fileProgressElement.childNodes[3].className = "progressBarInProgress"; 
    274                 this.fileProgressElement.childNodes[3].style.width = ""; 
    275 } 
    276  
    277 FileProgress.prototype.SetProgress = function(percentage) { 
    278                 this.fileProgressElement.className = "progressContainer green"; 
    279                 this.fileProgressElement.childNodes[3].className = "progressBarInProgress"; 
    280                 this.fileProgressElement.childNodes[3].style.width = percentage + "%"; 
    281 } 
    282 FileProgress.prototype.SetComplete = function() { 
    283                 this.fileProgressElement.className = "progressContainer blue"; 
    284                 this.fileProgressElement.childNodes[3].className = "progressBarComplete"; 
    285                 this.fileProgressElement.childNodes[3].style.width = ""; 
    286  
    287  
    288 } 
    289 FileProgress.prototype.SetError = function() { 
    290                 this.fileProgressElement.className = "progressContainer red"; 
    291                 this.fileProgressElement.childNodes[3].className = "progressBarError"; 
    292                 this.fileProgressElement.childNodes[3].style.width = ""; 
    293 } 
    294 FileProgress.prototype.SetCancelled = function() { 
    295                 this.fileProgressElement.className = "progressContainer"; 
    296                 this.fileProgressElement.childNodes[3].className = "progressBarError"; 
    297                 this.fileProgressElement.childNodes[3].style.width = ""; 
    298 } 
    299 FileProgress.prototype.SetStatus = function(status) { 
    300                 this.fileProgressElement.childNodes[2].innerHTML = status; 
    301 } 
    302  
    303 FileProgress.prototype.ToggleCancel = function(show, upload_obj) { 
    304                 this.fileProgressElement.childNodes[0].style.visibility = show ? "visible" : "hidden"; 
    305                 if (upload_obj) { 
    306                         var file_id = this.file_progress_id; 
    307                         this.fileProgressElement.childNodes[0].onclick = function() { upload_obj.cancelUpload(file_id); return false; }; 
    308                 } 
    309 } 
  • wp-includes/media.php

     
    8585        list( $img_src, $width, $height ) = image_downsize($id, $size); 
    8686        $hwstring = image_hwstring($width, $height); 
    8787 
    88         $html = '<img src="'.attribute_escape($img_src).'" alt="'.attribute_escape($alt).'" title="'.attribute_escape($title).'"'.$hwstring.' class="align-'.attribute_escape($align).' size-'.attribute_escape($size).' attachment wp-att-'.attribute_escape($id).'" />'; 
     88        $html = '<img src="'.attribute_escape($img_src).'" alt="'.attribute_escape($alt).'" title="'.attribute_escape($title).'" '.$hwstring.'class="align-'.attribute_escape($align).' size-'.attribute_escape($size).' attachment wp-att-'.attribute_escape($id).'" />'; 
    8989 
    9090        $html = apply_filters( 'image_send_to_editor', $html, $id, $alt, $title, $align, $url ); 
    9191 
  • wp-includes/formatting.php

     
    12771277        return $matches[0]; 
    12781278} 
    12791279 
     1280/** 
     1281 * wp_sprintf() - sprintf() with filters 
     1282 */ 
     1283function wp_sprintf( $pattern ) { 
     1284        $args = func_get_args( ); 
     1285        $len = strlen($pattern); 
     1286        $start = 0; 
     1287        $result = ''; 
     1288        $arg_index = 0; 
     1289        while ( $len > $start ) { 
     1290                // Last character: append and break 
     1291                if ( strlen($pattern) - 1 == $start ) { 
     1292                        $result .= substr($pattern, -1); 
     1293                        break; 
     1294                } 
     1295 
     1296                // Literal %: append and continue 
     1297                if ( substr($pattern, $start, 2) == '%%' ) { 
     1298                        $start += 2; 
     1299                        $result .= '%'; 
     1300                        continue; 
     1301                } 
     1302 
     1303                // Get fragment before next % 
     1304                $end = strpos($pattern, '%', $start + 1); 
     1305                if ( false === $end ) 
     1306                        $end = $len; 
     1307                $fragment = substr($pattern, $start, $end - $start); 
     1308 
     1309                // Fragment has a specifier 
     1310                if ( $pattern{$start} == '%' ) { 
     1311                        // Find numbered arguments or take the next one in order 
     1312                        if ( preg_match('/^%(\d+)\$/', $fragment, $matches) ) { 
     1313                                $arg = isset($args[$matches[1]]) ? $args[$matches[1]] : ''; 
     1314                                $fragment = str_replace("%{$matches[1]}$", '%', $fragment); 
     1315                        } else { 
     1316                                ++$arg_index; 
     1317                                $arg = isset($args[$arg_index]) ? $args[$arg_index] : ''; 
     1318                        } 
     1319 
     1320                        // Apply filters OR sprintf 
     1321                        $_fragment = apply_filters( 'wp_sprintf', $fragment, $arg ); 
     1322                        if ( $_fragment != $fragment ) 
     1323                                $fragment = $_fragment; 
     1324                        else 
     1325                                $fragment = sprintf($fragment, strval($arg) ); 
     1326                } 
     1327 
     1328                // Append to result and move to next fragment 
     1329                $result .= $fragment; 
     1330                $start = $end; 
     1331        } 
     1332        return $result; 
     1333} 
     1334 
     1335/** 
     1336 * wp_sprintf_l - List specifier %l for wp_sprintf 
     1337 * 
     1338 * @param unknown_type $pattern 
     1339 * @param unknown_type $args 
     1340 * @return unknown 
     1341 */ 
     1342function wp_sprintf_l($pattern, $args) { 
     1343        // Not a match 
     1344        if ( substr($pattern, 0, 2) != '%l' ) 
     1345                return $pattern; 
     1346 
     1347        // Nothing to work with 
     1348        if ( empty($args) ) 
     1349                return ''; 
     1350 
     1351        // Translate and filter the delimiter set (avoid ampersands and entities here) 
     1352        $l = apply_filters('wp_sprintf_l', array( 
     1353                'between'          => _c(', |between list items'), 
     1354                'between_last_two' => _c(', and |between last two list items'), 
     1355                'between_only_two' => _c(' and |between only two list items'), 
     1356                )); 
     1357 
     1358        $args = (array) $args; 
     1359        $result = array_shift($args); 
     1360        if ( count($args) == 1 ) 
     1361                $result .= $l['between_two'] . array_shift($args); 
     1362        // Loop when more than two args 
     1363        while ( count($args) ) { 
     1364                $arg = array_shift($args); 
     1365                if ( $i == 1 ) 
     1366                        $result .= $l['between_last_two'] . $arg; 
     1367                else 
     1368                        $result .= $l['between'] . $arg; 
     1369        } 
     1370        return $result . substr($pattern, 2); 
     1371} 
     1372 
    12801373?> 
  • wp-includes/general-template.php

    Cannot display: file marked as a binary type.
    svn:mime-type = application/octet-stream
    
    Property changes on: wp-includes/images/swf.png
    ___________________________________________________________________
    Name: svn:mime-type
       + application/octet-stream
    
    Cannot display: file marked as a binary type.
    svn:mime-type = application/octet-stream
    
    Property changes on: wp-includes/images/audio.png
    ___________________________________________________________________
    Name: svn:mime-type
       + application/octet-stream
    
    Cannot display: file marked as a binary type.
    svn:mime-type = application/octet-stream
    
    Property changes on: wp-includes/images/zip.png
    ___________________________________________________________________
    Name: svn:mime-type
       + application/octet-stream
    
    Cannot display: file marked as a binary type.
    svn:mime-type = application/octet-stream
    
    Property changes on: wp-includes/images/html.png
    ___________________________________________________________________
    Name: svn:mime-type
       + application/octet-stream
    
    Cannot display: file marked as a binary type.
    svn:mime-type = application/octet-stream
    
    Property changes on: wp-includes/images/doc.png
    ___________________________________________________________________
    Name: svn:mime-type
       + application/octet-stream
    
    Cannot display: file marked as a binary type.
    svn:mime-type = application/octet-stream
    
    Property changes on: wp-includes/images/video.png
    ___________________________________________________________________
    Name: svn:mime-type
       + application/octet-stream
    
    Cannot display: file marked as a binary type.
    svn:mime-type = application/octet-stream
    
    Property changes on: wp-includes/images/pdf.png
    ___________________________________________________________________
    Name: svn:mime-type
       + application/octet-stream
    
    Cannot display: file marked as a binary type.
    svn:mime-type = application/octet-stream
    
    Property changes on: wp-includes/images/js.png
    ___________________________________________________________________
    Name: svn:mime-type
       + application/octet-stream
    
    Cannot display: file marked as a binary type.
    svn:mime-type = application/octet-stream
    
    Property changes on: wp-includes/images/exe.png
    ___________________________________________________________________
    Name: svn:mime-type
       + application/octet-stream
    
    Cannot display: file marked as a binary type.
    svn:mime-type = application/octet-stream
    
    Property changes on: wp-includes/images/text.png
    ___________________________________________________________________
    Name: svn:mime-type
       + application/octet-stream
    
    Cannot display: file marked as a binary type.
    svn:mime-type = application/octet-stream
    
    Property changes on: wp-includes/images/default.png
    ___________________________________________________________________
    Name: svn:mime-type
       + application/octet-stream
    
    Cannot display: file marked as a binary type.
    svn:mime-type = application/octet-stream
    
    Property changes on: wp-includes/images/tar.png
    ___________________________________________________________________
    Name: svn:mime-type
       + application/octet-stream
    
    Cannot display: file marked as a binary type.
    svn:mime-type = application/octet-stream
    
    Property changes on: wp-includes/images/css.png
    ___________________________________________________________________
    Name: svn:mime-type
       + application/octet-stream
    
     
    941941         
    942942        if ( $media_buttons ) { ?> 
    943943                <div id="media-buttons"> 
    944                 <?php _e('Add media:'); ?> 
    945                 <?php do_action( 'media_buttons'); ?> 
     944                <?php do_action( 'media_buttons' ); ?> 
    946945                </div> 
    947946        <?php } ?> 
    948947        </div> 
  • wp-includes/script-loader.php

     
    9494                $this->add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', false, '2.0.2'); 
    9595                $this->add( 'swfupload-degrade', '/wp-includes/js/swfupload/plugins/swfupload.graceful_degradation.js', array('swfupload'), '2.0.2'); 
    9696                $this->add( 'swfupload-queue', '/wp-includes/js/swfupload/plugins/swfupload.queue.js', array('swfupload'), '2.0.2'); 
    97                 $this->add( 'swfupload-handlers', '/wp-includes/js/swfupload/handlers.js', array('swfupload'), '2.0.2-20080216'); 
     97                $this->add( 'swfupload-handlers', '/wp-includes/js/swfupload/handlers.js', array('swfupload'), '2.0.2-20080220'); 
    9898                // these error messages came from the sample swfupload js, they might need changing. 
    9999                $this->localize( 'swfupload-handlers', 'swfuploadL10n', array( 
    100100                                'queue_limit_exceeded' => 'You have attempted to queue too many files.', 
  • wp-admin/includes/media.php

     
    3535        } 
    3636} 
    3737 
    38 function image_upload_callback() { 
    39         $tabs = image_upload_tabs(); 
    40         if ( isset($_GET['tab']) && array_key_exists($_GET['tab'], $tabs) && is_callable($_GET['tab']) ) 
    41                 return $_GET['tab'](); 
    42         elseif ( is_callable($first = array_shift(array_keys($tabs))) ) 
    43                 return $first(); 
    44         else 
    45                 return image_upload_handler(); 
    46 } 
    47  
    48 add_action('media_upload_image', 'image_upload_callback'); 
    49  
    50 function image_upload_form( $action_url, $values = array(), $error = null ) { 
    51         $action_url = attribute_escape( $action_url ); 
    52         $image_alt = attribute_escape( @$values['image-alt'] ); 
    53         $image_url = attribute_escape( @$values['image-url'] ); 
    54         $image_title = attribute_escape( @$values['image-title'] ); 
    55         $image_align = @$values['image-url']; 
    56         $post_id = $_GET['post_id']; 
    57  
    58 ?> 
    59 <div id="media-upload-header"> 
    60 <h3><?php _e('Add Image') ?></h3> 
    61 <?php the_image_upload_tabs(); ?> 
    62 </div> 
    63 <div id="media-upload-error"> 
    64 <?php if ($error) { 
    65         echo $error->get_error_message(); 
    66 } ?> 
    67 </div> 
    68 <script type="text/javascript"> 
    69 <!-- 
    70  
    71 jQuery(document).ready(function(){ 
    72         var swfu = new SWFUpload({ 
    73                         upload_url : "<?php echo get_option('siteurl').'/wp-admin/async-upload.php'; ?>", 
    74                         flash_url : "<?php echo get_option('siteurl').'/wp-includes/js/swfupload/swfupload_f9.swf'; ?>", 
    75                         file_post_name: "async-upload", 
    76                         swfupload_element_id : "flash-upload-ui", // id of the element displayed when swfupload is available 
    77                         degraded_element_id : "html-upload-ui",   // when swfupload is unavailable 
    78                         //file_types : "*.jpg;*.gif;*.png", 
    79                         file_size_limit : "<?php echo wp_max_upload_size(); ?> B", 
    80                         post_params : { 
    81                                 "post_id" : "<?php echo $post_id; ?>", 
    82                                 "auth_cookie" : "<?php echo $_COOKIE[AUTH_COOKIE]; ?>", 
    83                                 "type" : "image", 
    84                         }, 
    85                         swfupload_loaded_handler : uploadLoadedImage, 
    86                         upload_progress_handler : uploadProgressImage, 
    87                         upload_success_handler : uploadSuccessImage, 
    88                         upload_error_handler: uploadError, 
    89                         file_queued_handler : fileQueuedImage, 
    90                         file_queue_error_handler : fileQueueError, 
    91                         file_dialog_complete_handler : fileDialogComplete, 
    92  
    93                         custom_settings : { 
    94                                 progressTarget : "flash-upload-ui", 
    95                                 cancelButtonId : "btnCancel2" 
    96                         }, 
    97  
    98                         debug: false, 
    99  
    100                 }); 
    101  
    102         document.getElementById("flash-browse-button").onclick = function () { swfu.selectFile(); }; 
    103 }); 
    104 //--> 
    105 </script> 
    106 <form enctype="multipart/form-data" method="post" action="<?php echo attribute_escape($action_url); ?>" id="image-upload" class="media-upload-form"> 
    107 <p id="flash-upload-ui"> 
    108         <label for="flash-browse-button"><?php _e('Choose image'); ?></label> 
    109         <input id="flash-browse-button" type="button" value="<?php _e('Browse'); ?>" /> 
    110         <label for="image-file" class="form-help"><?php _e('Only PNG, JPG, GIF'); ?></label></p> 
    111 <p id="html-upload-ui"><label for="image-file"><?php _e('Choose image'); ?></label> 
    112         <input type="file" name="image-file" id="image-file" /> 
    113         <label for="image-file" class="form-help"><?php _e('Only PNG, JPG, GIF'); ?></label></p> 
    114 <p><label for="image-alt" class="required"><?php _e('&lt;alt&gt; (required)'); ?></label> 
    115         <input type="text" name="image-alt" id="image-alt" /> 
    116         <label for="image-alt" class="form-help"><?php _e('e.g., The Mona Lisa'); ?></label></p> 
    117 <p><label for="image-url"><?php _e('URL'); ?></label> 
    118         <input type="text" name="image-url" id="image-url" /> 
    119         <label for="image-url" class="form-help"><?php _e('e.g., http://www.wordpress.org/'); ?></label></p> 
    120 <p><label for="image-title"><?php _e('&lt;title&gt;'); ?></label> 
    121         <input type="text" name="image-title" id="image-title" /> 
    122         <label for="image-url" class="form-help"><?php _e('e.g., The Mona Lisa, one of many paintings in the Louvre'); ?></label></p> 
    123 <fieldset id="image-align"> 
    124         <legend><?php _e('Alignment'); ?></legend> 
    125         <input type="radio" name="image-align" id="image-align-none" value="none" <?php if ($image_align == 'none' || !$image_align) echo ' checked="checked"'; ?>/> 
    126         <label for="image-align-none" id="image-align-none-label"><?php _e('None'); ?></label> 
    127         <input type="radio" name="image-align" id="image-align-left" value="left" <?php if ($image_align == 'left') echo ' checked="checked"'; ?>/> 
    128         <label for="image-align-left" id="image-align-left-label"><?php _e('Left'); ?></label> 
    129         <input type="radio" name="image-align" id="image-align-center" value="center"  <?php if ($image_align == 'center') echo ' checked="checked"'; ?>/> 
    130         <label for="image-align-center" id="image-align-center-label"><?php _e('Center'); ?></label> 
    131         <input type="radio" name="image-align" id="image-align-right" value="right"  <?php if ($image_align == 'right') echo ' checked="checked"'; ?>/> 
    132         <label for="image-align-right" id="image-align-right-label"><?php _e('Right'); ?></label> 
    133 </fieldset> 
    134 <fieldset id="image-size"> 
    135         <legend><?php _e('Size'); ?></legend> 
    136         <input type="radio" name="image-size" id="image-size-thumb" value="thumb" <?php if ($image_size == 'thumb') echo ' checked="checked"'; ?>/> 
    137         <label for="image-size-thumb" id="image-size-thumb-label"><?php _e('Thumbnail'); ?></label> 
    138         <input type="radio" name="image-size" id="image-size-medium" value="medium" <?php if ($image_size == 'medium' || !$image_size) echo ' checked="checked"'; ?>/> 
    139         <label for="image-size-medium" id="image-size-medium-label"><?php _e('Medium'); ?></label> 
    140         <input type="radio" name="image-size" id="image-size-full" value="full" <?php if ($image_size == 'full') echo ' checked="checked"'; ?>/> 
    141         <label for="image-size-full" id="image-size-full-label"><?php _e('Full size'); ?></label> 
    142 </fieldset> 
    143 <p> 
    144         <button name="image-add" id="image-add" class="button-ok" value="1"><?php _e('Add Image'); ?></button> 
    145         <a href="#" onClick="return top.tb_remove();" id="image-cancel" class="button-cancel"><?php _e('Cancel'); ?></a> 
    146 </p> 
    147         <input type="hidden" name="post_id" value="<?php echo attribute_escape($post_id); ?>" /> 
    148         <?php wp_nonce_field( 'inlineuploading' ); ?> 
    149 </form> 
    150 <?php 
    151 } 
    152  
    153 function image_upload_handler() { 
    154  
    155         if ( !current_user_can('upload_files') ) { 
    156                 return new wp_error( 'upload_not_allowed', __('You are not allowed to upload files.') ); 
    157         } 
    158  
    159         if ( empty($_POST['image-add']) ) { 
    160                 // no button click, we're just displaying the form 
    161                 wp_iframe( 'image_upload_form', get_option('siteurl') . '/wp-admin/media-upload.php?type=image' ); 
    162         } 
    163         else { 
    164                 // Add Image button was clicked 
    165                 check_admin_referer('inlineuploading'); 
    166  
    167                 // if the async flash uploader was used, the attachment has already been inserted and its ID is passed in post. 
    168                 // otherwise this is a regular form post and we still have to handle the upload and create the attachment. 
    169                 if ( !empty($_POST['attachment_id']) ) { 
    170                         $id = intval($_POST['attachment_id']); 
    171                         // store the title and alt into the attachment post 
    172                         wp_update_post(array( 
    173                                 'ID' => $id, 
    174                                 'post_title' => $_POST['image-title'], 
    175                                 'post_content' => $_POST['image-alt'], 
    176                         )); 
    177                 } 
    178                 else { 
    179                         $id = image_upload_post(); 
    180                 } 
    181  
    182                 // if the input was invalid, redisplay the form with its current values 
    183                 if ( is_wp_error($id) ) 
    184                         wp_iframe( 'image_upload_form', get_option('siteurl') . '/wp-admin/media-upload.php?type=image', $_POST, $id ); 
    185                 else { 
    186                         media_send_to_editor(get_image_send_to_editor($id, $_POST['image-alt'], $_POST['image-title'], $_POST['image-align'], $_POST['image-url'], true, $_POST['image-size'])); 
    187                 } 
    188         } 
    189 } 
    190  
    191 // this returns html to include in the single image upload form when the async flash upload has finished 
    192 // i.e. show a thumb of the image, and include the attachment id as a hidden input 
    193 function async_image_callback($id) { 
    194         $thumb_url = wp_get_attachment_thumb_url($id); 
    195         if ( empty($thumb_url) ) 
    196                 $thumb_url = wp_mime_type_icon($id); 
    197  
    198         if ($thumb_url) { 
    199                 $out = '<p><input type="hidden" name="attachment_id" id="attachment_id" value="'.intval($id).'" />' 
    200                         . '<img src="'.wp_get_attachment_thumb_url($id).'" class="pinkynail" /> ' 
    201                         . basename(wp_get_attachment_url($id)).'</p>'; 
    202         } 
    203         else { 
    204                 $out = '<p><input type="hidden" name="attachment_id" id="attachment_id" value="'.intval($id).'" />' 
    205                         . basename(wp_get_attachment_url($id)).'</p>'; 
    206         } 
    207  
    208         $post = get_post($id); 
    209         $title = addslashes($post->post_title); 
    210         $alt = addslashes($post->post_content); 
    211  
    212         // populate the input fields with post data (which in turn comes from exif/iptc) 
    213         $out .= <<<EOF 
    214 <script type="text/javascript"> 
    215 <!-- 
    216 jQuery('#image-alt').val('{$alt}').attr('disabled', false); 
    217 jQuery('#image-title').val('{$title}').attr('disabled', false); 
    218 jQuery('#image-url').attr('disabled', false); 
    219 jQuery('#image-add').attr('disabled', false); 
    220 --> 
    221 </script> 
    222 EOF; 
    223  
    224         return $out; 
    225 } 
    226  
    227 add_filter('async_upload_image', 'async_image_callback'); 
    228  
    229  
    23038function get_image_send_to_editor($id, $alt, $title, $align, $url='', $rel = false, $size='medium') { 
    23139 
    23240        $html = get_image_tag($id, $alt, $title, $align, $rel, $size); 
     
    25462        exit; 
    25563} 
    25664 
    257 // this handles the file upload POST itself, validating input and inserting the file if it's valid 
    258 function image_upload_post() { 
    259         if ( empty($_FILES['image-file']['name']) ) 
    260                 return new wp_error( 'image_file_required', __('Please choose an image file to upload') ); 
    261         if ( empty($_POST['image-alt']) ) 
    262                 return new wp_error( 'image_alt_required', __('Please enter an &lt;alt&gt; description') ); 
    263  
    264         $overrides = array('test_form'=>false); 
    265         $file = wp_handle_upload($_FILES['image-file'], $overrides); 
    266  
    267         if ( isset($file['error']) ) 
    268                 return new wp_error( 'upload_error', $file['error'] ); 
    269  
    270         $url = $file['url']; 
    271         $type = $file['type']; 
    272         $file = $file['file']; 
    273  
    274         $post_title = trim($_POST['image-title']); 
    275         $post_content = trim($_POST['image-alt']); 
    276         $post_parent = intval($_POST['parent_post_id']); 
    277  
    278         // Construct the attachment array 
    279         $attachment = array( 
    280                 'post_title' => $post_title, 
    281                 'post_content' => $post_content, 
    282                 'post_type' => 'attachment', 
    283                 'post_parent' => $post_parent, 
    284                 'post_mime_type' => $type, 
    285                 'guid' => $url 
    286         ); 
    287  
    288         // Save the data 
    289         $id = wp_insert_attachment($attachment, $file, $post_parent); 
    290         if ( !is_wp_error($id) ) 
    291                 wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) ); 
    292  
    293         return $id; 
    294 } 
    295  
    29665// this handles the file upload POST itself, creating the attachment post 
    29766function media_handle_upload($file_id, $post_id, $post_data = array()) { 
    29867        $overrides = array('test_form'=>false); 
     
    371140<?php 
    372141} 
    373142 
    374 function media_buttons() { // just a placeholder for now 
     143function media_buttons() { 
    375144        global $post_ID, $temp_ID; 
    376145        $uploading_iframe_ID = (int) (0 == $post_ID ? $temp_ID : $post_ID); 
    377         $image_upload_iframe_src = wp_nonce_url("media-upload.php?type=image&amp;post_id=$uploading_iframe_ID", 'inlineuploading'); 
    378         $image_upload_iframe_src = apply_filters('image_upload_iframe_src', $image_upload_iframe_src); 
    379         $multimedia_upload_iframe_src = wp_nonce_url("media-upload.php?type=multimedia&amp;post_id=$uploading_iframe_ID", 'inlineuploading'); 
     146        $multimedia_upload_iframe_src = "media-upload.php?type=multimedia&amp;post_id=$uploading_iframe_ID"; 
    380147        $multimedia_upload_iframe_src = apply_filters('multimedia_upload_iframe_src', $multimedia_upload_iframe_src); 
    381         $out = <<<EOF 
    382  
    383 <a href="{$image_upload_iframe_src}&TB_iframe=true&height=550&width=480" class="thickbox"><img src='images/media-button-image.gif' alt='' /></a> 
    384 <a href="{$multimedia_upload_iframe_src}&TB_iframe=true&height=500&width=640" class="thickbox"><img src='images/media-button-gallery.gif' alt='' /></a> 
    385 <a href="{$image_upload_iframe_src}&TB_iframe=true&height=500&width=640" class="thickbox"><img src='images/media-button-video.gif' alt='' /></a> 
    386 <a href="{$image_upload_iframe_src}&TB_iframe=true&height=500&width=640" class="thickbox"><img src='images/media-button-music.gif' alt='' /></a> 
    387 <a href="{$image_upload_iframe_src}&TB_iframe=true&height=500&width=640" class="thickbox"><img src='images/media-button-other.gif' alt='' /></a> 
    388  
    389  
    390 EOF; 
    391         echo $out; 
     148        echo "<a href='$multimedia_upload_iframe_src&TB_iframe=true&height=500&width=640' class='button thickbox'>" . __('Add media'). '</a>'; 
    392149} 
    393150add_action( 'media_buttons', 'media_buttons' ); 
    394151 
     
    522279function image_attachment_fields_to_edit($form_fields, $post) { 
    523280        if ( substr($post->post_mime_type, 0, 5) == 'image' ) { 
    524281                $form_fields['post_title']['required'] = true; 
    525                 $form_fields['post_excerpt']['label'] = __('Alternate Text'); 
    526                 $form_fields['post_content']['label'] = __('Description'); 
     282                $form_fields['post_excerpt']['label'] = __('Description'); 
     283                $form_fields['post_excerpt']['helps'][] = __('Alternate text, e.g. "The Mona Lisa"'); 
    527284 
    528                 if ( strlen(trim($post->post_excerpt)) == 0 ) 
    529                         $form_fields['post_excerpt']['helps'][] = __('Alternate Text helps people who can not see the image.'); 
     285                $form_fields['post_content']['label'] = __('Long Description'); 
    530286 
     287                $thumb = wp_get_attachment_thumb_url(); 
     288 
    531289                $form_fields['_send']['url'] = array( 
    532290                        'label' => __('Link URL'), 
    533291                        'input' => 'html', 
     
    547305                                <input type='radio' name='attachments[$post->ID][align]' id='image-align-right-$post->ID' value='right' /> 
    548306                                <label for='image-align-right-$post->ID' class='align image-align-right-label'>" . __('Right') . "</label>\n", 
    549307                ); 
     308                $form_fields['_send']['image-size'] = array( 
     309                        'label' => __('Size'), 
     310                        'input' => 'html', 
     311                        'html'  => " 
     312                                " . ( $thumb ? "<input type='radio' name='attachments[$post->ID][image-size]' id='image-size-thumb-$post->ID' value='thumb' /> 
     313                                <label for='image-size-thumb-$post->ID'>" . __('Thumbnail') . "</label> 
     314                                " : '' ) . "<input type='radio' name='attachments[$post->ID][image-size]' id='image-size-medium-$post->ID' value='medium' checked='checked' /> 
     315                                <label for='image-size-medium-$post->ID'>" . __('Medium') . "</label> 
     316                                <input type='radio' name='attachments[$post->ID][image-size]' id='image-size-full-$post->ID' value='full' /> 
     317                                <label for='image-size-full-$post->ID'>" . __('Full size') . "</label>", 
     318                ); 
    550319        } 
    551320        return $form_fields; 
    552321} 
     
    581350                else 
    582351                        $align = 'none'; 
    583352 
    584                 return get_image_send_to_editor($attachment_id, $attachment['post_excerpt'], $attachment['post_title'], $align, $url, $rel); 
     353                if ( !empty($attachment['image-size']) ) 
     354                        $size = $attachment['image-size']; 
     355                else 
     356                        $size = 'medium'; 
     357 
     358                return get_image_send_to_editor($attachment_id, $attachment['post_excerpt'], $attachment['post_title'], $align, $url, $rel, $size); 
    585359        } 
    586360 
    587361        return $html; 
     
    603377                        'value'      => $edit_post->post_title, 
    604378                ), 
    605379                'post_excerpt' => array( 
    606                         'label'      => __('Excerpt'), 
     380                        'label'      => __('Description'), 
    607381                        'value'      => $edit_post->post_excerpt, 
    608382                ), 
    609383                'post_content' => array( 
    610                         'label'      => __('Description'), 
     384                        'label'      => __('Long description'), 
    611385                        'value'      => $edit_post->post_content, 
    612386                        'input'      => 'textarea', 
    613387                        'helps'      => array(__('If filled, the default link URL will be the attachment permalink.')), 
     
    637411        // Merge default fields with their errors, so any key passed with the error (e.g. 'error', 'helps', 'value') will replace the default 
    638412        // The recursive merge is easily traversed with array casting: foreach( (array) $things as $thing ) 
    639413        $form_fields = array_merge_recursive($form_fields, (array) $errors); 
    640          
     414 
    641415        $form_fields = apply_filters('attachment_fields_to_edit', $form_fields, $post); 
    642416 
    643417        return $form_fields; 
    644418} 
    645419 
    646420function get_multimedia_item( $attachment_id, $errors = null, $send = true ) { 
    647         $thumb_url = wp_get_attachment_thumb_url( $attachment_id ); 
    648         if ( empty($thumb_url) ) 
    649                 $thumb_url = wp_mime_type_icon( $attachment_id ); 
    650         if ( empty($thumb_url) && ( $post =& get_post( $attachment_id ) ) && substr($post->post_mime_type, 0, 5) == 'image' ) 
    651                         $thumb_url = wp_get_attachment_url( $attachment_id ); 
     421        $thumb_url = array_shift(get_attachment_icon_src( $attachment_id )); 
    652422 
    653423        $title_label = __('Title'); 
    654424        $description_label = __('Description'); 
    655425        $tags_label = __('Tags'); 
    656426 
    657         $toggle_on = __('Describe'); 
    658         $toggle_off = __('Describe &laquo;'); 
     427        $toggle_on = __('Show'); 
     428        $toggle_off = __('Hide'); 
    659429 
    660430        $post = get_post($attachment_id); 
    661431 
     
    697467        $send = "<input type='submit' value='" . wp_specialchars(__('Send to Editor'), 1) . "' id='send[$attachment_id]' name='send[$attachment_id]' />"; 
    698468 
    699469        if ( empty($form_fields['save']) && empty($form_fields['_send']) ) { 
    700                 $form_fields['save'] = array('tr' => "\t\t<tr class='submit'><td colspan='2' class='del'><a id='del[$attachment_id]' class='delete' href='$delete_href'>$delete</a></td><td class='savesend'>$save$send</td></tr>\n"); 
     470                $form_fields['save'] = array('tr' => "\t\t<tr class='submit'><td colspan='2' class='del'><a id='del[$attachment_id]' class='delete button' href='$delete_href'>$delete</a></td><td class='savesend'>$save$send</td></tr>\n"); 
    701471        } elseif ( empty($form_fields['save']) ) { 
    702472                $form_fields['save'] = array('tr' => "\t\t<tr class='submit'><td></td><td></td><td class='savesend'>$save</td></tr>\n"); 
    703473                foreach ( $form_fields['_send'] as $id => $field ) 
    704474                        $form_fields[$id] = $field; 
    705                 $form_fields['send'] = array('tr' => "\t\t<tr class='submit'><td colspan='2' class='del'><a id='del[$attachment_id]' class='delete' href='$delete_href'>$delete</a></td><td class='savesend'>$send</td>"); 
     475                $form_fields['send'] = array('tr' => "\t\t<tr class='submit'><td colspan='2' class='del'><a id='del[$attachment_id]' class='delete button' href='$delete_href'>$delete</a></td><td class='savesend'>$send</td>"); 
    706476        } 
    707477 
    708478        $hidden_fields = array(); 
     
    773543 
    774544?> 
    775545<div id="media-upload-header"> 
    776 <h3><?php _e('Add Images'); ?></h3> 
     546<h3><?php _e('Add Media'); ?></h3> 
     547<?php the_image_upload_tabs(); ?> 
    777548</div> 
    778         <div id="media-upload-error"> 
     549 
     550<div id="media-upload-error"> 
    779551<?php if (isset($errors['upload_error']) && is_wp_error($errors['upload_error'])) { ?> 
    780552        <?php echo $errors['upload_error']->get_error_message(); ?> 
    781553<?php } ?> 
    782         </div> 
     554</div> 
    783555<script type="text/javascript"> 
    784556<!-- 
    785557jQuery(function($){ 
     
    795567                        }, 
    796568                        swfupload_element_id : "flash-upload-ui", // id of the element displayed when swfupload is available 
    797569                        degraded_element_id : "html-upload-ui",   // when swfupload is unavailable 
    798                         swfupload_loaded_handler : uploadLoadedMultimedia, 
    799                         //upload_start_handler : uploadStart, 
    800                         upload_progress_handler : uploadProgressMultimedia, 
    801                         //upload_error_handler : uploadError, 
    802                         upload_success_handler : uploadSuccessMultimedia, 
    803                         upload_complete_handler : uploadCompleteMultimedia, 
     570                        swfupload_loaded_handler : uploadLoaded, 
    804571                        file_dialog_start_handler : fileDialogStart, 
    805                         file_queued_handler : fileQueuedMultimedia, 
     572                        file_queued_handler : fileQueued, 
     573                        upload_start_handler : uploadStart, 
     574                        upload_progress_handler : uploadProgress, 
     575                        upload_error_handler : uploadError, 
     576                        upload_success_handler : uploadSuccess, 
     577                        upload_complete_handler : uploadComplete, 
    806578                        file_queue_error_handler : fileQueueError, 
    807579                        file_dialog_complete_handler : fileDialogComplete, 
    808580 
     
    810582                }); 
    811583        $("#flash-browse-button").bind( "click", function(){swfu.selectFiles();}); 
    812584        var preloaded = $(".multimedia-item.preloaded"); 
    813         if ( preloaded ) { 
     585        if ( preloaded.length > 0 ) { 
    814586                jQuery('#insert-multimedia').attr('disabled', ''); 
    815                 preloaded.each(function(){uploadSuccessMultimedia({id:this.id.replace(/[^0-9]/g, '')},'');}); 
     587                preloaded.each(function(){uploadSuccess({id:this.id.replace(/[^0-9]/g, '')},'');}); 
    816588        } 
    817         $("a.delete").bind('click',function(){$.ajax({url:'admin-ajax.php',type:'post',data:{id:this.id.replace(/del/,''),action:'delete-post',_ajax_nonce:this.href.replace(/^.*wpnonce=/,'')}});$(this).parents(".multimedia-item").eq(0).slideToggle(300, function(){$(this).remove();});return false;}); 
    818589}); 
    819590//--> 
    820591</script> 
    821 <p id="flash-upload-ui" style="display:none"> 
    822         <input id="flash-browse-button" type="button" value="<?php _e('Choose Files'); ?>" /> 
    823         <label for="image-file" class="form-help"><?php _e('Only PNG, JPG, GIF'); ?></label> 
    824 </p> 
    825592 
    826593<form enctype="multipart/form-data" method="post" action="<?php echo attribute_escape($form_action_url); ?>" class="media-upload-form"> 
    827594 
     595<div id="flash-upload-ui"> 
     596        <p><input id="flash-browse-button" type="button" value="<?php _e('Choose files to upload'); ?>" class="button" /></p> 
     597        <p><?php _e('As each upload completes, you can add titles and descriptions below.'); ?></p> 
     598</div> 
     599 
    828600<div id="html-upload-ui"> 
    829601        <p><label for="async-upload"><?php _e('Choose image'); ?></label> 
    830602        <input type="file" name="async-upload" id="async-upload" /> 
     
    838610        <br style="clear:both" /> 
    839611</div> 
    840612 
    841  
    842  
    843613<div id="multimedia-items"> 
    844614 
    845615<?php echo get_multimedia_items($post_id, $errors); ?> 
     
    847617</div> 
    848618 
    849619<p class="submit"> 
    850         <a href="#" onClick="return top.tb_remove();" id="image-cancel" class="button-cancel"><?php _e('Cancel'); ?></a> 
    851         <input type="submit" class="submit" id="insert-multimedia" name="insert-multimedia" value="<?php _e('Insert gallery into post'); ?>" disabled="disabled" /> 
     620        <input type="submit" class="submit insert-gallery" name="insert-multimedia" value="<?php _e('Insert gallery into post'); ?>" /> 
    852621</p> 
    853622 
    854623<?php wp_nonce_field('multimedia-form'); ?> 
     
    862631add_filter('async_upload_multimedia', 'get_multimedia_item', 10, 2); 
    863632add_filter('media_upload_multimedia', 'multimedia_upload_handler'); 
    864633 
     634 
    865635// Any 'attachment' taxonomy will be included in the description input form for the multi uploader 
    866636// Example: 
     637/* 
    867638register_taxonomy( 
    868         //  
    869639        'image_people', 
    870640        'attachment:image', 
    871641        array( 
    872642                'label' => __('People'), 
    873                 'template' => __('People: %s'), 
     643                'template' => __('People: %l'), 
     644                'helps' => __('Left to right, top to bottom.'), 
    874645                'sort' => true, 
    875646                'args' => array( 
    876647                        'orderby' => 'term_order' 
    877648                ) 
    878649        ) 
    879650); 
     651*/ 
     652/* 
     653register_taxonomy('movie_director', 'attachment:video', array('label'=>__('Directors'), 'template'=>__('Directed by %l.'))); 
     654register_taxonomy('movie_producer', 'attachment:video', array('label'=>__('Producers'), 'template'=>__('Produced by %l.'))); 
     655register_taxonomy('movie_screenwriter', 'attachment:video', array('label'=>__('Screenwriter'), 'template'=>__('Screenplay by %l.'))); 
     656register_taxonomy('movie_actor', 'attachment:video', array('label'=>__('Cast'), 'template'=>array(__('Cast: %l.'))); 
     657register_taxonomy('movie_crew', 'attachment:video', array('label'=>__('Crew'), 'template'=>array(__('Crew: %l.'))); 
     658*/ 
    880659 
    881660?> 
  • wp-admin/edit-attachment-rows.php

     
    4646 
    4747        case 'media': 
    4848                ?> 
    49                 <td><strong><a href="# TODO: upload.php?action=edit&post=<?php the_ID(); ?>"><?php the_title(); ?></a></strong> 
     49                <td><strong><a href="# TODO: upload.php?action=edit&post=<?php the_ID(); ?>"><?php the_title(); ?></a></strong><br /> 
     50                <?php echo strtoupper(preg_replace('/^.*?\.(\w+)$/', '$1', $post->guid)); ?> 
     51                <?php do_action('manage_media_media_column', $post->ID); ?> 
     52                </td> 
    5053                <?php 
    51                 // TODO 
    5254                break; 
    5355 
    5456        case 'desc': 
    5557                ?> 
    56                 <td><?php has_excerpt() ? the_excerpt() : null; ?></td> 
     58                <td><?php echo has_excerpt() ? $post->post_excerpt : ''; ?></td> 
    5759                <?php 
    58                 // TODO 
    5960                break; 
    6061 
    6162        case 'date': 
     
    9293                ?> 
    9394                <td><a href="<?php the_permalink(); ?>"><?php _e('Permalink'); ?></a></td> 
    9495                <?php 
    95                 // TODO 
    9696                break; 
    9797 
    9898        default: 
    9999                ?> 
    100                 <td><?php do_action('manage_posts_custom_column', $column_name, $id); ?></td> 
     100                <td><?php do_action('manage_media_custom_column', $column_name, $id); ?></td> 
    101101                <?php 
    102102                break; 
    103103        } 
  • wp-admin/css/media.css

     
    109109        background: url(../images/align-right.png) no-repeat center left; 
    110110} 
    111111 
    112 .media-upload-form fieldset#image-size label { 
     112#flash-upload-ui, .insert-gallery { 
     113        display: none; 
     114} 
     115 
     116tr.image-size label { 
    113117        display: inline; 
    114118        margin: 0 1em 0 0; 
    115119} 
    116  
     120tr.image-size td.field { 
     121        text-align: center; 
     122} 
    117123.pinkynail { 
    118124        max-width: 40px; 
    119125        max-height: 40px; 
     
    187193.describe input[type="text"], .describe textarea { 
    188194        width: 460px; 
    189195} 
    190 .describe a.delete { 
     196a.delete { 
    191197        display: block; 
    192198        text-align: center; 
    193         line-height: 24px; 
    194199        width: 100%; 
     200        color: #246; 
    195201} 
    196202.describe-toggle-on, .describe-toggle-off { 
    197203        line-height: 36px;