| @@ 1515-1519 (lines=5) @@ | ||
| 1512 | // if the file is located remotely, download it to our uploads DIR, because wp_genereate_attachmnet_metadata needs the file to be local |
|
| 1513 | if (strpos($guid, $wp_upload_dir['url']) === false) { |
|
| 1514 | // image is located remotely. download it and place it in the uploads directory |
|
| 1515 | if (! is_readable($guid)) { |
|
| 1516 | $migration_stage->add_error(sprintf(esc_html__( |
|
| 1517 | "Could not create image attachment from non-existent file: %s", |
|
| 1518 | "event_espresso" |
|
| 1519 | ), $guid)); |
|
| 1520 | return 0; |
|
| 1521 | } |
|
| 1522 | $contents = file_get_contents($guid); |
|
| @@ 1523-1527 (lines=5) @@ | ||
| 1520 | return 0; |
|
| 1521 | } |
|
| 1522 | $contents = file_get_contents($guid); |
|
| 1523 | if ($contents === false) { |
|
| 1524 | $migration_stage->add_error(sprintf(esc_html__( |
|
| 1525 | "Could not read image at %s, and therefore couldnt create an attachment post for it.", |
|
| 1526 | "event_espresso" |
|
| 1527 | ), $guid)); |
|
| 1528 | return false; |
|
| 1529 | } |
|
| 1530 | $local_filepath = $wp_upload_dir['path'] . '/' . basename($guid); |
|
| @@ 1420-1435 (lines=16) @@ | ||
| 1417 | . $tour |
|
| 1418 | . '.class.php' : $file_path; |
|
| 1419 | // if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error. |
|
| 1420 | if (! is_readable($file_path)) { |
|
| 1421 | EE_Error::add_error( |
|
| 1422 | sprintf( |
|
| 1423 | esc_html__( |
|
| 1424 | 'The file path given for the help tour (%s) is not a valid path. Please check that the string you set for the help tour on this route (%s) is the correct spelling', |
|
| 1425 | 'event_espresso' |
|
| 1426 | ), |
|
| 1427 | $file_path, |
|
| 1428 | $tour |
|
| 1429 | ), |
|
| 1430 | __FILE__, |
|
| 1431 | __FUNCTION__, |
|
| 1432 | __LINE__ |
|
| 1433 | ); |
|
| 1434 | return; |
|
| 1435 | } |
|
| 1436 | require_once $file_path; |
|
| 1437 | if (! class_exists($tour)) { |
|
| 1438 | $error_msg = []; |
|
| @@ 92-105 (lines=14) @@ | ||
| 89 | $wp_filesystem_class = $filesystem_class; |
|
| 90 | } |
|
| 91 | } |
|
| 92 | if (! $valid || ! file_exists($wp_filesystem_file)) { |
|
| 93 | EE_Error::add_error( |
|
| 94 | sprintf( |
|
| 95 | esc_html__( |
|
| 96 | 'The supplied WP Filesystem filepath "%1$s" is either missing or invalid.', |
|
| 97 | 'event_espresso' |
|
| 98 | ), |
|
| 99 | $wp_filesystem_file |
|
| 100 | ), |
|
| 101 | __FILE__, |
|
| 102 | __FUNCTION__, |
|
| 103 | __LINE__ |
|
| 104 | ); |
|
| 105 | } |
|
| 106 | // check constants defined, just like in the wp-admin/includes/file.php WP_Filesystem() |
|
| 107 | if (! defined('FS_CHMOD_DIR')) { |
|
| 108 | define('FS_CHMOD_DIR', (fileperms(ABSPATH) & 0775 | 0755)); |
|