wp/wp-admin/import.php
changeset 16 a86126ab1dd4
parent 9 177826044cd9
child 19 3d72ae0968f4
--- a/wp/wp-admin/import.php	Tue Oct 22 16:11:46 2019 +0200
+++ b/wp/wp-admin/import.php	Tue Dec 15 13:49:49 2020 +0100
@@ -9,10 +9,10 @@
 define( 'WP_LOAD_IMPORTERS', true );
 
 /** Load WordPress Bootstrap */
-require_once( dirname( __FILE__ ) . '/admin.php' );
+require_once __DIR__ . '/admin.php';
 
 if ( ! current_user_can( 'import' ) ) {
-	wp_die( __( 'Sorry, you are not allowed to import content.' ) );
+	wp_die( __( 'Sorry, you are not allowed to import content into this site.' ) );
 }
 
 $title = __( 'Import' );
@@ -28,7 +28,7 @@
 
 get_current_screen()->set_help_sidebar(
 	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
-	'<p>' . __( '<a href="https://codex.wordpress.org/Tools_Import_Screen">Documentation on Import</a>' ) . '</p>' .
+	'<p>' . __( '<a href="https://wordpress.org/support/article/tools-import-screen/">Documentation on Import</a>' ) . '</p>' .
 	'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
 );
 
@@ -39,10 +39,10 @@
 	$popular_importers = array();
 }
 
-// Detect and redirect invalid importers like 'movabletype', which is registered as 'mt'
+// Detect and redirect invalid importers like 'movabletype', which is registered as 'mt'.
 if ( ! empty( $_GET['invalid'] ) && isset( $popular_importers[ $_GET['invalid'] ] ) ) {
 	$importer_id = $popular_importers[ $_GET['invalid'] ]['importer-id'];
-	if ( $importer_id != $_GET['invalid'] ) { // Prevent redirect loops.
+	if ( $importer_id !== $_GET['invalid'] ) { // Prevent redirect loops.
 		wp_redirect( admin_url( 'admin.php?import=' . $importer_id ) );
 		exit;
 	}
@@ -53,7 +53,7 @@
 wp_enqueue_script( 'plugin-install' );
 wp_enqueue_script( 'updates' );
 
-require_once( ABSPATH . 'wp-admin/admin-header.php' );
+require_once ABSPATH . 'wp-admin/admin-header.php';
 $parent_file = 'tools.php';
 ?>
 
@@ -61,11 +61,11 @@
 <h1><?php echo esc_html( $title ); ?></h1>
 <?php if ( ! empty( $_GET['invalid'] ) ) : ?>
 	<div class="error">
-		<p><strong><?php _e( 'ERROR:' ); ?></strong>
-								<?php
-								/* translators: %s: importer slug */
-								printf( __( 'The %s importer is invalid or is not installed.' ), '<strong>' . esc_html( $_GET['invalid'] ) . '</strong>' );
-								?>
+		<p><strong><?php _e( 'Error:' ); ?></strong>
+			<?php
+			/* translators: %s: Importer slug. */
+			printf( __( 'The %s importer is invalid or is not installed.' ), '<strong>' . esc_html( $_GET['invalid'] ) . '</strong>' );
+			?>
 		</p>
 	</div>
 <?php endif; ?>
@@ -93,7 +93,7 @@
 }
 
 if ( empty( $importers ) ) {
-	echo '<p>' . __( 'No importers are available.' ) . '</p>'; // TODO: make more helpful
+	echo '<p>' . __( 'No importers are available.' ) . '</p>'; // TODO: Make more helpful.
 } else {
 	uasort( $importers, '_usort_by_first_member' );
 	?>
@@ -101,7 +101,8 @@
 
 	<?php
 	foreach ( $importers as $importer_id => $data ) {
-		$plugin_slug         = $action = '';
+		$plugin_slug         = '';
+		$action              = '';
 		$is_plugin_installed = false;
 
 		if ( isset( $data['install'] ) ) {
@@ -127,7 +128,7 @@
 					$action      = sprintf(
 						'<a href="%s" aria-label="%s">%s</a>',
 						esc_url( $url ),
-						/* translators: %s: Importer name */
+						/* translators: %s: Importer name. */
 						esc_attr( sprintf( __( 'Run %s' ), $data[0] ) ),
 						__( 'Run Importer' )
 					);
@@ -154,13 +155,13 @@
 						esc_url( $url ),
 						esc_attr( $plugin_slug ),
 						esc_attr( $data[0] ),
-						/* translators: %s: Importer name */
-						esc_attr( sprintf( __( 'Install %s now' ), $data[0] ) ),
+						/* translators: %s: Importer name. */
+						esc_attr( sprintf( _x( 'Install %s now', 'plugin' ), $data[0] ) ),
 						__( 'Install Now' )
 					);
 				} else {
 					$action = sprintf(
-						/* translators: URL to wp-admin/import.php */
+						/* translators: %s: URL to Import screen on the main site. */
 						__( 'This importer is not installed. Please install importers from <a href="%s">the main site</a>.' ),
 						get_admin_url( get_current_network_id(), 'import.php' )
 					);
@@ -176,7 +177,7 @@
 			$action = sprintf(
 				'<a href="%1$s" aria-label="%2$s">%3$s</a>',
 				esc_url( $url ),
-				/* translators: %s: Importer name */
+				/* translators: %s: Importer name. */
 				esc_attr( sprintf( __( 'Run %s' ), $data[0] ) ),
 				__( 'Run Importer' )
 			);
@@ -199,7 +200,7 @@
 			$action .= sprintf(
 				' | <a href="%1$s" class="thickbox open-plugin-details-modal" aria-label="%2$s">%3$s</a>',
 				esc_url( $url ),
-				/* translators: %s: Importer name */
+				/* translators: %s: Importer name. */
 				esc_attr( sprintf( __( 'More information about %s' ), $data[0] ) ),
 				__( 'Details' )
 			);
@@ -222,7 +223,11 @@
 }
 
 if ( current_user_can( 'install_plugins' ) ) {
-	echo '<p>' . sprintf( __( 'If the importer you need is not listed, <a href="%s">search the plugin directory</a> to see if an importer is available.' ), esc_url( network_admin_url( 'plugin-install.php?tab=search&type=tag&s=importer' ) ) ) . '</p>';
+	echo '<p>' . sprintf(
+		/* translators: %s: URL to Add Plugins screen. */
+		__( 'If the importer you need is not listed, <a href="%s">search the plugin directory</a> to see if an importer is available.' ),
+		esc_url( network_admin_url( 'plugin-install.php?tab=search&type=tag&s=importer' ) )
+	) . '</p>';
 }
 ?>
 
@@ -232,4 +237,4 @@
 wp_print_request_filesystem_credentials_modal();
 wp_print_admin_notice_templates();
 
-include( ABSPATH . 'wp-admin/admin-footer.php' );
+require_once ABSPATH . 'wp-admin/admin-footer.php';