WordPress.org

Make WordPress Core

Changeset 7100


Ignore:
Timestamp:
02/29/2008 06:54:15 AM (10 years ago)
Author:
ryan
Message:

Media Library updates from andy. see #5911

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/css/media.css

    r7092 r7100  
    2020    font-weight: bold;
    2121    color: #f00;
     22}
     23
     24.file-error {
     25    font-weight: bold;
     26    color: #f00;
     27    margin: 0 15px;
    2228}
    2329
  • trunk/wp-includes/functions.php

    r7063 r7100  
    11761176}
    11771177
     1178function wp_ext2type( $ext ) {
     1179    $ext2type = apply_filters('ext2type', array(
     1180        'audio' => array('aac','ac3','aif','aiff','mp1','mp2','mp3','m3a','m4a','m4b','ogg','ram','wav','wma'),
     1181        'video' => array('asf','avi','divx','dv','mov','mpg','mpeg','mp4','mpv','ogm','qt','rm','vob','wmv'),
     1182        'document' => array('doc','pages','odt','rtf','pdf'),
     1183        'spreadsheet' => array('xls','numbers','ods'),
     1184        'interactive' => array('ppt','key','odp','swf'),
     1185        'text' => array('txt'),
     1186        'archive' => array('tar','bz2','gz','cab','dmg','rar','sea','sit','sqx','zip'),
     1187        'code' => array('css','html','php','js'),       
     1188    ));
     1189    foreach ( $ext2type as $type => $exts )
     1190        if ( in_array($ext, $exts) )
     1191            return $type;
     1192}
    11781193
    11791194function wp_check_filetype( $filename, $mimes = null ) {
  • trunk/wp-includes/js/swfupload/handlers.js

    r7092 r7100  
    118118// file-specific message
    119119function wpFileError(fileObj, message) {
    120     jQuery('#media-upload-error-' + fileObj.id).show().text(message);
     120    jQuery('#media-item-' + fileObj.id + ' .filename').append('<span class="file-error">'+message+'</span> <button type="button" class="button dismiss">'+swfuploadL10n.dismiss+'</button>');
     121    jQuery('.dismiss').click(function(){jQuery(this).parents('.media-item').slideUp(200, function(){jQuery(this).remove();})});
    121122}
    122123
     
    127128    }
    128129    else if ( error_code == SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT ) {
     130        fileQueued(fileObj);
    129131        wpFileError(fileObj, swfuploadL10n.file_exceeds_size_limit);
    130132    }
    131133    else if ( error_code == SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE ) {
     134        fileQueued(fileObj);
    132135        wpFileError(fileObj, swfuploadL10n.zero_byte_file);
    133136    }
    134137    else if ( error_code == SWFUpload.QUEUE_ERROR.INVALID_FILETYPE ) {
     138        fileQueued(fileObj);
    135139        wpFileError(fileObj, swfuploadL10n.invalid_filetype);
    136140    }
  • trunk/wp-includes/post.php

    r7074 r7100  
    885885    foreach ( (array) $wildcard_mime_types as $type ) {
    886886        $type = str_replace('*', $wild, $type);
    887         $patternses[1][$type] = $type;
     887        $patternses[1][$type] = "^$type$";
    888888        if ( false === strpos($type, '/') ) {
    889             $patternses[2][$type] = "^$type/$wild$";
    890             $patternses[3][$type] = "$wild$type$wild";
     889            $patternses[2][$type] = "^$type/";
     890            $patternses[3][$type] = $type;
    891891        }
    892892    }
     
    23622362    if ( !is_numeric($mime) )
    23632363        $icon = wp_cache_get("mime_type_icon_$mime");
    2364 
    23652364    if ( empty($icon) ) {
    23662365        $post_id = 0;
     
    23712370                $post_id = (int) $post->ID;
    23722371                $ext = preg_replace('/^.+?\.([^.]+)$/', '$1', $post->guid);
    2373                 if ( !empty($ext) )
     2372                if ( !empty($ext) ) {
    23742373                    $post_mimes[] = $ext;
     2374                    if ( $ext_type = wp_ext2type( $ext ) )
     2375                        $post_mimes[] = $ext_type;
     2376                }
    23752377                $mime = $post->post_mime_type;
    23762378            } else {
     
    23842386
    23852387        if ( !is_array($icon_files) ) {
    2386             $icon_dir = apply_filters( 'icon_dir', ABSPATH . WPINC . '/images' );
    2387             $icon_dir_uri = apply_filters( 'icon_dir_uri', trailingslashit(get_option('siteurl')) . WPINC . '/images' );
     2388            $icon_dir = apply_filters( 'icon_dir', ABSPATH . WPINC . '/images/crystal' );
     2389            $icon_dir_uri = apply_filters( 'icon_dir_uri', trailingslashit(get_option('siteurl')) . WPINC . '/images/crystal' );
    23882390            $dirs = apply_filters( 'icon_dirs', array($icon_dir => $icon_dir_uri) );
    23892391            $icon_files = array();
    2390             foreach ( $dirs as $dir => $uri) {
     2392            while ( $dirs ) {
     2393                $dir = array_shift(array_keys($dirs));
     2394                $uri = array_shift($dirs);
    23912395                if ( $dh = opendir($dir) ) {
    23922396                    while ( false !== $file = readdir($dh) ) {
    23932397                        $file = basename($file);
     2398                        if ( substr($file, 0, 1) == '.' )
     2399                            continue;
    23942400                        if ( !in_array(strtolower(substr($file, -4)), array('.png', '.gif', '.jpg') ) ) {
    2395                             if ( is_dir($file) )
     2401                            if ( is_dir("$dir/$file") )
    23962402                                $dirs["$dir/$file"] = "$uri/$file";
    23972403                            continue;
  • trunk/wp-includes/script-loader.php

    r7092 r7100  
    8989        $this->add( 'swfupload-degrade', '/wp-includes/js/swfupload/plugins/swfupload.graceful_degradation.js', array('swfupload'), '2.0.2');
    9090        $this->add( 'swfupload-queue', '/wp-includes/js/swfupload/plugins/swfupload.queue.js', array('swfupload'), '2.0.2');
    91         $this->add( 'swfupload-handlers', '/wp-includes/js/swfupload/handlers.js', array('swfupload'), '2.0.2-20080227');
     91        $this->add( 'swfupload-handlers', '/wp-includes/js/swfupload/handlers.js', array('swfupload'), '2.0.2-20080228');
    9292        // these error messages came from the sample swfupload js, they might need changing.
    9393        $this->localize( 'swfupload-handlers', 'swfuploadL10n', array(
    94                 'queue_limit_exceeded' => 'You have attempted to queue too many files.',
    95                 'file_exceeds_size_limit' => 'The file you have selected is too big.',
    96                 'zero_byte_file' => 'The file you selected is empty.  Please select another file.',
    97                 'invalid_filetype' => 'The file you choose is not an allowed file type.',
    98                 'default_error' => 'An error occurred in the upload. Please try again later.',
    99                 'missing_upload_url' => 'There was a configuration error.  Please contact the server administrator.',
    100                 'upload_limit_exceeded' => 'You may only upload 1 file.',
    101                 'http_error' => 'HTTP error.',
    102                 'upload_failed' => 'Upload failed.',
    103                 'io_error' => 'IO error.',
    104                 'security_error' => 'Security error.',
    105                 'file_cancelled' => 'File cancelled.',
    106                 'upload_stopped' => 'Upload stopped.',
    107 
     94                'queue_limit_exceeded' => __('You have attempted to queue too many files.'),
     95                'file_exceeds_size_limit' => __('This file is too big. See php.ini.'),
     96                'zero_byte_file' => __('The file you selected is empty. Please select another file.'),
     97                'invalid_filetype' => __('The file you choose is not an allowed file type.'),
     98                'default_error' => __('An error occurred in the upload. Please try again later.'),
     99                'missing_upload_url' => __('There was a configuration error. Please contact the server administrator.'),
     100                'upload_limit_exceeded' => __('You may only upload 1 file.'),
     101                'http_error' => __('HTTP error.'),
     102                'upload_failed' => __('Upload failed.'),
     103                'io_error' => __('IO error.'),
     104                'security_error' => __('Security error.'),
     105                'file_cancelled' => __('File cancelled.'),
     106                'upload_stopped' => __('Upload stopped.'),
     107                'dismiss' => __('Dismiss'),
    108108        ) );
    109109
Note: See TracChangeset for help on using the changeset viewer.