Make WordPress Core

Changeset 16824


Ignore:
Timestamp:
12/08/2010 10:00:40 PM (16 years ago)
Author:
markjaquith
Message:

Work around some unset variable notices in xmlrpc.php. props redsweater. props sorich87. fixes #10665

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/class-wp-xmlrpc-server.php

    r16802 r16824  
    12591259                $comment['comment_parent'] = isset($content_struct['comment_parent']) ? absint($content_struct['comment_parent']) : 0;
    12601260
    1261                 $comment['comment_content'] = $content_struct['content'];
     1261                $comment['comment_content'] =  isset($content_struct['content']) ? $content_struct['content'] : null;
    12621262
    12631263                do_action('xmlrpc_call', 'wp.newComment');
     
    21802180                }
    21812181
    2182                 $post_title = $content_struct['title'];
    2183                 $post_content = $content_struct['description'];
     2182                $post_title = isset( $content_struct['title'] ) ? $content_struct['title'] : null;
     2183                $post_content = isset( $content_struct['description'] ) ? $content_struct['description'] : null;
    21842184
    21852185                $post_status = $publish ? 'publish' : 'draft';
     
    22032203                }
    22042204
    2205                 $post_excerpt = $content_struct['mt_excerpt'];
    2206                 $post_more = $content_struct['mt_text_more'];
    2207 
    2208                 $tags_input = $content_struct['mt_keywords'];
     2205                $post_excerpt = isset($content_struct['mt_excerpt']) ? $content_struct['mt_excerpt'] : null;
     2206                $post_more = isset($content_struct['mt_text_more']) ? $content_struct['mt_text_more'] : null;
     2207
     2208                $tags_input = isset($content_struct['mt_keywords']) ? $content_struct['mt_keywords'] : null;
    22092209
    22102210                if ( isset($content_struct["mt_allow_comments"]) ) {
     
    22722272                        $post_content = $post_content . "<!--more-->" . $post_more;
    22732273
    2274                 $to_ping = $content_struct['mt_tb_ping_urls'];
    2275                 if ( is_array($to_ping) )
    2276                         $to_ping = implode(' ', $to_ping);
     2274                $to_ping = null;
     2275                if ( isset( $content_struct['mt_tb_ping_urls'] ) ) {
     2276                        $to_ping = $content_struct['mt_tb_ping_urls'];
     2277                        if ( is_array($to_ping) )
     2278                                $to_ping = implode(' ', $to_ping);
     2279                }
    22772280
    22782281                // Do some timestamp voodoo
     
    22902293                }
    22912294
    2292                 $catnames = $content_struct['categories'];
    2293                 logIO('O', 'Post cats: ' . var_export($catnames,true));
    22942295                $post_category = array();
    2295 
    2296                 if ( is_array($catnames) ) {
    2297                         foreach ($catnames as $cat) {
    2298                                 $post_category[] = get_cat_ID($cat);
     2296                if ( isset( $content_struct['categories'] ) ) {
     2297                        $catnames = $content_struct['categories'];
     2298                        logIO('O', 'Post cats: ' . var_export($catnames,true));
     2299
     2300                        if ( is_array($catnames) ) {
     2301                                foreach ($catnames as $cat) {
     2302                                        $post_category[] = get_cat_ID($cat);
     2303                                }
    22992304                        }
    23002305                }
     
    23222327
    23232328                // Handle enclosures
    2324                 $this->add_enclosure_if_new($post_ID, $content_struct['enclosure']);
     2329                $thisEnclosure = isset($content_struct['enclosure']) ? $content_struct['enclosure'] : null;
     2330                $this->add_enclosure_if_new($post_ID, $thisEnclosure);
    23252331
    23262332                $this->attach_uploads( $post_ID, $post_content );
     
    25502556                }
    25512557
    2552                 $post_title = $content_struct['title'];
    2553                 $post_content = $content_struct['description'];
    2554                 $catnames = $content_struct['categories'];
     2558                $post_title = isset( $content_struct['title'] ) ? $content_struct['title'] : null;
     2559                $post_content = isset( $content_struct['description'] ) ? $content_struct['description'] : null;
    25552560
    25562561                $post_category = array();
    2557 
    2558                 if ( is_array($catnames) ) {
    2559                         foreach ($catnames as $cat) {
    2560                                 $post_category[] = get_cat_ID($cat);
     2562                if ( isset( $content_struct['categories'] ) ) {
     2563                        $catnames = $content_struct['categories'];
     2564                        if ( is_array($catnames) ) {
     2565                                foreach ($catnames as $cat) {
     2566                                        $post_category[] = get_cat_ID($cat);
     2567                                }
    25612568                        }
    25622569                }
    25632570
    2564                 $post_excerpt = $content_struct['mt_excerpt'];
    2565                 $post_more = $content_struct['mt_text_more'];
     2571                $post_excerpt = isset( $content_struct['mt_excerpt'] ) ? $content_struct['mt_excerpt'] : null;
     2572                $post_more = isset( $content_struct['mt_text_more'] ) ? $content_struct['mt_text_more'] : null;
    25662573
    25672574                $post_status = $publish ? 'publish' : 'draft';
     
    25842591                }
    25852592
    2586                 $tags_input = $content_struct['mt_keywords'];
     2593                $tags_input = isset( $content_struct['mt_keywords'] ) ? $content_struct['mt_keywords'] : null;
    25872594
    25882595                if ( ('publish' == $post_status) ) {
     
    25962603                        $post_content = $post_content . "<!--more-->" . $post_more;
    25972604
    2598                 $to_ping = $content_struct['mt_tb_ping_urls'];
    2599                 if ( is_array($to_ping) )
    2600                         $to_ping = implode(' ', $to_ping);
     2605                $to_ping = null;
     2606                if ( isset( $content_struct['mt_tb_ping_urls'] ) ) {
     2607                        $to_ping = $content_struct['mt_tb_ping_urls'];
     2608                        if ( is_array($to_ping) )
     2609                                $to_ping = implode(' ', $to_ping);
     2610                }
    26012611
    26022612                // Do some timestamp voodoo
     
    26362646
    26372647                // Handle enclosures
    2638                 $this->add_enclosure_if_new($post_ID, $content_struct['enclosure']);
     2648                $thisEnclosure = isset($content_struct['enclosure']) ? $content_struct['enclosure'] : null;
     2649                $this->add_enclosure_if_new($post_ID, $thisEnclosure);
    26392650
    26402651                $this->attach_uploads( $ID, $post_content );
Note: See TracChangeset for help on using the changeset viewer.