plugin update(wp-media-folder)

This commit is contained in:
Tony Volpe
2024-07-23 17:27:49 +00:00
12 changed files with 90 additions and 40 deletions

View File

@@ -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';
}
};
}

View File

@@ -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;

View File

@@ -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>';

View File

@@ -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) {

View File

@@ -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 {
</svg>
);
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 (
<div className="wpmf-divi-container wpmf-gallery-divi-wrap" ref={this.wrap}>
<div id="divi-gallery-addon-placeholder" className="divi-gallery-addon-placeholder">

View File

@@ -220,6 +220,17 @@ class WpmfGalleryAddonDivi extends ET_Builder_Module
'default' => 'off',
'default_on_front' => 'off'
),
'download_all' => array(
'label' => esc_html__('Download All Images', 'wpmf'),
'type' => 'yes_no_button',
'option_category' => 'configuration',
'options' => array(
'on' => esc_html__('On', 'wpmf'),
'off' => esc_html__('Off', 'wpmf'),
),
'default' => 'off',
'default_on_front' => 'off'
),
'columns' => array(
'label' => esc_html__('Columns', 'wpmf'),
'type' => 'range',
@@ -579,6 +590,7 @@ class WpmfGalleryAddonDivi extends ET_Builder_Module
$sub_galleries_listing = (!empty($this->props['sub_galleries_listing']) && $this->props['sub_galleries_listing'] === 'on') ? 1 : 0;
$gallery_image_tags = (!empty($this->props['gallery_image_tags']) && $this->props['gallery_image_tags'] === 'on') ? 1 : 0;
$disable_overlay = (!empty($this->props['disable_overlay']) && $this->props['disable_overlay'] === 'on') ? 1 : 0;
$download_all = (!empty($this->props['download_all']) && $this->props['download_all'] === 'on') ? 1 : 0;
if (!empty($this->props['enable_shadow']) && $this->props['enable_shadow'] === 'on') {
$img_shadow = $this->props['shadow_horizontal'] . ' ' . $this->props['shadow_vertical'] . ' ' . $this->props['shadow_blur'] . ' ' . $this->props['shadow_spread'] . ' ' . $this->props['shadow_color'];
} else {
@@ -602,7 +614,7 @@ class WpmfGalleryAddonDivi extends ET_Builder_Module
} else {
$gallery_id = $gallery_id_string;
}
return do_shortcode('[wpmfgallery gallery_id="'. (int)$gallery_id .'" display_tree="' . esc_attr($gallery_navigation) . '" sub_galleries_listing="' . esc_attr($sub_galleries_listing) . '" display_tag="' . esc_attr($gallery_image_tags) . '" disable_overlay="' . esc_attr($disable_overlay) . '" display="' . esc_attr($this->props['theme']) . '" layout="' . esc_attr($this->props['layout']) . '" row_height="' . esc_attr($this->props['row_height']) . '" aspect_ratio="' . esc_attr($this->props['aspect_ratio']) . '" columns="' . esc_attr($this->props['columns']) . '" size="' . esc_attr($this->props['size']) . '" targetsize="' . esc_attr($this->props['targetsize']) . '" link="' . esc_attr($this->props['action']) . '" wpmf_orderby="' . esc_attr($this->props['orderby']) . '" wpmf_order="' . esc_attr($this->props['order']) . '" gutterwidth="' . esc_attr($this->props['gutterwidth']) . '" border_width="' . esc_attr($this->props['border_width']) . '" border_style="' . esc_attr($this->props['border_style']) . '" border_color="' . esc_attr($this->props['border_color']) . '" img_shadow="' . esc_attr($img_shadow) . '" img_border_radius="' . esc_attr($this->props['border_radius']) . '" number_lines="' . esc_attr($this->props['number_lines']) . '" hover_color="'. $this->props['hover_color'] .'" hover_opacity="'. $this->props['hover_opacity'] .'" hover_title_position="'. $this->props['hover_title_position'] .'" hover_title_size="'. $this->props['hover_title_size'] .'" hover_title_color="'. $this->props['hover_title_color'] .'" hover_desc_position="'. $this->props['hover_desc_position'] .'" hover_desc_size="'. $this->props['hover_desc_size'] .'" hover_desc_color="'. $this->props['hover_desc_color'] .'"]');
return do_shortcode('[wpmfgallery gallery_id="'. (int)$gallery_id .'" display_tree="' . esc_attr($gallery_navigation) . '" sub_galleries_listing="' . esc_attr($sub_galleries_listing) . '" display_tag="' . esc_attr($gallery_image_tags) . '" download_all="' . esc_attr($download_all) . '" disable_overlay="' . esc_attr($disable_overlay) . '" display="' . esc_attr($this->props['theme']) . '" layout="' . esc_attr($this->props['layout']) . '" row_height="' . esc_attr($this->props['row_height']) . '" aspect_ratio="' . esc_attr($this->props['aspect_ratio']) . '" columns="' . esc_attr($this->props['columns']) . '" size="' . esc_attr($this->props['size']) . '" targetsize="' . esc_attr($this->props['targetsize']) . '" link="' . esc_attr($this->props['action']) . '" wpmf_orderby="' . esc_attr($this->props['orderby']) . '" wpmf_order="' . esc_attr($this->props['order']) . '" gutterwidth="' . esc_attr($this->props['gutterwidth']) . '" border_width="' . esc_attr($this->props['border_width']) . '" border_style="' . esc_attr($this->props['border_style']) . '" border_color="' . esc_attr($this->props['border_color']) . '" img_shadow="' . esc_attr($img_shadow) . '" img_border_radius="' . esc_attr($this->props['border_radius']) . '" number_lines="' . esc_attr($this->props['number_lines']) . '" hover_color="'. $this->props['hover_color'] .'" hover_opacity="'. $this->props['hover_opacity'] .'" hover_title_position="'. $this->props['hover_title_position'] .'" hover_title_size="'. $this->props['hover_title_size'] .'" hover_title_color="'. $this->props['hover_title_color'] .'" hover_desc_position="'. $this->props['hover_desc_position'] .'" hover_desc_size="'. $this->props['hover_desc_size'] .'" hover_desc_color="'. $this->props['hover_desc_color'] .'"]');
}
}

File diff suppressed because one or more lines are too long

View File

@@ -38,6 +38,7 @@ See https://github.com/adobe-type-tools/cmap-resources
wpmf_pdf_embed_obj.workerSrc = "<?php echo $plugins_url . 'assets/js/pdf-embed/pdf.worker.js'; // phpcs:ignore ?>";
wpmf_pdf_embed_obj.sandboxBundleSrc = "<?php echo $plugins_url . 'assets/js/pdf-embed/pdf.sandbox.js'; // phpcs:ignore ?>";
wpmf_pdf_embed_obj.imageResourcesPath = "<?php echo $plugins_url . 'assets/css/pdf-embed/images/'; // phpcs:ignore ?>";
wpmf_pdf_embed_obj.errorLoadingPdf = "<?php echo $plugins_url . 'assets/pdf-loading-error.pdf'; // phpcs:ignore ?>";
</script>
<script src="<?php echo $plugins_url . 'assets/js/pdf-embed/viewer.js' ?>"></script><?php // phpcs:ignore ?>
</head>

View File

@@ -1,9 +1,9 @@
=== WP Media Folder ===
Tags: media, folder
Requires at least: 4.7.0
Tested up to: 6.5
Tested up to: 6.6
Requires PHP: 5.6
Stable tag: 5.8.7
Stable tag: 5.8.8
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -20,6 +20,9 @@ Stop searching for an image through thousand of media, just navigate like you do
= Changelog =
= 5.8.8 =
* Fix : WPMF gallery widget issue in Divi theme
= 5.8.7 =
* Fix : Error in the block editor

View File

@@ -4,7 +4,7 @@
Plugin URI: http://www.joomunited.com
Description: WP media Folder is a WordPress plugin that enhance the WordPress media manager by adding a folder manager inside.
Author: Joomunited
Version: 5.8.7
Version: 5.8.8
Update URI: https://www.joomunited.com/juupdater_files/wp-media-folder.json
Author URI: http://www.joomunited.com
Text Domain: wpmf
@@ -79,7 +79,7 @@ if (!defined('WPMF_TAXO')) {
define('_WPMF_GALLERY_PREFIX', '_wpmf_gallery_');
define('WPMF_PLUGIN_URL', plugin_dir_url(__FILE__));
define('WPMF_DOMAIN', 'wpmf');
define('WPMF_VERSION', '5.8.7');
define('WPMF_VERSION', '5.8.8');
define('WPMF_HIDE_USER_MEDIA_FOLDER_ROOT', true);
include_once(ABSPATH . 'wp-admin/includes/plugin.php');

View File

@@ -1,4 +1,4 @@
{
"/app.js": "/app.js?id=def087bfee86b3ced20472c4fd21ee05",
"/app.css": "/app.css?id=9545ee817933a068647fce4aa802c148"
"/app.css": "/app.css?id=ea922a90dfef17cc6354d160d5b32ae6"
}