From aa4d364762bcd8196451eaf183db253b59415977 Mon Sep 17 00:00:00 2001 From: Tony Volpe Date: Tue, 23 Jul 2024 13:26:20 -0400 Subject: [PATCH] plugin update(wp-media-folder) --- .../assets/js/pdf-embed/viewer.js | 12 ++--- .../wp-media-folder/class/class-main.php | 6 +-- .../wp-media-folder/class/class-pdf-embed.php | 47 +++++++++++------- .../class/class-replace-file.php | 2 +- .../modules/GalleryAddon/GalleryAddon.jsx | 33 ++++++++++-- .../modules/GalleryAddon/GalleryAddon.php | 14 +++++- .../scripts/builder-bundle.min.js | 2 +- .../class/templates/pdf-embed.php | 1 + .../wp-media-folder/languages/wpmf-en_US.mo | Bin 68701 -> 69001 bytes .../plugins/wp-media-folder/readme.txt | 7 ++- .../wp-media-folder/wp-media-folder.php | 4 +- .../medicalalert/dist/mix-manifest.json | 2 +- 12 files changed, 90 insertions(+), 40 deletions(-) diff --git a/wp/wp-content/plugins/wp-media-folder/assets/js/pdf-embed/viewer.js b/wp/wp-content/plugins/wp-media-folder/assets/js/pdf-embed/viewer.js index e35a148b..66c9eae4 100644 --- a/wp/wp-content/plugins/wp-media-folder/assets/js/pdf-embed/viewer.js +++ b/wp/wp-content/plugins/wp-media-folder/assets/js/pdf-embed/viewer.js @@ -536,7 +536,10 @@ const PDFViewerApplication = { const queryString = document.location.search.substring(1); const params = (0, _ui_utils.parseQueryString)(queryString); file = params.get("file") ?? _app_options.AppOptions.get("defaultUrl"); - validateFileURL(file); + var checkValidateFileURL = validateFileURL(file); + if (checkValidateFileURL === 'error_loading') { + file = wpmf_pdf_embed_obj.errorLoadingPdf; + } const fileInput = appConfig.openFileInput; fileInput.value = null; fileInput.addEventListener("change", function (evt) { @@ -1646,12 +1649,7 @@ exports.PDFViewerApplication = PDFViewerApplication; throw new Error("file origin does not match viewer's"); } } catch (ex) { - PDFViewerApplication.l10n.get("loading_error").then(msg => { - PDFViewerApplication._documentError(msg, { - message: ex?.message - }); - }); - throw ex; + return 'error_loading'; } }; } diff --git a/wp/wp-content/plugins/wp-media-folder/class/class-main.php b/wp/wp-content/plugins/wp-media-folder/class/class-main.php index cea286b0..7634344f 100644 --- a/wp/wp-content/plugins/wp-media-folder/class/class-main.php +++ b/wp/wp-content/plugins/wp-media-folder/class/class-main.php @@ -122,7 +122,7 @@ class WpMediaFolder } if ($check === 'not_permission') { - wp_die(-3); + wp_die(esc_html__('You do not have permission to update this attachment', 'wpmf')); } } } @@ -160,7 +160,7 @@ class WpMediaFolder } if ($check === 'not_permission') { - wp_die(-3); + wp_die(esc_html__('You do not have permission to update this attachment', 'wpmf')); } return $maybe_empty; } @@ -198,7 +198,7 @@ class WpMediaFolder } if (null !== $check) { - wp_die(-3); + wp_die(esc_html__('You do not have permission to delete this attachment', 'wpmf')); } return $delete; diff --git a/wp/wp-content/plugins/wp-media-folder/class/class-pdf-embed.php b/wp/wp-content/plugins/wp-media-folder/class/class-pdf-embed.php index 7b9ead3f..73424e83 100644 --- a/wp/wp-content/plugins/wp-media-folder/class/class-pdf-embed.php +++ b/wp/wp-content/plugins/wp-media-folder/class/class-pdf-embed.php @@ -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 = '
'; } else { $return = ''.esc_html($title).''; diff --git a/wp/wp-content/plugins/wp-media-folder/class/class-replace-file.php b/wp/wp-content/plugins/wp-media-folder/class/class-replace-file.php index 6a6d8312..363ba0e4 100644 --- a/wp/wp-content/plugins/wp-media-folder/class/class-replace-file.php +++ b/wp/wp-content/plugins/wp-media-folder/class/class-replace-file.php @@ -94,7 +94,7 @@ it must be in the same format, ie. jpg > jpg… Thanks!', 'wpmf') ); } - unlink($filepath); + wp_delete_file($filepath); if (in_array($infopath['extension'], $allowedImageTypes)) { if (isset($metadata['sizes']) && is_array($metadata['sizes'])) { foreach ($metadata['sizes'] as $size => $sizeinfo) { diff --git a/wp/wp-content/plugins/wp-media-folder/class/divi-widgets/includes/modules/GalleryAddon/GalleryAddon.jsx b/wp/wp-content/plugins/wp-media-folder/class/divi-widgets/includes/modules/GalleryAddon/GalleryAddon.jsx index 57f9731a..fb670ad5 100644 --- a/wp/wp-content/plugins/wp-media-folder/class/divi-widgets/includes/modules/GalleryAddon/GalleryAddon.jsx +++ b/wp/wp-content/plugins/wp-media-folder/class/divi-widgets/includes/modules/GalleryAddon/GalleryAddon.jsx @@ -28,7 +28,7 @@ class WpmfGalleryAddonDivi extends Component { || this.props.border_width !== nextProps.border_width || this.props.border_color !== nextProps.border_color || this.props.border_style !== nextProps.border_style || this.props.enable_shadow !== nextProps.enable_shadow || this.props.shadow_color !== nextProps.shadow_color || this.props.shadow_horizontal !== nextProps.shadow_horizontal || this.props.shadow_vertical !== nextProps.shadow_vertical || this.props.shadow_blur !== nextProps.shadow_blur || this.props.shadow_spread !== nextProps.shadow_spread || this.props.gallery_image_tags !== nextProps.gallery_image_tags || this.props.gallery_navigation !== nextProps.gallery_navigation || this.props.sub_galleries_listing !== nextProps.sub_galleries_listing || this.props.number_lines !== nextProps.number_lines - || this.props.disable_overlay !== nextProps.disable_overlay || this.props.hover_color !== nextProps.hover_color || this.props.hover_opacity !== nextProps.hover_opacity || this.props.hover_title_position !== nextProps.hover_title_position + || this.props.disable_overlay !== nextProps.disable_overlay || this.props.download_all !== nextProps.download_all || this.props.hover_color !== nextProps.hover_color || this.props.hover_opacity !== nextProps.hover_opacity || this.props.hover_title_position !== nextProps.hover_title_position || this.props.hover_title_size !== nextProps.hover_title_size || this.props.hover_title_color !== nextProps.hover_title_color || this.props.hover_desc_position !== nextProps.hover_desc_position || this.props.hover_desc_size !== nextProps.hover_desc_size || this.props.hover_desc_color !== nextProps.hover_desc_color) { this.loadHtml(nextProps); @@ -36,7 +36,15 @@ class WpmfGalleryAddonDivi extends Component { } componentDidMount() { - if (parseInt(this.props.gallery_id) !== 0) { + let gallery_id_string = this.props.gallery_id; + let gallery_id; + if (gallery_id_string.indexOf('-') != -1) { + let gallery_ids = gallery_id_string.split('-'); + gallery_id = gallery_ids[1]; + } else { + gallery_id = gallery_id_string; + } + if (gallery_id !== 0) { let t = this; let a = setInterval(function () { $(t.wrap.current).find('.loading_gallery').hide(); @@ -73,7 +81,15 @@ class WpmfGalleryAddonDivi extends Component { componentDidUpdate(prevProps) { // Deselect images when deselecting the block - if (parseInt(this.props.gallery_id) !== 0 && !(this.props.gallery_id === prevProps.gallery_id && this.props.columns === prevProps.columns && this.props.theme === prevProps.theme && this.props.layout === prevProps.layout && this.props.row_height === prevProps.row_height && this.props.aspect_ratio === prevProps.aspect_ratio && this.props.size === prevProps.size && this.props.orderby === prevProps.orderby && this.props.order === prevProps.order && this.props.border_radius === prevProps.border_radius && this.props.gutterwidth === prevProps.gutterwidth && this.props.border_width === prevProps.border_width && this.props.border_color === prevProps.border_color && this.props.border_style === prevProps.border_style && this.props.enable_shadow === prevProps.enable_shadow && this.props.shadow_color === prevProps.shadow_color && this.props.shadow_horizontal === prevProps.shadow_horizontal && this.props.shadow_vertical === prevProps.shadow_vertical && this.props.shadow_blur === prevProps.shadow_blur && this.props.shadow_spread === prevProps.shadow_spread && this.props.gallery_image_tags === prevProps.gallery_image_tags && this.props.disable_overlay === prevProps.disable_overlay && this.props.gallery_navigation === prevProps.gallery_navigation && this.props.sub_galleries_listing === prevProps.sub_galleries_listing && this.props.number_lines === prevProps.number_lines && this.props.hover_color === prevProps.hover_color && this.props.hover_opacity === prevProps.hover_opacity && this.props.hover_title_position === prevProps.hover_title_position && this.props.hover_title_size === prevProps.hover_title_size && this.props.hover_title_color === prevProps.hover_title_color && this.props.hover_desc_position === prevProps.hover_desc_position && this.props.hover_desc_size === prevProps.hover_desc_size && this.props.hover_desc_color === prevProps.hover_desc_color)) { + let gallery_id_string = this.props.gallery_id; + let gallery_id; + if (gallery_id_string.indexOf('-') != -1) { + let gallery_ids = gallery_id_string.split('-'); + gallery_id = gallery_ids[1]; + } else { + gallery_id = gallery_id_string; + } + if (gallery_id !== 0 && !(gallery_id === prevProps.gallery_id && this.props.columns === prevProps.columns && this.props.theme === prevProps.theme && this.props.layout === prevProps.layout && this.props.row_height === prevProps.row_height && this.props.aspect_ratio === prevProps.aspect_ratio && this.props.size === prevProps.size && this.props.orderby === prevProps.orderby && this.props.order === prevProps.order && this.props.border_radius === prevProps.border_radius && this.props.gutterwidth === prevProps.gutterwidth && this.props.border_width === prevProps.border_width && this.props.border_color === prevProps.border_color && this.props.border_style === prevProps.border_style && this.props.enable_shadow === prevProps.enable_shadow && this.props.shadow_color === prevProps.shadow_color && this.props.shadow_horizontal === prevProps.shadow_horizontal && this.props.shadow_vertical === prevProps.shadow_vertical && this.props.shadow_blur === prevProps.shadow_blur && this.props.shadow_spread === prevProps.shadow_spread && this.props.gallery_image_tags === prevProps.gallery_image_tags && this.props.disable_overlay === prevProps.disable_overlay && this.props.download_all === prevProps.download_all && this.props.gallery_navigation === prevProps.gallery_navigation && this.props.sub_galleries_listing === prevProps.sub_galleries_listing && this.props.number_lines === prevProps.number_lines && this.props.hover_color === prevProps.hover_color && this.props.hover_opacity === prevProps.hover_opacity && this.props.hover_title_position === prevProps.hover_title_position && this.props.hover_title_size === prevProps.hover_title_size && this.props.hover_title_color === prevProps.hover_title_color && this.props.hover_desc_position === prevProps.hover_desc_position && this.props.hover_desc_size === prevProps.hover_desc_size && this.props.hover_desc_color === prevProps.hover_desc_color)) { let t = this; let a = setInterval(function () { $(t.wrap.current).find('.loading_gallery').hide(); @@ -376,6 +392,7 @@ class WpmfGalleryAddonDivi extends Component { sub_galleries_listing: props.sub_galleries_listing, display_tag: props.gallery_image_tags, disable_overlay: props.disable_overlay, + download_all: props.download_all, hover_color: props.hover_color, hover_opacity: props.hover_opacity, hover_title_position: props.hover_title_position, @@ -439,7 +456,15 @@ class WpmfGalleryAddonDivi extends Component { ); - if (parseInt(this.props.gallery_id) === 0) { + let gallery_id_string = this.props.gallery_id; + let gallery_id; + if (gallery_id_string.indexOf('-') != -1) { + let gallery_ids = gallery_id_string.split('-'); + gallery_id = gallery_ids[1]; + } else { + gallery_id = gallery_id_string; + } + if (gallery_id === 0) { return (