View source
<?php
define('WORDPRESS_MIGRATE_ACCESS_MIGRATE', 'migrate wordpress blogs');
function wordpress_migrate_permission() {
return array(
WORDPRESS_MIGRATE_ACCESS_MIGRATE => array(
'title' => t('Migrate WordPress blogs into Drupal'),
),
);
}
function wordpress_migrate_stream_wrappers() {
$wrappers = array(
'wordpress' => array(
'name' => t('Uploaded wordpress files'),
'class' => 'WordpressMigrateStreamWrapper',
'description' => t('Uploaded WordPress WXR dumps for import - not to be seen by the world.'),
'type' => STREAM_WRAPPERS_LOCAL_HIDDEN,
),
);
return $wrappers;
}
function wordpress_migrate_mail($key, &$message, $params) {
$data['user'] = $params['account'];
$options['language'] = $message['language'];
$variables = array();
user_mail_tokens($variables, $data, $options);
$variables['!output'] = $params['output'];
$langcode = $message['language']->language;
$subject = variable_get('wordpress_migrate_notification_subject', '');
$message['subject'] = t($subject, $variables, array(
'langcode' => $langcode,
));
switch ($key) {
case 'import_complete':
$body = variable_get('wordpress_migrate_notification_body', '');
break;
case 'import_failure':
$body = variable_get('wordpress_migrate_notification_failure_body', '');
break;
}
$message['body'][] = t($body, $variables, array(
'langcode' => $langcode,
));
}
function wordpress_migrate_blog_class() {
return variable_get('wordpress_migrate_blog_class', 'WordPressBlog');
}
function wordpress_migrate_blog($filename, $arguments = array()) {
$blog_class = wordpress_migrate_blog_class();
return new $blog_class($filename, $arguments);
}