Changeset 6125
- Timestamp:
- 09/18/2007 04:32:22 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-ajax.php
r5923 r6125 205 205 if ( $pid = wp_insert_post( array( 206 206 'post_title' => sprintf('Draft created on %s at %s', date(get_option('date_format'), $now), date(get_option('time_format'), $now)) 207 ) ) ) 207 ) ) ) { 208 if ( is_wp_error( $pid ) ) 209 return $pid; 208 210 $mid = add_meta( $pid ); 211 } 209 212 else 210 213 die('0'); -
trunk/wp-admin/import/blogger.php
r6043 r6125 381 381 $AtomParser = new AtomParser(); 382 382 $AtomParser->parse( $entry ); 383 $this->import_post($AtomParser->entry); 383 $result = $this->import_post($AtomParser->entry); 384 if ( is_wp_error( $result ) ) 385 return $result; 384 386 unset($AtomParser); 385 387 } … … 519 521 520 522 $post_id = wp_insert_post($post); 523 if ( is_wp_error( $post_id ) ) 524 return $post_id; 521 525 522 526 wp_create_categories( array_map( 'addslashes', $entry->categories ), $post_id ); … … 532 536 } 533 537 $this->save_vars(); 538 return; 534 539 } 535 540 … … 768 773 $blog = is_array($_REQUEST['blog']) ? array_shift( array_keys( $_REQUEST['blog'] ) ) : $_REQUEST['blog']; 769 774 $blog = (int) $blog; 770 $this->import_blog( $blog ); 775 $result = $this->import_blog( $blog ); 776 if ( is_wp_error( $result ) ) 777 echo $result->get_error_message(); 771 778 } elseif ( isset($_GET['token']) ) 772 779 $this->auth(); -
trunk/wp-admin/import/blogware.php
r5087 r6125 92 92 $postdata = compact('post_author', 'post_date', 'post_content', 'post_title', 'post_status'); 93 93 $post_id = wp_insert_post($postdata); 94 if ( is_wp_error( $post_id ) ) { 95 return $post_id; 96 } 94 97 if (!$post_id) { 95 98 _e("Couldn't get post ID"); … … 156 159 157 160 $this->file = $file['file']; 158 $this->import_posts(); 161 $result = $this->import_posts(); 162 if ( is_wp_error( $result ) ) 163 return $result; 159 164 wp_import_cleanup($file['id']); 160 165 … … 177 182 break; 178 183 case 1 : 179 $this->import(); 184 $result = $this->import(); 185 if ( is_wp_error( $result ) ) 186 $result->get_error_message(); 180 187 break; 181 188 } -
trunk/wp-admin/import/dotclear.php
r6026 r6125 365 365 'comment_count' => $post_nb_comment + $post_nb_trackback) 366 366 ); 367 if ( is_wp_error( $ret_id ) ) 368 return $ret_id; 367 369 } 368 370 else … … 383 385 'comment_count' => $post_nb_comment + $post_nb_trackback) 384 386 ); 387 if ( is_wp_error( $ret_id ) ) 388 return $ret_id; 385 389 } 386 390 $dcposts2wpposts[$post_id] = $ret_id; … … 563 567 // Post Import 564 568 $posts = $this->get_dc_posts(); 565 $this->posts2wp($posts); 569 $result = $this->posts2wp($posts); 570 if ( is_wp_error( $result ) ) 571 return $result; 566 572 567 573 echo '<form action="admin.php?import=dotclear&step=4" method="post">'; … … 711 717 break; 712 718 case 3 : 713 $this->import_posts(); 719 $result = $this->import_posts(); 720 if ( is_wp_error( $result ) ) 721 echo $result->get_error_message(); 714 722 break; 715 723 case 4 : -
trunk/wp-admin/import/greymatter.php
r5404 r6125 234 234 $postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_excerpt', 'post_status', 'comment_status', 'ping_status', 'post_modified', 'post_modified_gmt'); 235 235 $post_ID = wp_insert_post($postdata); 236 if ( is_wp_error( $post_ID ) ) 237 return $post_ID; 236 238 } 237 239 … … 288 290 <?php 289 291 $this->footer(); 292 return; 290 293 } 291 294 … … 302 305 case 1: 303 306 check_admin_referer('import-greymatter'); 304 $this->import(); 307 $result = $this->import(); 308 if ( is_wp_error( $result ) ) 309 echo $result->get_error_message(); 305 310 break; 306 311 } -
trunk/wp-admin/import/livejournal.php
r5404 r6125 72 72 $postdata = compact('post_author', 'post_date', 'post_content', 'post_title', 'post_status'); 73 73 $post_id = wp_insert_post($postdata); 74 if ( is_wp_error( $post_id ) ) 75 return $post_id; 74 76 if (!$post_id) { 75 77 _e("Couldn't get post ID"); … … 133 135 134 136 $this->file = $file['file']; 135 $this->import_posts(); 137 $result = $this->import_posts(); 138 if ( is_wp_error( $result ) ) 139 return $result; 136 140 wp_import_cleanup($file['id']); 137 141 … … 155 159 case 1 : 156 160 check_admin_referer('import-upload'); 157 $this->import(); 161 $result = $this->import(); 162 if ( is_wp_error( $result ) ) 163 echo $result->get_error_message(); 158 164 break; 159 165 } -
trunk/wp-admin/import/mt.php
r6101 r6125 216 216 $post->post_author = $this->checkauthor($post->post_author); //just so that if a post already exists, new users are not created by checkauthor 217 217 $post_id = wp_insert_post($post); 218 if ( is_wp_error( $post_id ) ) 219 return $post_id; 218 220 219 221 // Add categories. … … 292 294 // Finishing a post. 293 295 $context = ''; 294 $this->save_post($post, $comments, $pings); 296 $result = $this->save_post($post, $comments, $pings); 297 if ( is_wp_error( $result ) ) 298 return $result; 295 299 $post = new StdClass; 296 300 $comment = new StdClass(); … … 416 420 $this->file = get_attached_file($this->id); 417 421 $this->get_authors_from_post(); 418 $this->process_posts(); 422 $result = $this->process_posts(); 423 if ( is_wp_error( $result ) ) 424 return $result; 419 425 } 420 426 … … 435 441 case 2: 436 442 check_admin_referer('import-mt'); 437 $this->import(); 443 $result = $this->import(); 444 if ( is_wp_error( $result ) ) 445 echo $result->get_error_message(); 438 446 break; 439 447 } -
trunk/wp-admin/import/rss.php
r5404 r6125 111 111 } else { 112 112 $post_id = wp_insert_post($post); 113 if ( is_wp_error( $post_id ) ) 114 return $post_id; 113 115 if (!$post_id) { 114 116 _e("Couldn't get post ID"); … … 136 138 $this->file = $file['file']; 137 139 $this->get_posts(); 138 $this->import_posts(); 140 $result = $this->import_posts(); 141 if ( is_wp_error( $result ) ) 142 return $result; 139 143 wp_import_cleanup($file['id']); 140 144 … … 158 162 case 1 : 159 163 check_admin_referer('import-upload'); 160 $this->import(); 164 $result = $this->import(); 165 if ( is_wp_error( $result ) ) 166 echo $result->get_error_message(); 161 167 break; 162 168 } -
trunk/wp-admin/import/textpattern.php
r6026 r6125 306 306 'comment_count' => $comments_count) 307 307 ); 308 if ( is_wp_error( $ret_id ) ) 309 return $ret_id; 308 310 } 309 311 else … … 322 324 'comment_count' => $comments_count) 323 325 ); 326 if ( is_wp_error( $ret_id ) ) 327 return $ret_id; 324 328 } 325 329 $txpposts2wpposts[$ID] = $ret_id; … … 499 503 // Post Import 500 504 $posts = $this->get_txp_posts(); 501 $this->posts2wp($posts); 505 $result = $this->posts2wp($posts); 506 if ( is_wp_error( $result ) ) 507 return $result; 502 508 503 509 echo '<form action="admin.php?import=textpattern&step=4" method="post">'; … … 639 645 break; 640 646 case 3 : 641 $this->import_posts(); 647 $result = $this->import_posts(); 648 if ( is_wp_error( $result ) ) 649 echo $result->get_error_message(); 642 650 break; 643 651 case 4 : -
trunk/wp-admin/import/wordpress.php
r6026 r6125 251 251 echo '<ol>'; 252 252 253 foreach ($this->posts as $post) 254 $this->process_post($post); 253 foreach ($this->posts as $post) { 254 $result = $this->process_post($post); 255 if ( is_wp_error( $result ) ) 256 return $result; 257 } 255 258 256 259 echo '</ol>'; … … 304 307 $post_parent = (int) $post_parent; 305 308 if ($parent = $this->posts_processed[$post_parent]) { 306 if (!$parent[1]) $this->process_post($parent[0]); // If not yet, process the parent first. 309 if (!$parent[1]) { 310 $result = $this->process_post($parent[0]); // If not yet, process the parent first. 311 if ( is_wp_error( $result ) ) 312 return $result; 313 } 307 314 $post_parent = $parent[1]; // New ID of the parent; 308 315 } … … 315 322 $postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_excerpt', 'post_status', 'post_name', 'comment_status', 'ping_status', 'post_modified', 'post_modified_gmt', 'guid', 'post_parent', 'menu_order', 'post_type'); 316 323 $comment_post_ID = $post_id = wp_insert_post($postdata); 324 if ( is_wp_error( $post_id ) ) 325 return $post_id; 317 326 318 327 // Memorize old and new ID. … … 383 392 $this->get_entries(); 384 393 $this->process_categories(); 385 $this->process_posts(); 394 $result = $this->process_posts(); 395 if ( is_wp_error( $result ) ) 396 return $result; 386 397 } 387 398 … … 403 414 case 2: 404 415 check_admin_referer('import-wordpress'); 405 $this->import(); 416 $result = $this->import(); 417 if ( is_wp_error( $result ) ) 418 echo $result->get_error_message(); 406 419 break; 407 420 } -
trunk/wp-admin/includes/import.php
r5566 r6125 9 9 function register_importer( $id, $name, $description, $callback ) { 10 10 global $wp_importers; 11 11 if ( is_wp_error( $callback ) ) 12 return $callback; 12 13 $wp_importers[$id] = array ( $name, $description, $callback ); 13 14 } -
trunk/wp-admin/includes/post.php
r6026 r6125 285 285 // Create the post. 286 286 $post_ID = wp_insert_post( $_POST ); 287 if ( is_wp_error( $post_ID ) ) 288 return $post_ID; 287 289 288 290 if ( empty($post_ID) ) -
trunk/wp-admin/includes/upgrade.php
r6053 r6125 993 993 // Add the column list to the index create string 994 994 $index_string .= ' ('.$index_columns.')'; 995 995 error_log("Index string: $index_string", 0); 996 996 if(!(($aindex = array_search($index_string, $indices)) === false)) { 997 997 unset($indices[$aindex]); -
trunk/wp-admin/link-manager.php
r5906 r6125 160 160 foreach ($link->link_category as $category) { 161 161 $cat = get_term($category, 'link_category', OBJECT, 'display'); 162 if ( is_wp_error( $cat ) ) 163 echo $cat->get_error_message(); 162 164 $cat_name = $cat->name; 163 165 if ( $cat_id != $category ) -
trunk/wp-app.php
r6032 r6125 263 263 264 264 $postID = wp_insert_post($post_data); 265 if ( is_wp_error( $postID ) ) 266 $this->internal_error($postID->get_error_message()); 265 267 266 268 if (!$postID) { -
trunk/wp-includes/category-template.php
r6091 r6125 13 13 14 14 $category = get_category($cat_id); 15 if ( is_wp_error( $category ) ) 16 return $category; 15 17 if ( $category->parent == $id ) { 16 18 $chain .= $before.$category->term_id.$after; … … 30 32 } else { 31 33 $category = &get_category($category_id); 34 if ( is_wp_error( $category ) ) 35 return $category; 32 36 $category_nicename = $category->slug; 33 37 … … 44 48 $chain = ''; 45 49 $parent = &get_category($id); 50 if ( is_wp_error( $parent ) ) 51 return $parent; 46 52 47 53 if ( $nicename ) … … 99 105 $cat_ID = (int) $cat_ID; 100 106 $category = &get_category($cat_ID); 107 if ( is_wp_error( $category ) ) 108 return $category; 101 109 return $category->name; 102 110 } … … 314 322 315 323 $return = wp_generate_tag_cloud( $tags, $args ); // Here's where those top tags get sorted according to $args 316 echo apply_filters( 'wp_tag_cloud', $return, $args ); 324 if ( is_wp_error( $return ) ) 325 return false; 326 else 327 echo apply_filters( 'wp_tag_cloud', $return, $args ); 317 328 } 318 329 … … 335 346 $counts[$tag->name] = $tag->count; 336 347 $tag_links[$tag->name] = get_tag_link( $tag->term_id ); 348 if ( is_wp_error( $tag_links[$tag->name] ) ) 349 return $tag_links[$tag->name]; 337 350 $tag_ids[$tag->name] = $tag->term_id; 338 351 } … … 411 424 412 425 $tag = &get_term($tag_id, 'post_tag'); 426 if ( is_wp_error( $tag ) ) 427 return $tag; 413 428 $slug = $tag->slug; 414 429 … … 451 466 452 467 $tag_list = $before; 453 foreach ( $tags as $tag ) 454 $tag_links[] = '<a href="' . get_tag_link($tag->term_id) . '" rel="tag">' . $tag->name . '</a>'; 468 foreach ( $tags as $tag ) { 469 $link = get_tag_link($tag->term_id); 470 if ( is_wp_error( $link ) ) 471 return $link; 472 $tag_links[] = '<a href="' . $link . '" rel="tag">' . $tag->name . '</a>'; 473 } 455 474 456 475 $tag_links = join( $sep, $tag_links ); … … 464 483 465 484 function the_tags( $before = 'Tags: ', $sep = ', ', $after = '' ) { 466 echo get_the_tag_list($before, $sep, $after); 485 $return = get_the_tag_list($before, $sep, $after); 486 if ( is_wp_error( $return ) ) 487 return false; 488 else 489 echo $return; 467 490 } 468 491 -
trunk/wp-includes/category.php
r6071 r6125 31 31 function &get_category($category, $output = OBJECT, $filter = 'raw') { 32 32 $category = get_term($category, 'category', $output, $filter); 33 if ( is_wp_error( $category ) ) 34 return $category; 33 35 34 36 _make_cat_compat($category); … … 59 61 while ( ($curcategory->parent != 0) && ($curcategory->parent != $curcategory->term_id) ) { 60 62 $curcategory = get_term($curcategory->parent, 'category'); 63 if ( is_wp_error( $curcategory ) ) 64 return $curcategory; 61 65 $path = '/' . $curcategory->slug . $path; 62 66 } -
trunk/wp-includes/feed.php
r6114 r6125 13 13 function get_wp_title_rss($sep = '»') { 14 14 $title = wp_title($sep, false); 15 if ( is_wp_error( $title ) ) 16 return $title->get_error_message(); 15 17 $title = apply_filters('get_wp_title_rss', $title); 16 18 return $title; -
trunk/wp-includes/general-template.php
r6119 r6125 196 196 if ( !empty($tag) ) { 197 197 $tag = get_term($tag, 'post_tag', OBJECT, 'display'); 198 if ( is_wp_error( $tag ) ) 199 return $tag; 198 200 if ( ! empty($tag->name) ) 199 201 $title = apply_filters('single_tag_title', $tag->name); -
trunk/wp-includes/query.php
r6074 r6125 941 941 if ( !empty($q['category__not_in']) ) { 942 942 $ids = get_objects_in_term($q['category__not_in'], 'category'); 943 if ( is_wp_error( $ids ) ) 944 return $ids; 943 945 if ( is_array($ids) && count($ids > 0) ) { 944 946 $out_posts = "'" . implode("', '", $ids) . "'"; … … 1416 1418 $tag_id = $this->get('tag_id'); 1417 1419 $tag = &get_term($tag_id, 'post_tag'); 1420 if ( is_wp_error( $tag ) ) 1421 return $tag; 1418 1422 $this->queried_object = &$tag; 1419 1423 $this->queried_object_id = (int) $tag_id; -
trunk/wp-includes/taxonomy.php
r6121 r6125 392 392 $term = (int) $term; 393 393 $term = get_term( $term, $taxonomy ); 394 395 394 if ( is_wp_error($term) ) 396 395 return $term; … … 802 801 if ( is_taxonomy_hierarchical($taxonomy) ) { 803 802 $term_obj = get_term($term, $taxonomy); 803 if ( is_wp_error( $term_obj ) ) 804 return $term_obj; 804 805 $parent = $term_obj->parent; 805 806 … … 1253 1254 if ( !is_object($term) ) { 1254 1255 $term = get_term($term, $taxonomy); 1256 if ( is_wp_error( $term ) ) 1257 return $term; 1255 1258 $use_id = true; 1256 1259 } -
trunk/wp-mail.php
r6056 r6125 149 149 150 150 $post_ID = wp_insert_post($post_data); 151 if ( is_wp_error( $post_ID ) ) 152 echo "\n" . $post_ID->get_error_message(); 151 153 152 154 if (!$post_ID) { -
trunk/xmlrpc.php
r6026 r6125 801 801 802 802 $post_ID = wp_insert_post($post_data); 803 if ( is_wp_error( $post_ID ) ) 804 return new IXR_Error(500, $post_ID->get_error_message()); 803 805 804 806 if (!$post_ID) { … … 1089 1091 1090 1092 $post_ID = wp_insert_post($postdata); 1093 if ( is_wp_error( $post_ID ) ) 1094 return new IXR_Error(500, $post_ID->get_error_message()); 1091 1095 1092 1096 if (!$post_ID) {
Note: See TracChangeset
for help on using the changeset viewer.