Ticket #10665: 10665.diff
| File 10665.diff, 7.2 KB (added by , 15 years ago) |
|---|
-
wp-includes/class-wp-xmlrpc-server.php
1251 1251 1252 1252 $comment['comment_parent'] = isset($content_struct['comment_parent']) ? absint($content_struct['comment_parent']) : 0; 1253 1253 1254 $comment['comment_content'] = $content_struct['content'];1254 $comment['comment_content'] = isset($content_struct['content']) ? $content_struct['content'] : null; 1255 1255 1256 1256 do_action('xmlrpc_call', 'wp.newComment'); 1257 1257 … … 1488 1488 * 1489 1489 * @since 3.1.0 1490 1490 * 1491 * @param array $args Method parameters. Contains: 1491 * @param array $args Method parameters. Contains: 1492 1492 * - blog_id 1493 1493 * - username 1494 1494 * - password 1495 1495 * - attachment_id 1496 * @return array. Assocciative array containing: 1496 * @return array. Assocciative array containing: 1497 1497 * - 'date_created_gmt' 1498 1498 * - 'parent' 1499 1499 * - 'link' … … 1545 1545 1546 1546 /** 1547 1547 * Retrieves a collection of media library items (or attachments) 1548 * 1549 * Besides the common blog_id, username, and password arguments, it takes a filter 1548 * 1549 * Besides the common blog_id, username, and password arguments, it takes a filter 1550 1550 * array as last argument. 1551 * 1551 * 1552 1552 * Accepted 'filter' keys are 'parent_id', 'mime_type', 'offset', and 'number'. 1553 * 1553 * 1554 1554 * The defaults are as follows: 1555 1555 * - 'number' - Default is 5. Total number of media items to retrieve. 1556 1556 * - 'offset' - Default is 0. See {@link WP_Query::query()} for more. 1557 1557 * - 'parent_id' - Default is ''. The post where the media item is attached. Empty string shows all media items. 0 shows unattached media items. 1558 1558 * - 'mime_type' - Default is ''. Filter by mime type (e.g., 'image/jpeg', 'application/pdf') 1559 * 1559 * 1560 1560 * @since 3.1.0 1561 1561 * 1562 1562 * @param array $args Method parameters. Contains: … … 1587 1587 $mime_type = ( isset($struct['mime_type']) ) ? $struct['mime_type'] : '' ; 1588 1588 $offset = ( isset($struct['offset']) ) ? absint($struct['offset']) : 0 ; 1589 1589 $number = ( isset($struct['number']) ) ? absint($struct['number']) : -1 ; 1590 1590 1591 1591 $attachments = get_posts( array('post_type' => 'attachment', 'post_parent' => $parent_id, 'offset' => $offset, 'numberposts' => $number, 'post_mime_type' => $mime_type ) ); 1592 1592 $num_attachments = count($attachments); 1593 1593 … … 2117 2117 $post_author = $content_struct["wp_author_id"]; 2118 2118 } 2119 2119 2120 $post_title = $content_struct['title'];2121 $post_content = $content_struct['description'];2120 $post_title = isset( $content_struct['title'] ) ? $content_struct['title'] : null; 2121 $post_content = isset( $content_struct['description'] ) ? $content_struct['description'] : null; 2122 2122 2123 2123 $post_status = $publish ? 'publish' : 'draft'; 2124 2124 … … 2140 2140 } 2141 2141 } 2142 2142 2143 $post_excerpt = $content_struct['mt_excerpt'];2144 $post_more = $content_struct['mt_text_more'];2143 $post_excerpt = isset($content_struct['mt_excerpt']) ? $content_struct['mt_excerpt'] : null; 2144 $post_more = isset($content_struct['mt_text_more']) ? $content_struct['mt_text_more'] : null; 2145 2145 2146 $tags_input = $content_struct['mt_keywords'];2146 $tags_input = isset($content_struct['mt_keywords']) ? $content_struct['mt_keywords'] : null; 2147 2147 2148 2148 if ( isset($content_struct["mt_allow_comments"]) ) { 2149 2149 if ( !is_numeric($content_struct["mt_allow_comments"]) ) { … … 2209 2209 if ( $post_more ) 2210 2210 $post_content = $post_content . "<!--more-->" . $post_more; 2211 2211 2212 $to_ping = $content_struct['mt_tb_ping_urls']; 2213 if ( is_array($to_ping) ) 2214 $to_ping = implode(' ', $to_ping); 2212 $to_ping = null; 2213 if( isset( $content_struct['mt_tb_ping_urls'] ) ) { 2214 $to_ping = $content_struct['mt_tb_ping_urls']; 2215 if ( is_array($to_ping) ) 2216 $to_ping = implode(' ', $to_ping); 2217 } 2215 2218 2216 2219 // Do some timestamp voodoo 2217 2220 if ( !empty( $content_struct['date_created_gmt'] ) ) … … 2227 2230 $post_date_gmt = current_time('mysql', 1); 2228 2231 } 2229 2232 2230 $catnames = $content_struct['categories'];2231 logIO('O', 'Post cats: ' . var_export($catnames,true));2232 2233 $post_category = array(); 2234 if( isset( $content_struct['categories'] ) ) { 2235 $catnames = $content_struct['categories']; 2236 logIO('O', 'Post cats: ' . var_export($catnames,true)); 2233 2237 2234 if ( is_array($catnames) ) { 2235 foreach ($catnames as $cat) { 2236 $post_category[] = get_cat_ID($cat); 2238 if ( is_array($catnames) ) { 2239 foreach ($catnames as $cat) { 2240 $post_category[] = get_cat_ID($cat); 2241 } 2237 2242 } 2238 2243 } 2239 2244 … … 2259 2264 $this->set_custom_fields($post_ID, $content_struct['custom_fields']); 2260 2265 2261 2266 // Handle enclosures 2262 $this->add_enclosure_if_new($post_ID, $content_struct['enclosure']); 2267 $thisEnclosure = isset($content_struct['enclosure']) ? $content_struct['enclosure'] : null; 2268 $this->add_enclosure_if_new($post_ID, $thisEnclosure); 2263 2269 2264 2270 $this->attach_uploads( $post_ID, $post_content ); 2265 2271 … … 2459 2465 } 2460 2466 } 2461 2467 2462 $post_title = $content_struct['title']; 2463 $post_content = $content_struct['description']; 2464 $catnames = $content_struct['categories']; 2468 $post_title = isset( $content_struct['title'] ) ? $content_struct['title'] : null; 2469 $post_content = isset( $content_struct['description'] ) ? $content_struct['description'] : null; 2465 2470 2466 2471 $post_category = array(); 2467 2468 if ( is_array($catnames) ) { 2469 foreach ($catnames as $cat) { 2470 $post_category[] = get_cat_ID($cat); 2472 if( isset( $content_struct['categories'] ) ) { 2473 $catnames = $content_struct['categories']; 2474 if ( is_array($catnames) ) { 2475 foreach ($catnames as $cat) { 2476 $post_category[] = get_cat_ID($cat); 2477 } 2471 2478 } 2472 2479 } 2473 2480 2474 $post_excerpt = $content_struct['mt_excerpt'];2475 $post_more = $content_struct['mt_text_more'];2481 $post_excerpt = isset( $content_struct['mt_excerpt'] ) ? $content_struct['mt_excerpt'] : null; 2482 $post_more = isset( $content_struct['mt_text_more'] ) ? $content_struct['mt_text_more'] : null; 2476 2483 2477 2484 $post_status = $publish ? 'publish' : 'draft'; 2478 2485 if ( isset( $content_struct["{$post_type}_status"] ) ) { … … 2493 2500 } 2494 2501 } 2495 2502 2496 $tags_input = $content_struct['mt_keywords'];2503 $tags_input = isset( $content_struct['mt_keywords'] ) ? $content_struct['mt_keywords'] : null; 2497 2504 2498 2505 if ( ('publish' == $post_status) ) { 2499 2506 if ( ( 'page' == $post_type ) && !current_user_can('publish_pages') ) … … 2505 2512 if ( $post_more ) 2506 2513 $post_content = $post_content . "<!--more-->" . $post_more; 2507 2514 2508 $to_ping = $content_struct['mt_tb_ping_urls']; 2509 if ( is_array($to_ping) ) 2510 $to_ping = implode(' ', $to_ping); 2515 $to_ping = null; 2516 if( isset( $content_struct['mt_tb_ping_urls'] ) ) { 2517 $to_ping = $content_struct['mt_tb_ping_urls']; 2518 if ( is_array($to_ping) ) 2519 $to_ping = implode(' ', $to_ping); 2520 } 2511 2521 2512 2522 // Do some timestamp voodoo 2513 2523 if ( !empty( $content_struct['date_created_gmt'] ) ) … … 2545 2555 $this->set_custom_fields($post_ID, $content_struct['custom_fields']); 2546 2556 2547 2557 // Handle enclosures 2548 $this->add_enclosure_if_new($post_ID, $content_struct['enclosure']); 2558 $thisEnclosure = isset($content_struct['enclosure']) ? $content_struct['enclosure'] : null; 2559 $this->add_enclosure_if_new($post_ID, $thisEnclosure); 2549 2560 2550 2561 $this->attach_uploads( $ID, $post_content ); 2551 2562 … … 3399 3410 return $pingbacks; 3400 3411 } 3401 3412 } 3402 ?> 3403 No newline at end of file 3413 ?>