/**
 *	Verify file exists
 */
function verify_exists($file_path = null)
{
    // Ensure CDN instance exists
    if (check_cdn() === false || is_null($file_path)) {
        return false;
    }
    // Get CDN URL
    if (isset($_SESSION['cdn']->api_settings->custom_cname) && trim($_SESSION['cdn']->api_settings->custom_cname) != '') {
        $cdn_url = $_SESSION['cdn']->api_settings->custom_cname;
    } else {
        $cdn_url = isset($_SESSION['cdn']->api_settings->use_ssl) ? get_cdn_url('ssl') : get_cdn_url();
    }
    // Define variables needed
    $upload_dir = wp_upload_dir();
    // Get local file path
    $file_url = str_replace(array($cdn_url . '/', $upload_dir['basedir'] . '/', $upload_dir['baseurl'] . '/'), '', $file_path);
    // Return true/false if file exists on CDN or not
    return find_file_name($file_url, $cdn_objects);
}
/**
 *	Verify file exists
 */
function verify_exists($file_path)
{
    // Ensure CDN instance exists
    if (check_cdn() === false) {
        return false;
    }
    // Get CDN URL
    if (isset($_SESSION['cdn']->api_settings->custom_cname) && trim($_SESSION['cdn']->api_settings->custom_cname) != '') {
        $cdn_url = $_SESSION['cdn']->api_settings->custom_cname;
    } else {
        $cdn_url = isset($_SESSION['cdn']->api_settings->use_ssl) ? get_cdn_url('ssl') : get_cdn_url();
    }
    // Define variables needed
    $upload_dir = wp_upload_dir();
    // Replace CDN URL, base URL or base uploads directory
    $file_url = str_replace($cdn_url . '/', '', $file_path);
    $file_url = str_replace($upload_dir['baseurl'] . '/', '', $file_url);
    $file_url = str_replace($upload_dir['basedir'] . '/', '', $file_url);
    // Return true/false if file exists on CDN or not
    return find_file_name($file_url);
}