plugin_url() . '/assets/js/admin/sportspress-admin.js', array( 'jquery', 'chosen', 'jquery-ui-core', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-tiptip', 'jquery-caret' ), SP_VERSION, true ); } /** * Registered callback function for the WordPress Importer * * Manages the three separate stages of the CSV import process */ function dispatch() { $this->header(); if ( ! empty( $_POST['delimiter'] ) ) { $this->delimiter = stripslashes( trim( sanitize_text_field( $_POST['delimiter'] ) ) ); } if ( ! $this->delimiter ) { $this->delimiter = ','; } $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() ) : if ( $this->id ) { $file = get_attached_file( $this->id ); } else { $file = ABSPATH . $this->file_url; } add_filter( 'http_request_timeout', array( $this, 'bump_request_timeout' ) ); if ( function_exists( 'gc_enable' ) ) { gc_enable(); } @set_time_limit( 0 ); @ob_flush(); @flush(); $this->table( $file ); endif; break; case 2: check_admin_referer( 'import-upload' ); if ( isset( $_POST['sp_import'] ) ) : $columns = array_filter( sp_array_value( $_POST, 'sp_columns', array( 'post_title' ) ) ); $this->import( $_POST['sp_import'], array_values( $columns ) ); endif; break; endswitch; $this->footer(); } /** * dropdown function. * * @access public * @param mixed $file * @return void */ function dropdown( $selected ) { ?> imported = $this->skipped = 0; if ( ! is_file( $file ) ) : $this->footer(); die(); endif; ini_set( 'auto_detect_line_endings', '1' ); if ( ( $handle = fopen( $file, 'r' ) ) !== false ) : $header = fgetcsv( $handle, 0, $this->delimiter ); if ( sizeof( $header ) >= 1 ) : $action = 'admin.php?import=' . $this->import_page . '&step=2'; ?>
' . __( 'Sorry, there has been an error.', 'sportspress' ) . '' . __( 'Sorry, there has been an error.', 'sportspress' ) . '
';
echo esc_html( $file['error'] ) . '
' . __( 'Sorry, there has been an error.', 'sportspress' ) . '
'; return false; } } return true; } /** * header function. * * @access public * @return void */ function header() { echo '