Make WordPress Core

Changeset 6086


Ignore:
Timestamp:
09/11/2007 10:27:36 PM (17 years ago)
Author:
ryan
Message:

Remove duplicate code from wp_insert_attachment(). Update to use sanitize_post. Props Otto42. fixes #4946

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/post.php

    r6026 r6086  
    12741274    global $wpdb, $user_ID;
    12751275
    1276     if ( is_object($object) )
    1277         $object = get_object_vars($object);
    1278 
    1279     // Export array as variables
     1276    $defaults = array('post_status' => 'draft', 'post_type' => 'post', 'post_author' => $user_ID,
     1277        'ping_status' => get_option('default_ping_status'), 'post_parent' => 0,
     1278        'menu_order' => 0, 'to_ping' =>  '', 'pinged' => '', 'post_password' => '');
     1279
     1280    $object = wp_parse_args($object, $defaults);
     1281    $object = sanitize_post($object, 'db');
     1282
     1283    // export array as variables
    12801284    extract($object, EXTR_SKIP);
    1281 
    1282     // Get the basics.
    1283     $post_content    = apply_filters('content_save_pre',   $post_content);
    1284     $post_content_filtered = apply_filters('content_filtered_save_pre',   $post_content_filtered);
    1285     $post_excerpt    = apply_filters('excerpt_save_pre',   $post_excerpt);
    1286     $post_title      = apply_filters('title_save_pre',     $post_title);
    1287     $post_category   = apply_filters('category_save_pre',  $post_category);
    1288     $post_name       = apply_filters('name_save_pre',      $post_name);
    1289     $comment_status  = apply_filters('comment_status_pre', $comment_status);
    1290     $ping_status     = apply_filters('ping_status_pre',    $ping_status);
    1291     $post_mime_type  = apply_filters('post_mime_type_pre', $post_mime_type);
    12921285
    12931286    // Make sure we set a valid category
     
    12951288        $post_category = array(get_option('default_category'));
    12961289    }
    1297     $post_cat = $post_category[0];
    12981290
    12991291    if ( empty($post_author) )
     
    13291321    }
    13301322
    1331     if (empty($post_date))
     1323    if ( empty($post_date) )
    13321324        $post_date = current_time('mysql');
    1333     if (empty($post_date_gmt))
     1325    if ( empty($post_date_gmt) )
    13341326        $post_date_gmt = current_time('mysql', 1);
    13351327
     
    13601352    if ( !isset($post_password) )
    13611353        $post_password = '';
    1362 
    1363     if ( isset($to_ping) )
    1364         $to_ping = preg_replace('|\s+|', "\n", $to_ping);
    1365     else
    1366         $to_ping = '';
    13671354
    13681355    if ( ! isset($pinged) )
Note: See TracChangeset for help on using the changeset viewer.