Make WordPress Core

Changeset 5089


Ignore:
Timestamp:
03/23/2007 02:05:29 AM (20 years ago)
Author:
matt
Message:

Ryan slays the dragon. (Some of these return WP_Error objects.)

Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/app.php

    r5087 r5089  
    431431                log_app('Inserting Post. Data:', print_r($post_data,true));
    432432
    433                 $postID = (int) wp_insert_post($post_data);
     433                $postID = wp_insert_post($post_data);
    434434
    435435                if (!$postID) {
    … …  
    583583
    584584                // Save the data
    585                 $postID = (int) wp_insert_attachment($attachment, $file, $post);
     585                $postID = wp_insert_attachment($attachment, $file, $post);
    586586
    587587                if (!$postID) {
  • trunk/wp-admin/admin-ajax.php

    r5087 r5089  
    116116                if ( !$category_nicename = sanitize_title($cat_name) )
    117117                        die('0');
    118                 if ( !$cat_id = (int) category_exists( $cat_name ) )
    119                         $cat_id = (int) wp_create_category( $cat_name );
     118                if ( !$cat_id = category_exists( $cat_name ) )
     119                        $cat_id = wp_create_category( $cat_name );
    120120                $cat_name = wp_specialchars(stripslashes($cat_name));
    121121                $x->add( array(
    … …  
    157157        if ( $id < 0 ) {
    158158                $now = current_time('timestamp', 1);
    159                 if ( $pid = (int) wp_insert_post( array(
     159                if ( $pid = wp_insert_post( array(
    160160                        'post_title' => sprintf('Draft created on %s at %s', date(get_option('date_format'), $now), date(get_option('time_format'), $now))
    161161                ) ) )
    162                         $mid = (int) add_meta( $pid );
     162                        $mid = add_meta( $pid );
    163163                else
    164164                        die('0');
    165         } else if ( !$mid = (int) add_meta( $id ) ) {
     165        } else if ( !$mid = add_meta( $id ) ) {
    166166                die('0');
    167167        }
    … …  
    205205                die('-1');
    206206        require_once(ABSPATH . WPINC . '/registration.php');
    207         if ( !$user_id = (int) add_user() )
     207        if ( !$user_id = add_user() )
    208208                die('0');
    209209        elseif ( is_wp_error( $user_id ) ) {
    … …  
    231231        if($_POST['post_ID'] < 0) {
    232232                $_POST['temp_ID'] = $_POST['post_ID'];
    233                 $id = (int) wp_write_post();
    234                 if(is_wp_error($id))
     233                $id = wp_write_post();
     234                if( is_wp_error($id) )
    235235                        die($id->get_error_message());
    236236                else
  • trunk/wp-admin/admin-functions.php

    r5087 r5089  
    563563
    564564        if ( $update ) {
    565                 $user_id = (int) wp_update_user( get_object_vars( $user ));
    566         } else {
    567                 $user_id = (int) wp_insert_user( get_object_vars( $user ));
     565                $user_id = wp_update_user( get_object_vars( $user ));
     566        } else {
     567                $user_id = wp_insert_user( get_object_vars( $user ));
    568568                wp_new_user_notification( $user_id );
    569569        }
    … …  
    19701970
    19711971        // Save the data
    1972         $id = (int) wp_insert_attachment( $object, $file );
     1972        $id = wp_insert_attachment( $object, $file );
    19731973
    19741974        return array( 'file' => $file, 'id' => $id );
  • trunk/wp-admin/custom-header.php

    r5087 r5089  
    216216
    217217                // Save the data
    218                 $id = (int) wp_insert_attachment($object, $file);
     218                $id = wp_insert_attachment($object, $file);
    219219
    220220                $upload = array('file' => $file, 'id' => $id);
  • trunk/wp-admin/import/wordpress.php

    r5087 r5089  
    202202                                $category_parent = '0';
    203203                        else
    204                                 $category_parent = (int) category_exists($parent);
     204                                $category_parent = category_exists($parent);
    205205
    206206                        $catarr = compact('category_nicename', 'category_parent', 'posts_private', 'links_private', 'posts_private', 'cat_name');
  • trunk/wp-comments-post.php

    r5087 r5089  
    5555$commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'user_ID');
    5656
    57 $comment_id = (int) wp_new_comment( $commentdata );
     57$comment_id = wp_new_comment( $commentdata );
    5858
    5959$comment = get_comment($comment_id);
  • trunk/wp-includes/comment.php

    r5087 r5089  
    393393        $commentdata['comment_approved'] = wp_allow_comment($commentdata);
    394394
    395         $comment_ID = (int) wp_insert_comment($commentdata);
     395        $comment_ID = wp_insert_comment($commentdata);
    396396
    397397        do_action('comment_post', $comment_ID, $commentdata['comment_approved']);
  • trunk/wp-login.php

    r5087 r5089  
    243243                        $user_pass = substr( md5( uniqid( microtime() ) ), 0, 7);
    244244
    245                         $user_id = (int) wp_create_user( $user_login, $user_pass, $user_email );
     245                        $user_id = wp_create_user( $user_login, $user_pass, $user_email );
    246246                        if ( !$user_id )
    247247                                $errors['registerfail'] = sprintf(__('<strong>ERROR</strong>: Couldn&#8217;t register you... please contact the <a href="mailto:%s">webmaster</a> !'), get_option('admin_email'));
  • trunk/wp-mail.php

    r5087 r5089  
    137137        $post_data = add_magic_quotes($post_data);
    138138
    139         $post_ID = (int) wp_insert_post($post_data);
     139        $post_ID = wp_insert_post($post_data);
    140140
    141141        if (!$post_ID) {
  • trunk/xmlrpc.php

    r5087 r5089  
    513513                );
    514514
    515                 $cat_id = (int) wp_insert_category($new_category);
     515                $cat_id = wp_insert_category($new_category);
    516516                if(!$cat_id) {
    517517                        return(new IXR_Error(500, "Sorry, the new category failed."));
    … …  
    803803          $post_data = compact('blog_ID', 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status');
    804804
    805           $post_ID = (int) wp_insert_post($post_data);
     805          $post_ID = wp_insert_post($post_data);
    806806
    807807          if (!$post_ID) {
    … …  
    10311031          $postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'to_ping', 'post_type', 'post_name', 'post_password', 'post_parent', 'menu_order');
    10321032
    1033           $post_ID = (int) wp_insert_post($postdata);
     1033          $post_ID = wp_insert_post($postdata);
    10341034
    10351035          if (!$post_ID) {
    … …  
    14481448
    14491449                // Save the data
    1450                 $id = (int) wp_insert_attachment( $attachment, $upload[ 'file' ], $post_id );
     1450                $id = wp_insert_attachment( $attachment, $upload[ 'file' ], $post_id );
    14511451                wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $upload['file'] ) );
    14521452
    … …  
    18381838                $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_url', 'comment_content', 'comment_type');
    18391839
    1840                 $comment_ID = (int) wp_new_comment($commentdata);
     1840                $comment_ID = wp_new_comment($commentdata);
    18411841                do_action('pingback_post', $comment_ID);
    18421842
    … …  
    18561856                $url = $args;
    18571857
    1858                 $post_ID = (int) url_to_postid($url);
     1858                $post_ID = url_to_postid($url);
    18591859                if (!$post_ID) {
    18601860                        // We aren't sure that the resource is available and/or pingback enabled
Note: See TracChangeset for help on using the changeset viewer.