| 511 | | if ( $comments) { foreach ($comments as $comment) { |
| 512 | | $comment_author = $this->get_tag( $comment, 'wp:comment_author'); |
| 513 | | $comment_author_email = $this->get_tag( $comment, 'wp:comment_author_email'); |
| 514 | | $comment_author_IP = $this->get_tag( $comment, 'wp:comment_author_IP'); |
| 515 | | $comment_author_url = $this->get_tag( $comment, 'wp:comment_author_url'); |
| 516 | | $comment_date = $this->get_tag( $comment, 'wp:comment_date'); |
| 517 | | $comment_date_gmt = $this->get_tag( $comment, 'wp:comment_date_gmt'); |
| 518 | | $comment_content = $this->get_tag( $comment, 'wp:comment_content'); |
| 519 | | $comment_approved = $this->get_tag( $comment, 'wp:comment_approved'); |
| 520 | | $comment_type = $this->get_tag( $comment, 'wp:comment_type'); |
| 521 | | $comment_parent = $this->get_tag( $comment, 'wp:comment_parent'); |
| 522 | | |
| 523 | | // if this is a new post we can skip the comment_exists() check |
| 524 | | if ( !$post_exists || !comment_exists($comment_author, $comment_date) ) { |
| 525 | | $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_url', 'comment_author_email', 'comment_author_IP', 'comment_date', 'comment_date_gmt', 'comment_content', 'comment_approved', 'comment_type', 'comment_parent'); |
| 526 | | wp_insert_comment($commentdata); |
| 527 | | $num_comments++; |
| | 511 | $inserted_comments = array(); |
| | 512 | if ( $comments) { |
| | 513 | foreach ($comments as $comment) { |
| | 514 | $comment_id = $this->get_tag( $comment, 'wp:comment_id'); |
| | 515 | $newcomments[$comment_id]['comment_post_ID'] = $comment_post_ID; |
| | 516 | $newcomments[$comment_id]['comment_author'] = $this->get_tag( $comment, 'wp:comment_author'); |
| | 517 | $newcomments[$comment_id]['comment_author_email'] = $this->get_tag( $comment, 'wp:comment_author_email'); |
| | 518 | $newcomments[$comment_id]['comment_author_IP'] = $this->get_tag( $comment, 'wp:comment_author_IP'); |
| | 519 | $newcomments[$comment_id]['comment_author_url'] = $this->get_tag( $comment, 'wp:comment_author_url'); |
| | 520 | $newcomments[$comment_id]['comment_date'] = $this->get_tag( $comment, 'wp:comment_date'); |
| | 521 | $newcomments[$comment_id]['comment_date_gmt'] = $this->get_tag( $comment, 'wp:comment_date_gmt'); |
| | 522 | $newcomments[$comment_id]['comment_content'] = $this->get_tag( $comment, 'wp:comment_content'); |
| | 523 | $newcomments[$comment_id]['comment_approved'] = $this->get_tag( $comment, 'wp:comment_approved'); |
| | 524 | $newcomments[$comment_id]['comment_type'] = $this->get_tag( $comment, 'wp:comment_type'); |
| | 525 | $newcomments[$comment_id]['comment_parent'] = $this->get_tag( $comment, 'wp:comment_parent'); |