Changeset 42343 for trunk/src/wp-admin/import.php
- Timestamp:
- 11/30/2017 11:09:33 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/import.php
r38725 r42343 7 7 */ 8 8 9 define( 'WP_LOAD_IMPORTERS', true);9 define( 'WP_LOAD_IMPORTERS', true ); 10 10 11 11 /** Load WordPress Bootstrap */ … … 16 16 } 17 17 18 $title = __('Import'); 19 20 get_current_screen()->add_help_tab( array( 21 'id' => 'overview', 22 'title' => __('Overview'), 23 'content' => '<p>' . __('This screen lists links to plugins to import data from blogging/content management platforms. Choose the platform you want to import from, and click Install Now when you are prompted in the popup window. If your platform is not listed, click the link to search the plugin directory for other importer plugins to see if there is one for your platform.') . '</p>' . 24 '<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>', 25 ) ); 18 $title = __( 'Import' ); 19 20 get_current_screen()->add_help_tab( 21 array( 22 'id' => 'overview', 23 'title' => __( 'Overview' ), 24 'content' => '<p>' . __( 'This screen lists links to plugins to import data from blogging/content management platforms. Choose the platform you want to import from, and click Install Now when you are prompted in the popup window. If your platform is not listed, click the link to search the plugin directory for other importer plugins to see if there is one for your platform.' ) . '</p>' . 25 '<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>', 26 ) 27 ); 26 28 27 29 get_current_screen()->set_help_sidebar( 28 '<p><strong>' . __( 'For more information:') . '</strong></p>' .29 '<p>' . __( '<a href="https://codex.wordpress.org/Tools_Import_Screen">Documentation on Import</a>') . '</p>' .30 '<p>' . __( '<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>'30 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . 31 '<p>' . __( '<a href="https://codex.wordpress.org/Tools_Import_Screen">Documentation on Import</a>' ) . '</p>' . 32 '<p>' . __( '<a href="https://wordpress.org/support/">Support Forums</a>' ) . '</p>' 31 33 ); 32 34 … … 35 37 $popular_importers = wp_get_popular_importers(); 36 38 } else { 37 39 $popular_importers = array(); 38 40 } 39 41 … … 60 62 <?php if ( ! empty( $_GET['invalid'] ) ) : ?> 61 63 <div class="error"> 62 <p><strong><?php _e( 'ERROR:' ); ?></strong> <?php 63 /* translators: %s: importer slug */ 64 printf( __( 'The %s importer is invalid or is not installed.' ), '<strong>' . esc_html( $_GET['invalid'] ) . '</strong>' ); 65 ?></p> 64 <p><strong><?php _e( 'ERROR:' ); ?></strong> 65 <?php 66 /* translators: %s: importer slug */ 67 printf( __( 'The %s importer is invalid or is not installed.' ), '<strong>' . esc_html( $_GET['invalid'] ) . '</strong>' ); 68 ?> 69 </p> 66 70 </div> 67 71 <?php endif; ?> 68 <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>72 <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> 69 73 70 74 <?php … … 74 78 // If a popular importer is not registered, create a dummy registration that links to the plugin installer. 75 79 foreach ( $popular_importers as $pop_importer => $pop_data ) { 76 if ( isset( $importers[ $pop_importer ] ) ) 80 if ( isset( $importers[ $pop_importer ] ) ) { 77 81 continue; 78 if ( isset( $importers[ $pop_data['importer-id'] ] ) ) 82 } 83 if ( isset( $importers[ $pop_data['importer-id'] ] ) ) { 79 84 continue; 85 } 80 86 81 87 // Fill the array of registered (already installed) importers with data of the popular importers from the WordPress.org API. 82 $importers[ $pop_data['importer-id'] ] = array( $pop_data['name'], $pop_data['description'], 'install' => $pop_data['plugin-slug'] ); 88 $importers[ $pop_data['importer-id'] ] = array( 89 $pop_data['name'], 90 $pop_data['description'], 91 'install' => $pop_data['plugin-slug'], 92 ); 83 93 } 84 94 85 95 if ( empty( $importers ) ) { 86 echo '<p>' . __( 'No importers are available.') . '</p>'; // TODO: make more helpful96 echo '<p>' . __( 'No importers are available.' ) . '</p>'; // TODO: make more helpful 87 97 } else { 88 98 uasort( $importers, '_usort_by_first_member' ); … … 92 102 <?php 93 103 foreach ( $importers as $importer_id => $data ) { 94 $plugin_slug = $action = '';104 $plugin_slug = $action = ''; 95 105 $is_plugin_installed = false; 96 106 … … 102 112 $plugins = get_plugins( '/' . $plugin_slug ); 103 113 if ( ! empty( $plugins ) ) { 104 $keys = array_keys( $plugins );114 $keys = array_keys( $plugins ); 105 115 $plugin_file = $plugin_slug . '/' . $keys[0]; 106 $url = wp_nonce_url( add_query_arg( array( 107 'action' => 'activate', 108 'plugin' => $plugin_file, 109 'from' => 'import', 110 ), admin_url( 'plugins.php' ) ), 'activate-plugin_' . $plugin_file ); 111 $action = sprintf( 116 $url = wp_nonce_url( 117 add_query_arg( 118 array( 119 'action' => 'activate', 120 'plugin' => $plugin_file, 121 'from' => 'import', 122 ), admin_url( 'plugins.php' ) 123 ), 'activate-plugin_' . $plugin_file 124 ); 125 $action = sprintf( 112 126 '<a href="%s" aria-label="%s">%s</a>', 113 127 esc_url( $url ), … … 123 137 if ( empty( $action ) ) { 124 138 if ( is_main_site() ) { 125 $url = wp_nonce_url( add_query_arg( array( 126 'action' => 'install-plugin', 127 'plugin' => $plugin_slug, 128 'from' => 'import', 129 ), self_admin_url( 'update.php' ) ), 'install-plugin_' . $plugin_slug ); 139 $url = wp_nonce_url( 140 add_query_arg( 141 array( 142 'action' => 'install-plugin', 143 'plugin' => $plugin_slug, 144 'from' => 'import', 145 ), self_admin_url( 'update.php' ) 146 ), 'install-plugin_' . $plugin_slug 147 ); 130 148 $action = sprintf( 131 149 '<a href="%1$s" class="install-now" data-slug="%2$s" data-name="%3$s" aria-label="%4$s">%5$s</a>', … … 146 164 } 147 165 } else { 148 $url = add_query_arg( array( 149 'import' => $importer_id, 150 ), self_admin_url( 'admin.php' ) ); 166 $url = add_query_arg( 167 array( 168 'import' => $importer_id, 169 ), self_admin_url( 'admin.php' ) 170 ); 151 171 $action = sprintf( 152 172 '<a href="%1$s" aria-label="%2$s">%3$s</a>', … … 161 181 162 182 if ( ! $is_plugin_installed && is_main_site() ) { 163 $url = add_query_arg( array( 164 'tab' => 'plugin-information', 165 'plugin' => $plugin_slug, 166 'from' => 'import', 167 'TB_iframe' => 'true', 168 'width' => 600, 169 'height' => 550, 170 ), network_admin_url( 'plugin-install.php' ) ); 183 $url = add_query_arg( 184 array( 185 'tab' => 'plugin-information', 186 'plugin' => $plugin_slug, 187 'from' => 'import', 188 'TB_iframe' => 'true', 189 'width' => 600, 190 'height' => 550, 191 ), network_admin_url( 'plugin-install.php' ) 192 ); 171 193 $action .= sprintf( 172 194 ' | <a href="%1$s" class="thickbox open-plugin-details-modal" aria-label="%2$s">%3$s</a>', … … 194 216 } 195 217 196 if ( current_user_can('install_plugins') ) 197 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>'; 218 if ( current_user_can( 'install_plugins' ) ) { 219 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>'; 220 } 198 221 ?> 199 222
Note: See TracChangeset
for help on using the changeset viewer.