Changeset 3208711
- Timestamp:
- 12/16/2024 04:58:06 PM (14 months ago)
- Location:
- mon-laboratoire/trunk
- Files:
-
- 4 edited
-
Admin/Import/class-import-main.php (modified) (3 diffs)
-
Admin/class-csv.php (modified) (1 diff)
-
mon-laboratoire.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
mon-laboratoire/trunk/Admin/Import/class-import-main.php
r3125386 r3208711 16 16 render_main_form( ) 17 17 processing() 18 _process_csv_submited_file( string $file_submit_name ) 18 19 */ 19 20 … … 116 117 $imported_teams = array(); 117 118 if ( $this->_check_nonce( 'import_cvs_files' ) ) { 118 $csv = Csv::getInstance(); 119 if ( isset( $_FILES['submit_import_persons'] ) ) { 120 if ( !empty( $_FILES['submit_import_persons']['tmp_name'] ) ) { 121 $imported_persons = $csv->importCsvToArray( $_FILES['submit_import_persons']['tmp_name'] ); 122 } 123 } 124 if ( isset( $_FILES['submit_import_teams_members'] ) ) { 125 if ( !empty(( $_FILES['submit_import_teams_members']['tmp_name'] ) ) ) { 126 $imported_teams_members = $csv->importCsvToArray( $_FILES['submit_import_teams_members']['tmp_name'] ); 127 } 128 } 129 if ( isset( $_FILES['submit_import_teams'] ) ) { 130 if ( !empty(( $_FILES['submit_import_teams']['tmp_name'] ) ) ) { 131 $imported_teams = $csv->importCsvToArray( $_FILES['submit_import_teams']['tmp_name'] ); 132 } 133 } 119 $imported_persons = $this->_process_csv_submited_file('submit_import_persons' ); 120 $imported_teams_members = $this->_process_csv_submited_file('submit_import_teams_members' ); 121 $imported_teams = $this->_process_csv_submited_file('submit_import_teams' ); 134 122 $Pre_Import = New Pre_Import( $imported_persons, $imported_teams_members, $imported_teams ); 135 123 $retval .= $Pre_Import->processing( ); … … 146 134 } 147 135 136 /** 137 * Process import of CSV submited file 138 * @param string $file_submit_name : Field name of file import 139 * @return array<int,array<string,string>> 140 */ 141 private function _process_csv_submited_file( string $file_submit_name ) { 142 $csv = Csv::getInstance(); 143 $imported_array = array(); 144 if ( isset( $_FILES[ $file_submit_name ] ) && !empty( $_FILES[ $file_submit_name ]['tmp_name'] ) ) { 145 $extension = strtolower( pathinfo( $_FILES[ $file_submit_name ]['name'], PATHINFO_EXTENSION ) ); 146 if ( 'csv' === $extension ) { 147 $imported_array = $csv->importCsvToArray( $_FILES[ $file_submit_name ]['tmp_name'] ); 148 } 149 } 150 return $imported_array; 151 } 152 148 153 } -
mon-laboratoire/trunk/Admin/class-csv.php
r3119363 r3208711 204 204 function importCsvToArray( string $filepath ) : array { 205 205 $table_imported = array(); 206 $extension = strtolower( pathinfo( $filepath, PATHINFO_EXTENSION ) ); 207 if ( 'csv' === $extension ) { 208 $csvFile = fopen( $filepath, 'r'); 209 if ( $csvFile !== false ) { 210 while( ! feof( $csvFile ) ){ 211 $data = fgetcsv( $csvFile ); 212 $table_imported[] = $data; 213 } 214 fclose($csvFile); 215 } 206 $csvFile = fopen( $filepath, 'r'); 207 if ( $csvFile !== false ) { 208 while( ! feof( $csvFile ) ){ 209 $data = fgetcsv( $csvFile ); 210 $table_imported[] = $data; 211 } 212 fclose($csvFile); 216 213 } 217 214 return $this->_clean_imported_array( $table_imported ); -
mon-laboratoire/trunk/mon-laboratoire.php
r3186035 r3208711 12 12 * Plugin URI: http://www.monlabo.org 13 13 * Description: Simplify the management of a research unit's website 14 * Version: 4.9 14 * Version: 4.9.1 15 15 * Requires at least: 5.6 16 16 * Requires PHP: 7.2 … … 48 48 * @return string version 49 49 */ 50 function get_MonLabo_version(): string { return '4.9 '; }50 function get_MonLabo_version(): string { return '4.9.1'; } 51 51 52 52 /////////////////////////////////////////////////////////////////////////////////////////// -
mon-laboratoire/trunk/readme.txt
r3186035 r3208711 5 5 Requires at least: 5.6 6 6 Tested up to: 6.7 7 Stable tag: 4.9 7 Stable tag: 4.9.1 8 8 Requires PHP: 7.2 9 9 License: GPLv3 or later … … 42 42 == Changelog == 43 43 44 = 4.9.1 = 45 *Release Date - 16 December 2024* 46 47 * BUG : Import tool was not functionnal because of a bad check of file extension 48 44 49 = 4.9 = 45 *Release Date - 11 November 2024 *50 *Release Date - 11 November 2024* 46 51 47 52 * Evolutions of functionalities :
Note: See TracChangeset
for help on using the changeset viewer.