Changeset 2406637
- Timestamp:
- 10/26/2020 08:53:45 AM (5 years ago)
- Location:
- indesignhtml2post/trunk
- Files:
-
- 2 edited
-
InDesignHTML2Post.php (modified) (4 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
indesignhtml2post/trunk/InDesignHTML2Post.php
r2259123 r2406637 4 4 * Plugin URI: https://fr.wordpress.org/plugins/indesignhtml2post/ 5 5 * Description: Convert HTML InDesign exports to posts (imports all text and images - and attach images automatically to newly created posts). 6 * Version: 1.6. 46 * Version: 1.6.5 7 7 * Author: termel 8 8 * Author URI: https://www.indesign2wordpress.com/ … … 1153 1153 1154 1154 if (isset($attachedImagesArray[$imgFileToInsert])) { 1155 $attachId = $attachedImagesArray[$imgFileToInsert];1155 $attachId = is_numeric($attachedImagesArray[$imgFileToInsert]); 1156 1156 $foundAttachmentId = is_numeric($attachId) ? $attachId : -1; 1157 1157 } else if (isset($resizedImagesArrayNames[$imgFileToInsert]) && isset($attachedImagesArray[$resizedImagesArrayNames[$imgFileToInsert]])) { … … 1318 1318 return $upload_dir; 1319 1319 } 1320 1321 private function codeToMessage($code) 1322 { 1323 switch ($code) { 1324 case UPLOAD_ERR_INI_SIZE: 1325 $message = "The uploaded file exceeds the upload_max_filesize directive in php.ini"; 1326 break; 1327 case UPLOAD_ERR_FORM_SIZE: 1328 $message = "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form"; 1329 break; 1330 case UPLOAD_ERR_PARTIAL: 1331 $message = "The uploaded file was only partially uploaded"; 1332 break; 1333 case UPLOAD_ERR_NO_FILE: 1334 $message = "No file was uploaded"; 1335 break; 1336 case UPLOAD_ERR_NO_TMP_DIR: 1337 $message = "Missing a temporary folder"; 1338 break; 1339 case UPLOAD_ERR_CANT_WRITE: 1340 $message = "Failed to write file to disk"; 1341 break; 1342 case UPLOAD_ERR_EXTENSION: 1343 $message = "File upload stopped by extension"; 1344 break; 1345 1346 default: 1347 $message = "Unknown upload error"; 1348 break; 1349 } 1350 return $message; 1351 } 1320 1352 1321 1353 function handle_indesign_html_export($post_max_size = 8000) … … 1352 1384 $unzipped = array(); 1353 1385 if (! is_admin()) { 1354 require_once (ABSPATH . 'wp-admin/includes/file.php'); 1386 $path_to_include = ABSPATH . 'wp-admin/includes/file.php'; 1387 InDesignHTML2Post_log($path_to_include); 1388 require_once ($path_to_include); 1389 } else { 1390 InDesignHTML2Post_log("Is admin page"); 1355 1391 } 1356 1392 WP_Filesystem(); 1357 1393 $uploadDir = wp_upload_dir(); 1394 InDesignHTML2Post_log($uploadDir); 1358 1395 $writeToPath = trailingslashit($uploadDir['path']); 1396 InDesignHTML2Post_log($writeToPath); 1359 1397 foreach ($_FILES as $fid => $array) { 1360 1398 $request_answer = "-> file to upload : " . $fid . ' / ' . $filename . " (" . $array['name'] . ") / " . $array['type'] . " / " . $array['tmp_name']; 1399 1361 1400 if ($array['error'] !== UPLOAD_ERR_OK) { 1362 $msg = $array['error']; 1401 $err_id = $array['error']; 1402 $msg = $this->codeToMessage($err_id); 1403 InDesignHTML2Post_log($msg); 1363 1404 $request_answer .= $this->displayHTMLStatusOfCmd($filename, $msg, $array['error']); 1364 1405 return $msg; 1406 } else { 1407 $msg = "File uploaded without error :)"; 1408 InDesignHTML2Post_log($msg); 1365 1409 } 1366 1410 -
indesignhtml2post/trunk/readme.txt
r2259204 r2406637 43 43 == Changelog == 44 44 45 1.6.5 - Add messages on upload errors 46 45 47 1.6.4 - bug fix on attachment ID lookup 46 48
Note: See TracChangeset
for help on using the changeset viewer.