]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-admin/import.php
Wordpress 2.8.4-scripts
[autoinstalls/wordpress.git] / wp-admin / import.php
1 <?php
2 /**
3  * Import WordPress Administration Panel
4  *
5  * @package WordPress
6  * @subpackage Administration
7  */
8
9 /** Load WordPress Bootstrap */
10 require_once ('admin.php');
11
12 if ( !current_user_can('edit_files') )
13         wp_die(__('You do not have sufficient permissions to import content in this blog.'));
14
15 $title = __('Import');
16 require_once ('admin-header.php');
17 $parent_file = 'tools.php';
18 ?>
19
20 <div class="wrap">
21 <?php screen_icon(); ?>
22 <h2><?php echo esc_html( $title ); ?></h2>
23 <p><?php _e('If you have posts or comments in another system, WordPress can import those into this blog. To get started, choose a system to import from below:'); ?></p>
24
25 <?php
26
27 // Load all importers so that they can register.
28 $import_loc = 'wp-admin/import';
29 $import_root = ABSPATH.$import_loc;
30 $imports_dir = @ opendir($import_root);
31 if ($imports_dir) {
32         while (($file = readdir($imports_dir)) !== false) {
33                 if ($file{0} == '.') {
34                         continue;
35                 } elseif (substr($file, -4) == '.php') {
36                         require_once($import_root . '/' . $file);
37                 }
38         }
39 }
40 @closedir($imports_dir);
41
42 $importers = get_importers();
43
44 if (empty ($importers)) {
45         echo '<p>'.__('No importers are available.').'</p>'; // TODO: make more helpful
46 } else {
47 ?>
48 <table class="widefat" cellspacing="0">
49
50 <?php
51         $style = '';
52         foreach ($importers as $id => $data) {
53                 $style = ('class="alternate"' == $style || 'class="alternate active"' == $style) ? '' : 'alternate';
54                 $action = "<a href='admin.php?import=$id' title='".wptexturize(strip_tags($data[1]))."'>{$data[0]}</a>";
55
56                 if ($style != '')
57                         $style = 'class="'.$style.'"';
58                 echo "
59                         <tr $style>
60                                 <td class='import-system row-title'>$action</td>
61                                 <td class='desc'>{$data[1]}</td>
62                         </tr>";
63         }
64 ?>
65
66 </table>
67 <?php
68 }
69 ?>
70
71 </div>
72
73 <?php
74
75 include ('admin-footer.php');
76 ?>
77