| @@ 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); |
|
| @@ 970-978 (lines=9) @@ | ||
| 967 | $CNT_ISO = isset($this->_req_data['CNT_ISO']) |
|
| 968 | ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO'])) |
|
| 969 | : false; |
|
| 970 | if (! $CNT_ISO) { |
|
| 971 | EE_Error::add_error( |
|
| 972 | esc_html__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'), |
|
| 973 | __FILE__, |
|
| 974 | __FUNCTION__, |
|
| 975 | __LINE__ |
|
| 976 | ); |
|
| 977 | $success = false; |
|
| 978 | } |
|
| 979 | $STA_abbrev = isset($this->_req_data['STA_abbrev']) |
|
| 980 | ? sanitize_text_field($this->_req_data['STA_abbrev']) |
|
| 981 | : false; |
|
| @@ 982-990 (lines=9) @@ | ||
| 979 | $STA_abbrev = isset($this->_req_data['STA_abbrev']) |
|
| 980 | ? sanitize_text_field($this->_req_data['STA_abbrev']) |
|
| 981 | : false; |
|
| 982 | if (! $STA_abbrev) { |
|
| 983 | EE_Error::add_error( |
|
| 984 | esc_html__('No State ISO code or an invalid State ISO code was received.', 'event_espresso'), |
|
| 985 | __FILE__, |
|
| 986 | __FUNCTION__, |
|
| 987 | __LINE__ |
|
| 988 | ); |
|
| 989 | $success = false; |
|
| 990 | } |
|
| 991 | $STA_name = isset($this->_req_data['STA_name']) |
|
| 992 | ? sanitize_text_field($this->_req_data['STA_name']) |
|
| 993 | : false; |
|
| @@ 994-1002 (lines=9) @@ | ||
| 991 | $STA_name = isset($this->_req_data['STA_name']) |
|
| 992 | ? sanitize_text_field($this->_req_data['STA_name']) |
|
| 993 | : false; |
|
| 994 | if (! $STA_name) { |
|
| 995 | EE_Error::add_error( |
|
| 996 | esc_html__('No State name or an invalid State name was received.', 'event_espresso'), |
|
| 997 | __FILE__, |
|
| 998 | __FUNCTION__, |
|
| 999 | __LINE__ |
|
| 1000 | ); |
|
| 1001 | $success = false; |
|
| 1002 | } |
|
| 1003 | ||
| 1004 | if ($success) { |
|
| 1005 | $cols_n_values = array( |
|
| @@ 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)); |
|