Hey Steve,
To answer your questions:
1. The plugin uses WordPress native upload functionality, so you should be able to import PDFs if your WordPress allows it. However, I will have to look more into this as well, as iIwas unable to import PDF files.
2. To keep the plugin fairly simple and basic, it is using the WP default media upload functionality, thus if you upload twice, WordPress media library is adding it.
There are no big plans to add any advanced feature to the plugin, but if you’re looking to prevent dupes, you would just need to add a ping code into the uploadbymediaurl.php file.
It would be something like this:
foreach($multiurl as $mu) {
//download and insert as media attachment
if(!ping(esc_url_raw($mu)) { umbu_download(esc_url_raw($mu)); }
}
Then you can just add a ping code.
/**
* Check if an item exists out there in the "ether".
*
* @param string $url - preferably a fully qualified URL
* @return boolean - true if it is out there somewhere
*/
function ping($url) {
if (($url == '') || ($url == null)) { return false; }
$response = wp_remote_head( $url, array( 'timeout' => 5 ) );
$accepted_status_codes = array( 200, 301, 302 );
if ( ! is_wp_error( $response ) && in_array( wp_remote_retrieve_response_code( $response ), $accepted_status_codes ) ) {
return true;
}
return false;
}
Source: https://stackoverflow.com/questions/7952977/php-check-if-url-and-a-file-exists
I am marking this as a resolve issue, as WordPress itself does not prevent duplicates, and considering this plugin uses the native functions, it would add the file with a -2, -3, -4, etc. on to the end of it.
I have since tested this plugin and verified that you can, in fact, add PDFs to the media library via URL. Although I have seen some issues where PDFs are not imported due to it being on a CDN, which has been noted in the readme.txt file.