summaryrefslogtreecommitdiffstats
path: root/wp-admin/import.php
blob: cd1951a31138df7133fe5dd1dc2612de4dc8dca5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
require_once ('admin.php');
$title = __('Import');
$parent_file = 'edit.php';
require_once ('admin-header.php');
?>

<div class="wrap">
<h2><?php _e('Import'); ?></h2>
<p><?php _e('If you have posts or comments in another system WordPress can import them into your current blog. To get started, choose a system to import from below:'); ?></p>

<?php

// Load all importers so that they can register.

$import_loc = 'wp-admin/import';
$import_root = ABSPATH.$import_loc;
$imports_dir = @ dir($import_root);
if ($imports_dir) {
	while (($file = $imports_dir->read()) !== false) {
		if (preg_match('|^\.+$|', $file))
			continue;
		if (preg_match('|\.php$|', $file))
			require_once("$import_root/$file");
	}
}

$importers = get_importers();

if (empty ($importers)) {
	echo '<p>'.__('No importers are available.').'</p>'; // TODO: make more helpful

} else {
?>
<table class="widefat">

<?php
	$style = '';
	foreach ($importers as $id => $data) {
		$style = ('class="alternate"' == $style || 'class="alternate active"' == $style) ? '' : 'alternate';
		$action = "<a href='admin.php?import=$id' title='{$data[1]}'>{$data[0]}</a>";

		if ($style != '')
			$style = 'class="'.$style.'"';
		echo "

			<tr $style>

				<td class='import-system'>$action</td>

				<td class='desc'>{$data[1]}</td>

			</tr>";
	}
?>

</table>
<?php
}
?>

</div>

<?php

include ('admin-footer.php');
?>