FĂȘte Romane - Wolubilis [1] => http://www.wolubilis.be/fr/la_saison/2013/theatre-danse-musique-cirque_12-13/ds_%E2%80%93_you_can_ne [2] => [3] => Brussels [4] => Belgiuem [5] => [6] => [7] => */ //TODO tab/semicolon delimiter! $file_ID = $_POST['acf']['field_6231b2205f346']; $tmp = ""; $file = get_attached_file($file_ID); // $tmp .= print_r($file,1); // error_log(__LINE__." ".$tmp); if($file == ""){ wp_send_json_success("Error File is Empty file_ID:".$file_ID); return; } // $csvFile = file($file); $csvFile = fopen($file, 'r'); $i = 0; $count_adjusted = 0; while (($row = fgetcsv($csvFile)) !== false) { // $tmp .= print_r($row,1); // $tmp .= " 1st\n"; // $tmp .= print_r(utf8_encode($row),1); // wp_send_json_success("End of Function:".$tmp."\n"); if(empty($row)){ wp_send_json_success("Error! File is empty"); return; } $venue['name'] = $row[0]; $venue['description'] = $row[1]; $venue['address'] = $row[2]; $venue['city'] = $row[3]; $venue['state'] = $row[4]; $venue['postcode'] = $row[5]; $venue['country'] = $row[6]; $venue['latitude'] = $row[7]; $venue['longtitude'] = $row[8]; $return = eo_insert_venue( $venue['name'], $venue ); // if(is_wp_error( $return )){ // $tmp .= print_r($return,1); // wp_send_json_success("End of Function:".$tmp."\n"); // return; // }else{ // $tmp .= $return."\n"; // } $tmp .= print_r($return,1); } // $tmp .= print_r($return,1); wp_send_json_success("End of Function:".$tmp); return; } add_action('acf/input/admin_enqueue_scripts', 'acf_admin_enqueue_scripts'); function acf_admin_enqueue_scripts() { $plugin_url = plugin_dir_url( __FILE__ ); // wp_enqueue_style( 'nevicata-acf-input-css', get_stylesheet_directory_uri() . '/css/nevicata-acf-input.css', false, '1.0.0' ); wp_enqueue_script( 'eoiv-acf-input-js', $plugin_url . 'js/eoiv-acf-input.js', false, '1.0.0' ); } ?>