plugin update(wp-media-folder)
This commit is contained in:
@@ -160,24 +160,35 @@ class WpmfPdfEmbed
|
||||
}
|
||||
|
||||
$cloud_type = get_post_meta((int)$attrs['id'], 'wpmf_drive_type', true);
|
||||
if ($cloud_type === 'dropbox') {
|
||||
$drive_id = get_post_meta((int)$attrs['id'], 'wpmf_drive_id', true);
|
||||
$url = admin_url('admin-ajax.php') . '?action=wpmf-dbxdownload-file&id=' . urlencode($drive_id) . '&link=true&dl=0';
|
||||
$drive_id = get_post_meta((int)$attrs['id'], 'wpmf_drive_id', true);
|
||||
$baseUrl = admin_url('admin-ajax.php');
|
||||
switch ($cloud_type) {
|
||||
case 'dropbox':
|
||||
$action = '?action=wpmf-dbxdownload-file&id=' . urlencode($drive_id) . '&link=true&dl=0';
|
||||
break;
|
||||
case 'onedrive':
|
||||
$action = '?action=wpmf_onedrive_download&id=' . urlencode($drive_id) . '&link=true&dl=0';
|
||||
break;
|
||||
case 'onedrive_business':
|
||||
$action = '?action=wpmf_onedrive_business_download&id=' . urlencode($drive_id) . '&link=true&dl=0';
|
||||
break;
|
||||
case 'google_drive':
|
||||
$action = '?action=wpmf-download-file&id=' . urlencode($drive_id) . '&link=true&dl=0';
|
||||
break;
|
||||
case 'nextcloud':
|
||||
$action = '?action=wpmf_nextcloud_get_content&url=' . urlencode($url) . '/download';
|
||||
break;
|
||||
default:
|
||||
$action = '';
|
||||
$offload_infos = get_post_meta($attrs['id'], 'wpmf_awsS3_info', true);
|
||||
if (!empty($offload_infos)) {
|
||||
$action = '?action=wpmf_offload_get_content&url=' . urlencode($url);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ($cloud_type === 'onedrive') {
|
||||
$drive_id = get_post_meta((int)$attrs['id'], 'wpmf_drive_id', true);
|
||||
$url = admin_url('admin-ajax.php') . '?action=wpmf_onedrive_download&id=' . urlencode($drive_id) . '&link=true&dl=0';
|
||||
}
|
||||
|
||||
if ($cloud_type === 'onedrive_business') {
|
||||
$drive_id = get_post_meta((int)$attrs['id'], 'wpmf_drive_id', true);
|
||||
$url = admin_url('admin-ajax.php') . '?action=wpmf_onedrive_business_download&id=' . urlencode($drive_id) . '&link=true&dl=0';
|
||||
}
|
||||
|
||||
if ($cloud_type === 'google_drive') {
|
||||
$drive_id = get_post_meta((int)$attrs['id'], 'wpmf_drive_id', true);
|
||||
$url = admin_url('admin-ajax.php') . '?action=wpmf-download-file&id=' . urlencode($drive_id) . '&link=true&dl=0';
|
||||
if ($action) {
|
||||
$url = $baseUrl . $action;
|
||||
}
|
||||
|
||||
$title = $pdf->post_title;
|
||||
@@ -203,8 +214,8 @@ class WpmfPdfEmbed
|
||||
$url = $plugin_dir_url . 'assets/pdf-loading-error.pdf';
|
||||
}
|
||||
|
||||
$attachment_info = '?file=' . $url;
|
||||
$final_url = $viewer_base_url . $attachment_info . '&plugins_url=' . $plugin_dir_url;
|
||||
$attachment_info = '?file=' . urlencode($url);
|
||||
$final_url = $viewer_base_url . $attachment_info . '&plugins_url=' . urlencode($plugin_dir_url);
|
||||
$return = '<div><iframe width="' . esc_attr($width) . '" height="' . esc_attr($height) . '" src="' . esc_url($final_url) . '" title="Embedded PDF" class="wpmf-pdfjs-iframe"></iframe></div>';
|
||||
} else {
|
||||
$return = '<a href="'.esc_url($url).'" '. (($attrs['target'] !== '') ? 'target="'.esc_attr($attrs['target']).'"' : '') .'>'.esc_html($title).'</a>';
|
||||
|
||||
Reference in New Issue
Block a user