wp/wp-admin/import.php
changeset 5 5e2f62d02dcd
parent 0 d970ebf37754
child 7 cf61fcea0001
equal deleted inserted replaced
4:346c88efed21 5:5e2f62d02dcd
    23 		'<p>' . __('In previous versions of WordPress, all importers were built-in. They have been turned into plugins since most people only use them once or infrequently.') . '</p>',
    23 		'<p>' . __('In previous versions of WordPress, all importers were built-in. They have been turned into plugins since most people only use them once or infrequently.') . '</p>',
    24 ) );
    24 ) );
    25 
    25 
    26 get_current_screen()->set_help_sidebar(
    26 get_current_screen()->set_help_sidebar(
    27 	'<p><strong>' . __('For more information:') . '</strong></p>' .
    27 	'<p><strong>' . __('For more information:') . '</strong></p>' .
    28 	'<p>' . __('<a href="http://codex.wordpress.org/Tools_Import_Screen" target="_blank">Documentation on Import</a>') . '</p>' .
    28 	'<p>' . __('<a href="https://codex.wordpress.org/Tools_Import_Screen" target="_blank">Documentation on Import</a>') . '</p>' .
    29 	'<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
    29 	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
    30 );
    30 );
    31 
    31 
    32 if ( current_user_can( 'install_plugins' ) )
    32 if ( current_user_can( 'install_plugins' ) )
    33 	$popular_importers = wp_get_popular_importers();
    33 	$popular_importers = wp_get_popular_importers();
    34 else
    34 else
    50 require_once( ABSPATH . 'wp-admin/admin-header.php' );
    50 require_once( ABSPATH . 'wp-admin/admin-header.php' );
    51 $parent_file = 'tools.php';
    51 $parent_file = 'tools.php';
    52 ?>
    52 ?>
    53 
    53 
    54 <div class="wrap">
    54 <div class="wrap">
    55 <?php screen_icon(); ?>
       
    56 <h2><?php echo esc_html( $title ); ?></h2>
    55 <h2><?php echo esc_html( $title ); ?></h2>
    57 <?php if ( ! empty( $_GET['invalid'] ) ) : ?>
    56 <?php if ( ! empty( $_GET['invalid'] ) ) : ?>
    58 	<div class="error"><p><strong><?php _e('ERROR:')?></strong> <?php printf( __('The <strong>%s</strong> importer is invalid or is not installed.'), esc_html( $_GET['invalid'] ) ); ?></p></div>
    57 	<div class="error"><p><strong><?php _e('ERROR:')?></strong> <?php printf( __('The <strong>%s</strong> importer is invalid or is not installed.'), esc_html( $_GET['invalid'] ) ); ?></p></div>
    59 <?php endif; ?>
    58 <?php endif; ?>
    60 <p><?php _e('If you have posts or comments in another system, WordPress can import those into this site. To get started, choose a system to import from below:'); ?></p>
    59 <p><?php _e('If you have posts or comments in another system, WordPress can import those into this site. To get started, choose a system to import from below:'); ?></p>
    73 }
    72 }
    74 
    73 
    75 if ( empty( $importers ) ) {
    74 if ( empty( $importers ) ) {
    76 	echo '<p>' . __('No importers are available.') . '</p>'; // TODO: make more helpful
    75 	echo '<p>' . __('No importers are available.') . '</p>'; // TODO: make more helpful
    77 } else {
    76 } else {
    78 	uasort($importers, create_function('$a, $b', 'return strnatcasecmp($a[0], $b[0]);'));
    77 	uasort( $importers, '_usort_by_first_member' );
    79 ?>
    78 ?>
    80 <table class="widefat importers" cellspacing="0">
    79 <table class="widefat importers striped">
    81 
    80 
    82 <?php
    81 <?php
    83 	$alt = '';
       
    84 	foreach ($importers as $importer_id => $data) {
    82 	foreach ($importers as $importer_id => $data) {
    85 		$action = '';
    83 		$action = '';
    86 		if ( isset( $data['install'] ) ) {
    84 		if ( isset( $data['install'] ) ) {
    87 			$plugin_slug = $data['install'];
    85 			$plugin_slug = $data['install'];
    88 			if ( file_exists( WP_PLUGIN_DIR . '/' . $plugin_slug ) ) {
    86 			if ( file_exists( WP_PLUGIN_DIR . '/' . $plugin_slug ) ) {
   107 			}
   105 			}
   108 		} else {
   106 		} else {
   109 			$action = "<a href='" . esc_url( "admin.php?import=$importer_id" ) . "' title='" . esc_attr( wptexturize( strip_tags( $data[1] ) ) ) ."'>{$data[0]}</a>";
   107 			$action = "<a href='" . esc_url( "admin.php?import=$importer_id" ) . "' title='" . esc_attr( wptexturize( strip_tags( $data[1] ) ) ) ."'>{$data[0]}</a>";
   110 		}
   108 		}
   111 
   109 
   112 		$alt = $alt ? '' : ' class="alternate"';
       
   113 		echo "
   110 		echo "
   114 			<tr$alt>
   111 			<tr>
   115 				<td class='import-system row-title'>$action</td>
   112 				<td class='import-system row-title'>$action</td>
   116 				<td class='desc'>{$data[1]}</td>
   113 				<td class='desc'>{$data[1]}</td>
   117 			</tr>";
   114 			</tr>";
   118 	}
   115 	}
   119 ?>
   116 ?>