Ticket #13465: 13465.diff
| File 13465.diff, 3.7 KB (added by , 16 years ago) |
|---|
-
wp-admin/admin.php
14 14 if ( !defined('WP_ADMIN') ) 15 15 define('WP_ADMIN', TRUE); 16 16 17 if ( isset($_GET['import']) && !defined('WP_LOAD_IMPORTERS') ) 18 define('WP_LOAD_IMPORTERS', true); 19 17 20 require_once(dirname(dirname(__FILE__)) . '/wp-load.php'); 18 21 19 22 if ( get_option('db_upgraded') ) { -
wp-admin/import.php
6 6 * @subpackage Administration 7 7 */ 8 8 9 define('WP_LOAD_IMPORTERS', true); 10 9 11 /** Load WordPress Bootstrap */ 10 12 require_once ('admin.php'); 11 13 … … 13 15 wp_die(__('You do not have sufficient permissions to import content in this site.')); 14 16 15 17 $title = __('Import'); 18 add_thickbox(); 16 19 require_once ('admin-header.php'); 17 20 $parent_file = 'tools.php'; 18 21 ?> … … 39 42 } 40 43 @closedir($imports_dir); 41 44 45 $popular_importers = array(); 46 if ( current_user_can('install_plugins') ) 47 $popular_importers = array( 48 'blogger' => array( __('Blogger'), __('Install the Blogger importer to import posts, comments, and users from a Blogger blog.'), 'install' ), 49 'livejournal' => array( __( 'LiveJournal' ), __( 'Install the LiveJounral importer to import posts from LiveJournal using their API.' ), 'install' ), 50 'mt' => array( __('Movable Type and TypePad'), __('Install the Movable Type importer to import posts and comments from a Movable Type or TypePad blog.'), 'install' ), 51 'opml' => array( __('Blogroll'), __('Install the blogroll importer to import links in OPML format.'), 'install' ), 52 'rss' => array( __('RSS'), __('Install the RSS importer to import posts from an RSS feed.'), 'install' ), 53 'wordpress' => array( 'WordPress', __('Install the WordPress importer to import posts, pages, comments, custom fields, categories, and tags from a WordPress export file.'), 'install' ) 54 ); 55 42 56 $importers = get_importers(); 43 57 58 // If a popular importer is not registered, create a dummy registration that links to the plugin installer. 59 foreach ( array_keys($popular_importers) as $pop_importer ) { 60 if ( isset($importers[$pop_importer] ) ) 61 continue; 62 63 $importers[$pop_importer] = $popular_importers[$pop_importer]; 64 } 65 66 uasort($importers, create_function('$a, $b', 'return strcmp($a[0], $b[0]);')); 67 44 68 if (empty ($importers)) { 45 69 echo '<p>'.__('No importers are available.').'</p>'; // TODO: make more helpful 46 70 } else { … … 51 75 $style = ''; 52 76 foreach ($importers as $id => $data) { 53 77 $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>"; 78 if ( 'install' == $data[2] ) { 79 $plugin_slug = $id . '-importer'; 80 $action = '<a href="' . admin_url('plugin-install.php?tab=plugin-information&plugin=' . $plugin_slug . 81 '&TB_iframe=true&width=600&height=550') . '" class="thickbox" title="' . 82 esc_attr__('Install importer') . '">' . $data[0] . '</a>'; 83 } else { 84 $action = "<a href='" . esc_url('admin.php?import=$id') . "' title='" . esc_attr( wptexturize(strip_tags($data[1])) ) ."'>{$data[0]}</a>"; 85 } 55 86 56 87 if ($style != '') 57 88 $style = 'class="'.$style.'"'; … … 66 97 </table> 67 98 <?php 68 99 } 100 101 if ( current_user_can('install_plugins') ) 102 echo '<p>' . sprintf('If the importer you need is not listed, <a href="%s">search the plugins directory</a> to see if an importer is available.', admin_url('plugin-install.php?tab=search&type=tag&s=importer') ) . '</p>'; 69 103 ?> 70 104 71 105 </div>