WordPress.org

Make WordPress Core

Ticket #8822: lj-importer-upgrades2.patch

File lj-importer-upgrades2.patch, 28.6 KB (added by azaozz, 9 years ago)

Updated for [10340]

  • wp-admin/admin.php

     
    9797
    9898        exit();
    9999} else if (isset($_GET['import'])) {
    100 
     100        wp_enqueue_script('swfupload-swfobject');
     101        wp_enqueue_script('swfupload-queue');
     102        wp_enqueue_script('swfupload-handlers');
     103        wp_admin_css('media');
    101104        $importer = $_GET['import'];
    102105
    103106        if ( ! current_user_can('import') )
     
    108111        }
    109112
    110113        // Allow plugins to define importers as well
    111         if ( !isset($wp_importers) || !isset($wp_importers[$importer]) || ! is_callable($wp_importers[$importer][2]))
    112         {
    113                 if (! file_exists(ABSPATH . "wp-admin/import/$importer.php"))
    114                 {
     114        if ( !isset($wp_importers) || !isset($wp_importers[$importer]) || ! is_callable($wp_importers[$importer][2])) {
     115                if (! file_exists(ABSPATH . "wp-admin/import/$importer.php")) {
    115116                        wp_die(__('Cannot load importer.'));
    116117                }
    117118                include(ABSPATH . "wp-admin/import/$importer.php");
  • wp-admin/import/livejournal.php

     
    3535
    3636        function greet() {
    3737                echo '<div class="narrow">';
    38                 echo '<p>'.__('Howdy! Upload your LiveJournal XML export file and we&#8217;ll import the posts into this blog.').'</p>';
    39                 echo '<p>'.__('Choose a LiveJournal XML file to upload, then click Upload file and import.').'</p>';
     38                echo '<p>'.__('Howdy! Let\'s get your LiveJournal posts imported into this blog.').'</p>';
     39                echo '<ol>';
     40                echo '<li>'.__('Use the <a href="http://www.livejournal.com/export.bml" target="_blank">LiveJournal Export Journal tool</a> to export all of your posts. You will need to export each month separately, and save the files to your computer. Use these options when exporting:');
     41                        echo '<ul>';
     42                        echo '<li>'.__('<strong>Export what:</strong> Journal entries').'</li>';
     43                        echo '<li>'.__('<strong>Select month:</strong> yyyy: (each year) - mm: (each month) [LJ only allows you to export one month at a time, so you should go through each month of each year that you have posts for and create a separate export file.]').'</li>';
     44                        echo '<li>'.__('<strong>Format:</strong> XML').'</li>';
     45                        echo '<li>'.__('<strong>Header:</strong> Checked').'</li>';
     46                        echo '<li>'.__('<strong>Encoding:</strong> Unicode (UTF-8)').'</li>';
     47                        echo '<li>'.__('<strong>Do not translate between encodings:</strong> Unchecked').'</li>';
     48                        echo '<li>'.__('<strong>Fields:</strong> Check All').'</li>';
     49                        echo '</ul></li>';
     50                echo '<li>'.__('Come back here when you\'re done and upload each file using the form below to import the entries into this blog.').'</li>';
     51                echo '</ol>';
    4052                wp_import_upload_form("admin.php?import=livejournal&amp;step=1");
    4153                echo '</div>';
    4254        }
     
    7486                        $post_content = preg_replace_callback('|<(/?[A-Z]+)|', create_function('$match', 'return "<" . strtolower($match[1]);'), $post_content);
    7587                        $post_content = str_replace('<br>', '<br />', $post_content);
    7688                        $post_content = str_replace('<hr>', '<hr />', $post_content);
     89                        // Links to other LJ users
     90                        $post_content = preg_replace('|<lj\s+user\s*=\s*["\']([\w-]+)["\']>|', '<a href="http://$1.livejournal.com/" class="lj-user">$1</a>', $post_content);
     91                        // lj-cut ==> <!--more-->
     92                        $post_content = str_replace(array('<lj-cut>', '</lj-cut>'), array('<!--more-->', ''), $post_content);
     93                        // Remove all but the first <!--more-->
     94                        $first = strpos($post_content, '<!--more-->');
     95                        $post_content = str_replace(substr($post_content, $first + 1), str_replace('<!--more-->', '', substr($post_content, $first + 1)), $post_content);
     96                       
    7797                        $post_content = $wpdb->escape($post_content);
    7898
    7999                        $post_author = $current_user->ID;
  • wp-admin/import/rss.php

     
    118118                echo '<ol>';
    119119
    120120                foreach ($this->posts as $post) {
    121                         echo "<li>".__('Importing post...');
    122 
     121                        echo "<li>";
    123122                        extract($post);
     123                        printf(__('Importing post <em>%s</em>...'), stripslashes($post_title));
    124124
    125125                        if ($post_id = post_exists($post_title, $post_content, $post_date)) {
    126126                                _e('Post already imported');
  • wp-admin/includes/import.php

     
    5959 * @return array
    6060 */
    6161function wp_import_handle_upload() {
    62         $overrides = array( 'test_form' => false, 'test_type' => false );
    63         $_FILES['import']['name'] .= '.import';
    64         $file = wp_handle_upload( $_FILES['import'], $overrides );
     62        if (!empty($_FILES['import'])) {
     63                // Handle upload of file and storage as attachment
     64                $overrides = array( 'test_form' => false, 'test_type' => false );
     65                $_FILES['import']['name'] .= '.import';
     66                $file = wp_handle_upload( $_FILES['import'], $overrides );
    6567
    66         if ( isset( $file['error'] ) )
    67                 return $file;
     68                if ( isset( $file['error'] ) )
     69                        return $file;
    6870
    69         $url = $file['url'];
    70         $type = $file['type'];
    71         $file = addslashes( $file['file'] );
    72         $filename = basename( $file );
     71                $url = $file['url'];
     72                $type = $file['type'];
     73                $file = addslashes( $file['file'] );
     74                $filename = basename( $file );
    7375
    74         // Construct the object array
    75         $object = array( 'post_title' => $filename,
    76                 'post_content' => $url,
    77                 'post_mime_type' => $type,
    78                 'guid' => $url
    79         );
     76                // Construct the object array
     77                $object = array( 'post_title' => $filename,
     78                        'post_content' => $url,
     79                        'post_mime_type' => $type,
     80                        'guid' => $url
     81                );
    8082
    81         // Save the data
    82         $id = wp_insert_attachment( $object, $file );
    83 
     83                // Save the data
     84                $id = wp_insert_attachment( $object, $file );
     85        } else {
     86                // Populate details based on ID passed in from async upload
     87                $id = $_REQUEST['attachment_id'];
     88                $file = get_attached_file($id);
     89        }
    8490        return array( 'file' => $file, 'id' => $id );
    8591}
    8692
  • wp-admin/includes/template.php

     
    26932693function wp_import_upload_form( $action ) {
    26942694        $bytes = apply_filters( 'import_upload_size_limit', wp_max_upload_size() );
    26952695        $size = wp_convert_bytes_to_hr( $bytes );
     2696       
     2697        // If Mac and mod_security, no Flash. :(
     2698        $flash = true;
     2699        if ( false !== strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'mac') && apache_mod_loaded('mod_security') )
     2700                $flash = false;
     2701
     2702        if (isset($_REQUEST['flash']) && '0' == $_REQUEST['flash'])
     2703                $flash = false;
     2704
     2705        $flash = apply_filters('import_flash_uploader', $flash);
    26962706?>
     2707
    26972708<form enctype="multipart/form-data" id="import-upload-form" method="post" action="<?php echo attribute_escape($action) ?>">
    2698 <p>
    2699 <?php wp_nonce_field('import-upload'); ?>
    2700 <label for="upload"><?php _e( 'Choose a file from your computer:' ); ?></label> (<?php printf( __('Maximum size: %s' ), $size ); ?>)
    2701 <input type="file" id="upload" name="import" size="25" />
    2702 <input type="hidden" name="action" value="save" />
    2703 <input type="hidden" name="max_file_size" value="<?php echo $bytes; ?>" />
    2704 </p>
    2705 <p class="submit">
    2706 <input type="submit" class="button" value="<?php _e( 'Upload file and import' ); ?>" />
    2707 </p>
     2709
     2710<?php if ( $flash ) : ?>
     2711<script type="text/javascript">
     2712<!--
     2713SWFUpload.onload = function() {
     2714        post_id = 0;
     2715        import_nonce = '<?php echo wp_create_nonce('import-upload'); ?>';
     2716        swfu = new SWFUpload({
     2717                        button_text: '<span class="button"><?php _e('Choose File'); ?></span>',
     2718                        button_text_style: '.button { text-align: center; font-weight: bold; font-family:"Lucida Grande","Lucida Sans Unicode",Tahoma,Verdana,sans-serif; }',
     2719                        button_height: "24",
     2720                        button_width: "132",
     2721                        button_image_url: '<?php echo includes_url('images/upload.png'); ?>',
     2722                        button_placeholder_id: "flash-browse-button",
     2723                        upload_url : "<?php echo attribute_escape( admin_url('async-upload.php') ); ?>",
     2724                        flash_url : "<?php echo includes_url('js/swfupload/swfupload.swf'); ?>",
     2725                        file_post_name: "async-upload",
     2726                        file_types: "<?php echo apply_filters('import_upload_file_glob', '*.*'); ?>",
     2727                        file_upload_limit: 1,
     2728                        post_params : {
     2729                                "auth_cookie" : "<?php if ( is_ssl() ) echo $_COOKIE[SECURE_AUTH_COOKIE]; else echo $_COOKIE[AUTH_COOKIE]; ?>",
     2730                                "_wpnonce" : "<?php echo wp_create_nonce('media-form'); ?>",
     2731                                "short" : "true",
     2732                        },
     2733                        file_size_limit : "<?php echo $bytes; ?>b",
     2734                        file_dialog_start_handler : fileDialogStart,
     2735                        file_queued_handler : fileQueued,
     2736                        upload_start_handler : uploadStart,
     2737                        upload_progress_handler : uploadProgress,
     2738                        upload_error_handler : uploadError,
     2739                        upload_success_handler : importUploadSuccess,
     2740                        upload_complete_handler : uploadComplete,
     2741                        file_queue_error_handler : fileQueueError,
     2742                        file_dialog_complete_handler : fileDialogComplete,
     2743                        swfupload_pre_load_handler: swfuploadPreLoad,
     2744                        swfupload_load_failed_handler: swfuploadLoadFailed,
     2745                        custom_settings : {
     2746                                degraded_element_id : "html-upload-ui", // id of the element displayed when swfupload is unavailable
     2747                                swfupload_element_id : "flash-upload-ui" // id of the element displayed when swfupload is available
     2748                        },
     2749                        debug: false
     2750                });
     2751};
     2752//-->
     2753</script>
     2754
     2755<div id="flash-upload-ui">
     2756<?php do_action('pre-flash-import-upload-ui'); ?>
     2757        <div id="flash-upload-msg"><?php _e( 'Click the button to choose a file to import' ); ?> <div id="flash-browse-button"></div></div>
     2758        <?php media_upload_flash_bypass() ?>
     2759        <div id="media-items"></div>
     2760<?php do_action('post-flash-import-upload-ui'); ?>
     2761</div>
     2762<div id="media-upload-error"></div>
     2763<?php endif; // $flash ?>
     2764
     2765<div id="html-upload-ui">
     2766<?php do_action('pre-html-import-upload-ui'); ?>
     2767        <p id="async-upload-wrap">
     2768                <?php wp_nonce_field('import-upload'); ?>
     2769                <label for="upload"><?php _e( 'Choose a file from your computer:' ); ?></label> (<?php printf( __('Maximum size: %s' ), $size ); ?>)
     2770                <input type="file" id="upload" name="import" size="25" />
     2771                <input type="hidden" name="action" value="save" />
     2772                <input type="hidden" name="max_file_size" value="<?php echo $bytes; ?>" />
     2773        </p>
     2774        <?php media_upload_html_bypass() ?>
     2775        <p class="submit">
     2776                <input type="submit" class="button" value="Upload &amp; Import" />
     2777        </p>
     2778       
     2779<?php do_action('post-html-import-upload-ui'); ?>
     2780</div>
     2781
    27082782</form>
    27092783<?php
    27102784}
  • wp-admin/wp-admin.css

     
    29402940        line-height: 1;
    29412941        padding-left: 25px;
    29422942}
     2943
     2944ol {
     2945        list-style-type: decimal;
     2946        margin-left: 2em;
     2947}
  • wp-includes/js/swfupload/handlers.dev.js

     
    285285        });
    286286}
    287287})(jQuery);
     288
     289// Success handler for the import tools instance of the uploader
     290function importUploadSuccess(fileObj, serverData) {
     291        // if async-upload returned an error message, place it in the media item div and return
     292        if ( serverData.match('media-upload-error') ) {
     293                jQuery('#media-item-' + fileObj.id).html(serverData);
     294                return;
     295        }
     296       
     297        // Remove progress bar
     298        jQuery('#media-item-' + fileObj.id + ' .progress').remove();
     299       
     300        // Add the link to go to the next step, indicating which attachment is the data file
     301        jQuery('#media-item-' + fileObj.id).append('<a href="' + document.location.href + '&step=1&action=save&attachment_id=' + serverData + '&_wpnonce=' + import_nonce + '&_wp_http_referer=' + escape(document.location.href) + '" class="describe-toggle-on">' + swfuploadL10n.import_continue + '</a>');
     302       
     303        // Remove the upload button to prevent them from trying to upload more
     304        jQuery('#flash-upload-msg').remove()
     305}
  • wp-includes/js/swfupload/handlers.js

     
    1 function fileDialogStart(){jQuery("#media-upload-error").empty()}function fileQueued(a){jQuery(".media-blank").remove();if(jQuery(".type-form #media-items>*").length==1&&jQuery("#media-items .hidden").length>0){jQuery(".toggle").toggle();jQuery(".slidetoggle").slideUp(200).siblings().removeClass("hidden")}jQuery("#media-items").append('<div id="media-item-'+a.id+'" class="media-item child-of-'+post_id+'"><div class="progress"><div class="bar"></div></div><div class="filename original">'+a.name+"</div></div>");jQuery("#media-item-"+a.id+" .progress").show();jQuery("#insert-gallery").attr("disabled","disabled")}function uploadStart(a){return true}function uploadProgress(c,a,b){jQuery("#media-item-"+c.id+" .bar").width(620*a/b);if(a==b){jQuery("#media-item-"+c.id+" .bar").html('<strong class="crunching">'+swfuploadL10n.crunching+"</strong>")}}function prepareMediaItem(b,a){jQuery("#media-item-"+b.id+" .bar").remove();jQuery("#media-item-"+b.id+" .progress").hide();var c=(typeof shortform=="undefined")?1:2;if(isNaN(a)||!a){jQuery("#media-item-"+b.id).append(a);prepareMediaItemInit(b)}else{jQuery("#media-item-"+b.id).load("async-upload.php",{attachment_id:a,fetch:c},function(){prepareMediaItemInit(b);updateMediaForm()})}}function prepareMediaItemInit(a){jQuery("#media-item-"+a.id+" .thumbnail").clone().attr("className","pinkynail toggle").prependTo("#media-item-"+a.id);jQuery("#media-item-"+a.id+" .filename.original").replaceWith(jQuery("#media-item-"+a.id+" .filename.new"));jQuery("#media-item-"+a.id+" a.toggle").bind("click",function(){jQuery(this).siblings(".slidetoggle").slideToggle(150,function(){var b=jQuery(this).offset();window.scrollTo(0,b.top-36)});jQuery(this).parent().eq(0).children(".toggle").toggle();jQuery(this).siblings("a.toggle").focus();return false});jQuery("#media-item-"+a.id+" a.delete").bind("click",function(){jQuery.ajax({url:"admin-ajax.php",type:"post",success:deleteSuccess,error:deleteError,id:a.id,data:{id:this.id.replace(/[^0-9]/g,""),action:"delete-post",_ajax_nonce:this.href.replace(/^.*wpnonce=/,"")}});return false});jQuery("#media-item-"+a.id+".startopen").removeClass("startopen").slideToggle(500).parent().eq(0).children(".toggle").toggle()}function itemAjaxError(c,b){var a=jQuery("#media-item-error"+c);a.html('<div class="file-error"><button type="button" id="dismiss-'+c+'" class="button dismiss">'+swfuploadL10n.dismiss+"</button>"+b+"</div>");jQuery("#dismiss-"+c).click(function(){jQuery(this).parents(".file-error").slideUp(200,function(){jQuery(this).empty()})})}function deleteSuccess(b,c){if(b=="-1"){return itemAjaxError(this.id,"You do not have permission. Has your session expired?")}if(b=="0"){return itemAjaxError(this.id,"Could not be deleted. Has it been deleted already?")}var a=jQuery("#media-item-"+this.id);if(type=jQuery("#type-of-"+this.id).val()){jQuery("#"+type+"-counter").text(jQuery("#"+type+"-counter").text()-1)}if(a.hasClass("child-of-"+post_id)){jQuery("#attachments-count").text(jQuery("#attachments-count").text()-1)}if(jQuery(".type-form #media-items>*").length==1&&jQuery("#media-items .hidden").length>0){jQuery(".toggle").toggle();jQuery(".slidetoggle").slideUp(200).siblings().removeClass("hidden")}jQuery("#media-item-"+this.id+" .filename:empty").remove();jQuery("#media-item-"+this.id+" .filename").append(' <span class="file-error">'+swfuploadL10n.deleted+"</span>").siblings("a.toggle").remove();jQuery("#media-item-"+this.id).children(".describe").css({backgroundColor:"#fff"}).end().animate({backgroundColor:"#ffc0c0"},{queue:false,duration:50}).animate({minHeight:0,height:36},400,null,function(){jQuery(this).children(".describe").remove()}).animate({backgroundColor:"#fff"},400).animate({height:0},800,null,function(){jQuery(this).remove();updateMediaForm()});return}function deleteError(c,b,a){}function updateMediaForm(){storeState();if(jQuery(".type-form #media-items>*").length==1){jQuery("#media-items .slidetoggle").slideDown(500).parent().eq(0).children(".toggle").toggle();jQuery(".type-form .slidetoggle").siblings().addClass("hidden")}if(jQuery("#media-items>*").not(".media-blank").length>0){jQuery(".savebutton").show()}else{jQuery(".savebutton").hide()}if(jQuery("#media-items>*").length>1){jQuery(".insert-gallery").show()}else{jQuery(".insert-gallery").hide()}}function uploadSuccess(b,a){if(a.match("media-upload-error")){jQuery("#media-item-"+b.id).html(a);return}prepareMediaItem(b,a);updateMediaForm();if(jQuery("#media-item-"+b.id).hasClass("child-of-"+post_id)){jQuery("#attachments-count").text(1*jQuery("#attachments-count").text()+1)}}function uploadComplete(a){if(swfu.getStats().files_queued==0){jQuery("#insert-gallery").attr("disabled","")}}function wpQueueError(a){jQuery("#media-upload-error").show().text(a)}function wpFileError(b,a){jQuery("#media-item-"+b.id+" .filename").after('<div class="file-error"><button type="button" id="dismiss-'+b.id+'" class="button dismiss">'+swfuploadL10n.dismiss+"</button>"+a+"</div>").siblings(".toggle").remove();jQuery("#dismiss-"+b.id).click(function(){jQuery(this).parents(".media-item").slideUp(200,function(){jQuery(this).remove()})})}function fileQueueError(c,a,b){if(a==SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED){wpQueueError(swfuploadL10n.queue_limit_exceeded)}else{if(a==SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT){fileQueued(c);wpFileError(c,swfuploadL10n.file_exceeds_size_limit)}else{if(a==SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE){fileQueued(c);wpFileError(c,swfuploadL10n.zero_byte_file)}else{if(a==SWFUpload.QUEUE_ERROR.INVALID_FILETYPE){fileQueued(c);wpFileError(c,swfuploadL10n.invalid_filetype)}else{wpQueueError(swfuploadL10n.default_error)}}}}}function fileDialogComplete(b){try{if(b>0){this.startUpload()}}catch(a){this.debug(a)}}function swfuploadPreLoad(){var a=jQuery("#"+swfu.customSettings.swfupload_element_id).get(0);jQuery("#"+swfu.customSettings.degraded_element_id).hide();if(a&&!a.style.display){a.style.display="block"}}function swfuploadLoadFailed(){jQuery("#"+swfu.customSettings.swfupload_element_id).hide();jQuery("#"+swfu.customSettings.degraded_element_id).show()}function uploadError(c,a,b){if(a==SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL){wpFileError(c,swfuploadL10n.missing_upload_url)}else{if(a==SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED){wpFileError(c,swfuploadL10n.upload_limit_exceeded)}else{wpFileError(c,swfuploadL10n.default_error)}}if(a==SWFUpload.UPLOAD_ERROR.HTTP_ERROR){wpQueueError(swfuploadL10n.http_error)}else{if(a==SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED){wpQueueError(swfuploadL10n.upload_failed)}else{if(a==SWFUpload.UPLOAD_ERROR.IO_ERROR){wpQueueError(swfuploadL10n.io_error)}else{if(a==SWFUpload.UPLOAD_ERROR.SECURITY_ERROR){wpQueueError(swfuploadL10n.security_error)}else{if(a==SWFUpload.UPLOAD_ERROR.FILE_CANCELLED){wpQueueError(swfuploadL10n.security_error)}}}}}}var storeState;(function(a){storeState=function(){var c=getUserSetting("align")||"",b=getUserSetting("imgsize")||"";a('tr.align input[type="radio"]').click(function(){setUserSetting("align",a(this).val())}).filter(function(){if(a(this).val()==c){return true}return false}).attr("checked","checked");a('tr.image-size input[type="radio"]').click(function(){setUserSetting("imgsize",a(this).val())}).filter(function(){if(a(this).attr("disabled")||a(this).val()!=b){return false}return true}).attr("checked","checked");a("tr.url button").click(function(){var d=this.className||"";d=d.replace(/.*?(url[^ '"]+).*/,"$1");if(d){setUserSetting("urlbutton",d)}a(this).siblings(".urlfield").val(a(this).attr("title"))});a("tr.url .urlfield").each(function(){var d=getUserSetting("urlbutton");a(this).val(a(this).siblings("button."+d).attr("title"))})}})(jQuery);
    2  No newline at end of file
     1function fileDialogStart(){jQuery("#media-upload-error").empty()}function fileQueued(a){jQuery(".media-blank").remove();if(jQuery(".type-form #media-items>*").length==1&&jQuery("#media-items .hidden").length>0){jQuery(".toggle").toggle();jQuery(".slidetoggle").slideUp(200).siblings().removeClass("hidden")}jQuery("#media-items").append('<div id="media-item-'+a.id+'" class="media-item child-of-'+post_id+'"><div class="progress"><div class="bar"></div></div><div class="filename original">'+a.name+"</div></div>");jQuery("#media-item-"+a.id+" .progress").show();jQuery("#insert-gallery").attr("disabled","disabled")}function uploadStart(a){return true}function uploadProgress(c,a,b){jQuery("#media-item-"+c.id+" .bar").width(620*a/b);if(a==b){jQuery("#media-item-"+c.id+" .bar").html('<strong class="crunching">'+swfuploadL10n.crunching+"</strong>")}}function prepareMediaItem(b,a){jQuery("#media-item-"+b.id+" .bar").remove();jQuery("#media-item-"+b.id+" .progress").hide();var c=(typeof shortform=="undefined")?1:2;if(isNaN(a)||!a){jQuery("#media-item-"+b.id).append(a);prepareMediaItemInit(b)}else{jQuery("#media-item-"+b.id).load("async-upload.php",{attachment_id:a,fetch:c},function(){prepareMediaItemInit(b);updateMediaForm()})}}function prepareMediaItemInit(a){jQuery("#media-item-"+a.id+" .thumbnail").clone().attr("className","pinkynail toggle").prependTo("#media-item-"+a.id);jQuery("#media-item-"+a.id+" .filename.original").replaceWith(jQuery("#media-item-"+a.id+" .filename.new"));jQuery("#media-item-"+a.id+" a.toggle").bind("click",function(){jQuery(this).siblings(".slidetoggle").slideToggle(150,function(){var b=jQuery(this).offset();window.scrollTo(0,b.top-36)});jQuery(this).parent().eq(0).children(".toggle").toggle();jQuery(this).siblings("a.toggle").focus();return false});jQuery("#media-item-"+a.id+" a.delete").bind("click",function(){jQuery.ajax({url:"admin-ajax.php",type:"post",success:deleteSuccess,error:deleteError,id:a.id,data:{id:this.id.replace(/[^0-9]/g,""),action:"delete-post",_ajax_nonce:this.href.replace(/^.*wpnonce=/,"")}});return false});jQuery("#media-item-"+a.id+".startopen").removeClass("startopen").slideToggle(500).parent().eq(0).children(".toggle").toggle()}function itemAjaxError(c,b){var a=jQuery("#media-item-error"+c);a.html('<div class="file-error"><button type="button" id="dismiss-'+c+'" class="button dismiss">'+swfuploadL10n.dismiss+"</button>"+b+"</div>");jQuery("#dismiss-"+c).click(function(){jQuery(this).parents(".file-error").slideUp(200,function(){jQuery(this).empty()})})}function deleteSuccess(b,c){if(b=="-1"){return itemAjaxError(this.id,"You do not have permission. Has your session expired?")}if(b=="0"){return itemAjaxError(this.id,"Could not be deleted. Has it been deleted already?")}var a=jQuery("#media-item-"+this.id);if(type=jQuery("#type-of-"+this.id).val()){jQuery("#"+type+"-counter").text(jQuery("#"+type+"-counter").text()-1)}if(a.hasClass("child-of-"+post_id)){jQuery("#attachments-count").text(jQuery("#attachments-count").text()-1)}if(jQuery(".type-form #media-items>*").length==1&&jQuery("#media-items .hidden").length>0){jQuery(".toggle").toggle();jQuery(".slidetoggle").slideUp(200).siblings().removeClass("hidden")}jQuery("#media-item-"+this.id+" .filename:empty").remove();jQuery("#media-item-"+this.id+" .filename").append(' <span class="file-error">'+swfuploadL10n.deleted+"</span>").siblings("a.toggle").remove();jQuery("#media-item-"+this.id).children(".describe").css({backgroundColor:"#fff"}).end().animate({backgroundColor:"#ffc0c0"},{queue:false,duration:50}).animate({minHeight:0,height:36},400,null,function(){jQuery(this).children(".describe").remove()}).animate({backgroundColor:"#fff"},400).animate({height:0},800,null,function(){jQuery(this).remove();updateMediaForm()});return}function deleteError(c,b,a){}function updateMediaForm(){storeState();if(jQuery(".type-form #media-items>*").length==1){jQuery("#media-items .slidetoggle").slideDown(500).parent().eq(0).children(".toggle").toggle();jQuery(".type-form .slidetoggle").siblings().addClass("hidden")}if(jQuery("#media-items>*").not(".media-blank").length>0){jQuery(".savebutton").show()}else{jQuery(".savebutton").hide()}if(jQuery("#media-items>*").length>1){jQuery(".insert-gallery").show()}else{jQuery(".insert-gallery").hide()}}function uploadSuccess(b,a){if(a.match("media-upload-error")){jQuery("#media-item-"+b.id).html(a);return}prepareMediaItem(b,a);updateMediaForm();if(jQuery("#media-item-"+b.id).hasClass("child-of-"+post_id)){jQuery("#attachments-count").text(1*jQuery("#attachments-count").text()+1)}}function uploadComplete(a){if(swfu.getStats().files_queued==0){jQuery("#insert-gallery").attr("disabled","")}}function wpQueueError(a){jQuery("#media-upload-error").show().text(a)}function wpFileError(b,a){jQuery("#media-item-"+b.id+" .filename").after('<div class="file-error"><button type="button" id="dismiss-'+b.id+'" class="button dismiss">'+swfuploadL10n.dismiss+"</button>"+a+"</div>").siblings(".toggle").remove();jQuery("#dismiss-"+b.id).click(function(){jQuery(this).parents(".media-item").slideUp(200,function(){jQuery(this).remove()})})}function fileQueueError(c,a,b){if(a==SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED){wpQueueError(swfuploadL10n.queue_limit_exceeded)}else{if(a==SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT){fileQueued(c);wpFileError(c,swfuploadL10n.file_exceeds_size_limit)}else{if(a==SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE){fileQueued(c);wpFileError(c,swfuploadL10n.zero_byte_file)}else{if(a==SWFUpload.QUEUE_ERROR.INVALID_FILETYPE){fileQueued(c);wpFileError(c,swfuploadL10n.invalid_filetype)}else{wpQueueError(swfuploadL10n.default_error)}}}}}function fileDialogComplete(b){try{if(b>0){this.startUpload()}}catch(a){this.debug(a)}}function swfuploadPreLoad(){var a=jQuery("#"+swfu.customSettings.swfupload_element_id).get(0);jQuery("#"+swfu.customSettings.degraded_element_id).hide();if(a&&!a.style.display){a.style.display="block"}}function swfuploadLoadFailed(){jQuery("#"+swfu.customSettings.swfupload_element_id).hide();jQuery("#"+swfu.customSettings.degraded_element_id).show()}function uploadError(c,a,b){if(a==SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL){wpFileError(c,swfuploadL10n.missing_upload_url)}else{if(a==SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED){wpFileError(c,swfuploadL10n.upload_limit_exceeded)}else{wpFileError(c,swfuploadL10n.default_error)}}if(a==SWFUpload.UPLOAD_ERROR.HTTP_ERROR){wpQueueError(swfuploadL10n.http_error)}else{if(a==SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED){wpQueueError(swfuploadL10n.upload_failed)}else{if(a==SWFUpload.UPLOAD_ERROR.IO_ERROR){wpQueueError(swfuploadL10n.io_error)}else{if(a==SWFUpload.UPLOAD_ERROR.SECURITY_ERROR){wpQueueError(swfuploadL10n.security_error)}else{if(a==SWFUpload.UPLOAD_ERROR.FILE_CANCELLED){wpQueueError(swfuploadL10n.security_error)}}}}}}var storeState;(function(a){storeState=function(){var c=getUserSetting("align")||"",b=getUserSetting("imgsize")||"";a('tr.align input[type="radio"]').click(function(){setUserSetting("align",a(this).val())}).filter(function(){if(a(this).val()==c){return true}return false}).attr("checked","checked");a('tr.image-size input[type="radio"]').click(function(){setUserSetting("imgsize",a(this).val())}).filter(function(){if(a(this).attr("disabled")||a(this).val()!=b){return false}return true}).attr("checked","checked");a("tr.url button").click(function(){var d=this.className||"";d=d.replace(/.*?(url[^ '"]+).*/,"$1");if(d){setUserSetting("urlbutton",d)}a(this).siblings(".urlfield").val(a(this).attr("title"))});a("tr.url .urlfield").each(function(){var d=getUserSetting("urlbutton");a(this).val(a(this).siblings("button."+d).attr("title"))})}})(jQuery);function importUploadSuccess(b,a){if(a.match("media-upload-error")){jQuery("#media-item-"+b.id).html(a);return}jQuery("#media-item-"+b.id+" .progress").remove();jQuery("#media-item-"+b.id).append('<a href="'+document.location.href+"&step=1&action=save&attachment_id="+a+"&_wpnonce="+import_nonce+"&_wp_http_referer="+escape(document.location.href)+'" class="describe-toggle-on">'+swfuploadL10n.import_continue+"</a>");jQuery("#flash-upload-msg").remove()};
     2 No newline at end of file
  • wp-includes/script-loader.php

     
    117117                $scripts->add( 'swfupload-queue', false, array('swfupload') );
    118118        }
    119119
    120         $scripts->add( 'swfupload-handlers', "/wp-includes/js/swfupload/handlers$suffix.js", array('swfupload'), '2.2.0-20081201');
     120        $scripts->add( 'swfupload-handlers', "/wp-includes/js/swfupload/handlers$suffix.js", array('swfupload'), '2.2.0-20090109');
    121121        // these error messages came from the sample swfupload js, they might need changing.
    122122        $scripts->localize( 'swfupload-handlers', 'swfuploadL10n', array(
    123123                        'queue_limit_exceeded' => __('You have attempted to queue too many files.'),
     
    136136                        'dismiss' => __('Dismiss'),
    137137                        'crunching' => __('Crunching&hellip;'),
    138138                        'deleted' => __('Deleted'),
     139                        'import_continue' => __('Continue Import &raquo;'),
    139140                        'l10n_print_after' => 'try{convertEntities(swfuploadL10n);}catch(e){};'
    140141        ) );
    141142