file = VAMTAM_SAMPLES_DIR . 'gmp-easy.csv'; } /** * Registered callback function for the WordPress Importer * * Manages the three separate stages of the WXR import process */ public function dispatch() { $this->header(); check_admin_referer( 'vamtam-import-gmp-easy' ); set_time_limit( 0 ); $this->import( ); $this->footer(); } /** * The main controller for the actual import stage. */ public function import() { add_filter( 'http_request_timeout', array( $this, 'bump_request_timeout' ) ); $this->import_start(); wp_suspend_cache_invalidation( true ); $_GET['type'] = 'maps'; $_FILES['csv_import_file_maps'] = array( 'name' => basename( $this->file ), 'tmp_name' => $this->file, 'type' => 'application/csv', 'error' => 0, 'size' => filesize( $this->file ), ); \frameGmp::_()->getModule( 'csv' )->getController()->import(); wp_suspend_cache_invalidation( false ); $this->import_end(); } private function import_start() { if ( ! file_exists( $this->file ) ) { echo '
' . esc_html__( 'Sorry, there has been an error.', 'wordpress-importer' ) . '
';
echo esc_html__( 'The file does not exist, please try again.', 'wordpress-importer' ) . '
' . esc_html__( 'All done.', 'wordpress-importer' ) . ' ' . esc_html__( 'Have fun!', 'wordpress-importer' ) . '
'; echo ''; do_action( 'import_end' ); } // Display import page title private function header() { echo '