You are here

protected function WordPressCommentSource::populateRow in WordPress Migrate 7

Parse the values out of the wp:comment element.

Parameters

SimpleXMLElement $item:

Return value

boolean

File

./wordpress_comment.inc, line 49
Support for migrating comments from a WordPress blog into Drupal.

Class

WordPressCommentSource
Implementation of MigrateSource, to handle migrating comments from WordPress XML dumps.

Code

protected function populateRow($item) {

  // All the stuff we want is in the wp namespace
  $namespaces = $item
    ->getNameSpaces(TRUE);
  $item_ns = $item
    ->children($namespaces['wp']);
  foreach ($item_ns as $name => $value) {
    $this->currentRow->{$name} = (string) $value;
  }

  // Find the containing item
  $post_id = $this->xml
    ->xpath("//channel/item[wp:comment/wp:comment_id='" . $this->currentRow->comment_id . "']/wp:post_id");
  $this->currentRow->post_id = (string) $post_id[0];
  $this->currentKey = array(
    $this->currentRow->comment_id,
  );
  return TRUE;
}