WordPress.org

Make WordPress Core


Ignore:
Timestamp:
07/11/2008 11:38:32 PM (13 years ago)
Author:
ryan
Message:

Press This: Switching to using our default content cleanup in the editor. Props azaozz. see #6813

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/press-this.php

    r8316 r8318  
    2121    $quick['post_content'] = '';
    2222
    23     $posted = str_replace('<br />', "\n", str_replace('<p>', '', $_REQUEST['content']));
    24     $posted = str_replace('</p>', "\n\n", $posted);
    25 
    2623    // insert the post with nothing in it, to get an ID
    2724    $post_ID = wp_insert_post($quick, true);
     
    3128        case 'text':
    3229        case 'quote':
    33             $content .= $posted;
     30            $content .= $_REQUEST['content'];
    3431            break;
    3532
    3633        case 'photo':
    37             $content = $posted;
     34            $content = $_REQUEST['content'];
    3835
    3936            foreach( (array) $_REQUEST['photo_src'] as $key => $image) {
     
    4239
    4340                // see if files exist in content - we don't want to upload non-used selected files.
    44                 if( strpos($posted, $quoted) !== false ) {
     41                if( strpos($_REQUEST['content'], $quoted) !== false ) {
    4542                    $upload = media_sideload_image($image, $post_ID, $_REQUEST['photo_description'][$key]);
    4643                    // Replace the POSTED content <img> with correct uploaded ones.
     
    5451            if($_REQUEST['embed_code'])
    5552                $content .= $_REQUEST['embed_code']."\n\n";
    56             $content .= $posted;
     53            $content .= $_REQUEST['content'];
    5754            break;
    5855        }
    5956    // set the post_content
    60     $quick['post_content'] = preg_replace("/\n\n+/", "\n\n", $content);
     57    $quick['post_content'] = $content;
    6158
    6259    // error handling for $post
     
    306303    wp_enqueue_style( 'colors' );
    307304    wp_enqueue_script('post');
     305    wp_enqueue_script('editor_functions');
    308306
    309307    do_action('admin_print_styles');
     
    349347                plugins : "safari,inlinepopups",
    350348                entities : "38,amp,60,lt,62,gt",
    351                 force_p_newlines : true
     349                force_p_newlines : true,
     350                save_callback : 'switchEditors.saveCallback'
    352351            });
    353352    <?php } ?>
Note: See TracChangeset for help on using the changeset viewer.