You are here

public function WordPressSource::__construct in WordPress Migrate 7

Simple initialization.

Overrides MigrateSource::__construct

4 calls to WordPressSource::__construct()
WordPressCategorySource::__construct in ./wordpress_category.inc
Simple initialization.
WordPressCommentSource::__construct in ./wordpress_comment.inc
Simple initialization.
WordPressItemSource::__construct in ./wordpress_item.inc
Simple initialization.
WordPressTagSource::__construct in ./wordpress_tag.inc
Simple initialization.
4 methods override WordPressSource::__construct()
WordPressCategorySource::__construct in ./wordpress_category.inc
Simple initialization.
WordPressCommentSource::__construct in ./wordpress_comment.inc
Simple initialization.
WordPressItemSource::__construct in ./wordpress_item.inc
Simple initialization.
WordPressTagSource::__construct in ./wordpress_tag.inc
Simple initialization.

File

./wordpress_source.inc, line 71
Common source support for migration from WordPress XML dumps.

Class

WordPressSource
@file Common source support for migration from WordPress XML dumps.

Code

public function __construct($filename) {
  parent::__construct();
  $this->filename = $filename;

  // Suppress errors during parsing, so we can pick them up after
  libxml_use_internal_errors(TRUE);
  $this->xml = simplexml_load_file($this->filename);
  if ($this->xml) {
    $base_blog_url = $this->xml
      ->xpath('//channel/wp:base_blog_url');
    $this->baseBlogUrl = (string) $base_blog_url[0];
  }
  else {
    $message = '';
    foreach (libxml_get_errors() as $error) {
      $message .= $error->message . "\n";
    }
    throw new Exception($message);
  }
}