header(); $step = empty( $_GET['step'] ) ? 0 : (int) $_GET['step']; switch ( $step ) { case 0: $this->greet(); break; case 1: check_admin_referer( 'import-upload' ); if ( $this->handle_upload() ) { $file = get_attached_file( $this->id ); set_time_limit( 0 ); $this->import( $file ); } break; } $this->footer(); } /** * Page header. */ public function header() { echo '
'; printf( __( 'A new version of this importer is available. Please update to version %s to ensure compatibility with newer export files.', 'user-menus' ), $update->update->new_version ); echo '
' . __( 'Upload your WordPress export (WXR) file and import the Nav Menus and any meta for the Nav Menu items.', 'user-menus' ) . '
'; echo '' . __( 'Choose a WXR (.xml) file to upload, then click Upload file and import.', 'user-menus' ) . '
'; wp_import_upload_form( 'admin.php?import=jpum_nav_menu_importer&step=1' ); echo '' . __( 'Sorry, there has been an error.', 'user-menus' ) . '
';
echo esc_html( $file['error'] ) . '
' . __( 'Sorry, there has been an error.', 'user-menus' ) . '
';
printf( __( 'The export file could not be found at %s. It is likely that this was caused by a permissions problem.', 'user-menus' ), esc_html( $file['file'] ) );
echo '
' . __( 'Sorry, there has been an error.', 'user-menus' ) . '
';
echo esc_html( $import_data->get_error_message() ) . '
'; printf( __( 'This WXR file (version %s) may not be supported by this version of the importer. Please consider updating.', 'user-menus' ), esc_html( $import_data['version'] ) ); echo '
' . __( 'Sorry, there has been an error.', 'user-menus' ) . '
';
echo __( 'The file does not exist, please try again.', 'user-menus' );
echo '
' . __( 'Sorry, there has been an error.', 'user-menus' ) . '
';
echo esc_html( $import_data->get_error_message() );
echo '
' . __( 'All done.', 'user-menus' ) . ' ' . __( 'Have fun!', 'user-menus' ) . '
'; do_action( 'import_end' ); } /** * Decide if the given meta key maps to information we will want to import. * * @param string $key The meta key to check. * * @return string|bool The key if we do want to import, false if not. */ public function is_valid_meta_key( $key ) { if ( in_array( $key, $this->invalid_meta_keys, true ) ) { return false; } return $key; } }