plugin updates

This commit is contained in:
Tony Volpe
2024-11-25 13:10:11 -05:00
parent 864fe717f9
commit 76d447655a
48 changed files with 1945 additions and 200 deletions

View File

@@ -211,11 +211,9 @@ var wpmfGalleryModule;
uploader.bind('BeforeUpload', function(up, file) {
var multipart_params = up.settings.multipart_params;
multipart_params['wpmf_nonce'] = wmpf_nonce;
multipart_params['no_move'] = 1;
multipart_params['wpmf_folder'] = get_wpmf_folder;
if (is_local_to_cloud) {
multipart_params['id_category'] = get_wpmf_folder;
multipart_params['no_move'] = null;
multipart_params['current_category'] = 0;
}
up.settings.multipart_params = multipart_params;
@@ -225,7 +223,6 @@ var wpmfGalleryModule;
uploader.bind('BeforeUpload', function(up, file) {
var multipart_params = up.settings.multipart_params;
multipart_params['wpmf_folder'] = 0;
multipart_params['no_move'] = 1;
multipart_params['wpmf_nonce'] = wmpf_nonce;
if (get_wpmf_folder) {
multipart_params['wpmf_folder'] = get_wpmf_folder;
@@ -242,7 +239,6 @@ var wpmfGalleryModule;
multipart_params['wpmf_nonce'] = wmpf_nonce;
if (is_local_to_cloud) {
multipart_params['id_category'] = id_category;
multipart_params['no_move'] = null;
multipart_params['current_category'] = 0;
} else {
multipart_params['wpmf_folder'] = id_category;
@@ -251,6 +247,48 @@ var wpmfGalleryModule;
});
})
});
//change url thumbnail when upload to cloud
setInterval(function(){
// Check if element exist
if ($('#media-items .media-item').length > 0) {
const ele_pinky = document.querySelectorAll(".pinkynail");
const title = document.querySelectorAll(".attachment-details .media-list-subtitle");
const ele_button_copy = document.querySelectorAll(".attachment-details .attachment-tools button");
const media_item = document.querySelectorAll(".media-item");
if (ele_pinky && title && ele_button_copy && media_item) {
for (let i = 0; i < ele_pinky.length; i++) {
var src = ele_pinky[i].currentSrc;
var file_name = title[i].innerHTML;
var ext = file_name.split('.').pop();
var element_id = media_item[i].id;
if (src && file_name && ext && element_id) {
var url_thumb = ele_button_copy[i].dataset.clipboardText;
//check type of file
if(url_thumb) {
if (file_name.indexOf('.pdf') > 0 || file_name.indexOf('.doc') > 0) {
url_thumb = wpmf.vars.site_url + '/wp-includes/images/media/document.svg';
} else if (file_name.indexOf('.mp3') > 0) {
url_thumb = wpmf.vars.site_url + '/wp-includes/images/media/audio.svg';
} else if (file_name.indexOf('.mp4') > 0) {
url_thumb = wpmf.vars.site_url + '/wp-includes/images/media/video.svg';
} else if (file_name.indexOf('.avif') > 0 && url_thumb.indexOf('admin-ajax.php?action=wpmf_onedrive_download') < 0 && url_thumb.indexOf('dl.dropboxusercontent.com') < 0 && url_thumb.indexOf('drive.google.com') < 0) {
url_thumb = wpmf.vars.site_url + '/wp-includes/images/media/default.svg';
} else if (file_name.indexOf('.xls') > 0 || file_name.indexOf('.csv') > 0) {
url_thumb = wpmf.vars.site_url + '/wp-includes/images/media/spreadsheet.svg';
} else if (file_name.indexOf('.pptx') > 0) {
url_thumb = wpmf.vars.site_url + '/wp-includes/images/media/interactive.svg';
} else if (file_name.indexOf('.txt') > 0) {
url_thumb = wpmf.vars.site_url + '/wp-includes/images/media/text.svg';
}
var element_image = '#' + element_id + ' img';
$(element_image).attr('src', url_thumb);
}
}
}
}
}
}, 1500);
});
})(jQuery);

View File

@@ -214,22 +214,23 @@ var wpmfFoldersModule = void 0,
}
}
})
//Select tag for media
$('#doaction').on('click', function (e) {
var action = $('#bulk-action-selector-top').val();
if (wpmf.vars.wpmf_pagenow === 'upload.php' && action == 'tag') {
e.preventDefault();
//get list post id
var cboxes = document.getElementsByName('media[]');
var post_ids = [];
var len = cboxes.length;
if (cboxes !== 'undefined') {
for (var i=0; i<len; i++) {
if(cboxes[i].checked) {
post_ids.push(cboxes[i].value);
}
//get list post id
var cboxes = document.getElementsByName('media[]');
var post_ids = [];
var len = cboxes.length;
if (cboxes !== 'undefined') {
for (var i=0; i<len; i++) {
if(cboxes[i].checked) {
post_ids.push(cboxes[i].value);
}
}
}
//Select tag for media
if (wpmf.vars.wpmf_pagenow === 'upload.php' && action == 'tag') {
e.preventDefault();
if (post_ids.length > 0) {
var html = "<p class='tag-note'>To select a tag, first choose one from the existing list. If the tag you need isn't there, you can create a new one.</p>";
html += '<input name="tags-outside" class="tagify--outside" value="" placeholder="Write tags to add below">';
@@ -333,6 +334,80 @@ var wpmfFoldersModule = void 0,
}
});
//fix delete file submit on list view
$('.wp-list-table .row-actions .delete .submitdelete').attr('onclick', 'return');
$('.wp-list-table .row-actions .delete .submitdelete').off('click').on('click', function (e) {
e.preventDefault();
var confirm = showNotice.warn();
if (confirm) {
var href = $(this).attr('href');
var id = href.substring(
href.indexOf("post=") + 5,
href.lastIndexOf("&")
);
if (id && !isNaN(id)){
$.ajax({
type: "POST",
url: wpmf.vars.ajaxurl,
data: {
action: "wpmf",
task: "delete_file",
id: id,
wpmf_nonce: wpmf.vars.wpmf_nonce
},
success: function success(response) {
if (response.status) {
window.location.reload();
}
}
});
}
}
});
// add iframe to play mp4 in attachment detail on google drive
$('#wp-media-grid .media-frame').off('click').on('click', function (e) {
var file_name = $(".attachment-info .details .filename").html();
if (file_name && file_name.indexOf('.mp4') > 0) {
var src = $('.thumbnail-video img').attr('src');
if (src && src.indexOf('drive.google.com') > 0) {
//get id video
var id = src.substring(
src.indexOf("id=") + 3,
src.lastIndexOf("&")
);
$('.wp-video').remove();
$('.thumbnail-video .details-image').remove();
$('.thumbnail-video').attr('style', 'width: 480px; height: 270px');
if (id) {
var html = "<iframe src='https://drive.google.com/file/d/" + id + "/preview' width='100%' height='100%' allow='autoplay'";
html += "></iframe>";
$('.thumbnail-video').append(html);
}
}
} else if (file_name && file_name.indexOf('.mp3') > 0) {
var src = $('.thumbnail-audio .wp-audio-shortcode mediaelementwrapper audio').attr('src');
if (src && src.indexOf('drive.google.com') > 0) {
//get id video
var id = src.substring(
src.indexOf("id=") + 3,
src.lastIndexOf("&e")
);
//get width and height video
$('.wp-audio').remove();
if (id) {
var html = "<iframe src='https://drive.google.com/file/d/" + id + "/preview' allow='autoplay'";
html += "></iframe>";
$('.thumbnail-audio').append(html);
}
}
}
//fix style for google item
if (file_name && file_name.indexOf('.mp3') > 0 || file_name && file_name.indexOf('.csv') > 0 || file_name && file_name.indexOf('.zip') > 0) {
$('.thumbnail .details-image').attr('style', 'background-image:none');
}
})
// add bulk upload to s3 button
if (parseInt(wpmf.vars.copy_files_to_bucket) === 1) {
if (!$current_frame.find('.bulk-upload-s3-btn').length) {
@@ -558,7 +633,6 @@ var wpmfFoldersModule = void 0,
}
var multipart_params = up.settings.multipart_params;
multipart_params['wpmf_nonce'] = wpmf.vars.wpmf_nonce;
multipart_params['no_move'] = 1;
multipart_params['wpmf_folder'] = e.wpmf_folder;
up.settings.multipart_params = multipart_params;
});
@@ -921,7 +995,7 @@ var wpmfFoldersModule = void 0,
/**
* We extend the AttachmentFilters view to add our own filtering
*/
if (typeof wp.media.view.AttachmentFilters !== "undefined") {
if (typeof wp.media !== 'undefined' && typeof wp.media.view !== 'undefined' && typeof wp.media.view.AttachmentFilters !== "undefined") {
wp.media.view.AttachmentFilters['wpmf_categories'] = wp.media.view.AttachmentFilters.extend({
className: 'wpmf-media-categories attachment-filters',
id: 'wpmf-media-category',
@@ -963,7 +1037,9 @@ var wpmfFoldersModule = void 0,
}
// render filter
var myAttachmentsBrowser = wp.media.view.AttachmentsBrowser;
if (typeof wp.media !== "undefined" && typeof wp.media.view !== "undefined" && typeof wp.media.view.AttachmentsBrowser !== "undefined") {
var myAttachmentsBrowser = wp.media.view.AttachmentsBrowser;
}
if (typeof myAttachmentsBrowser !== "undefined") {
wp.media.view.AttachmentsBrowser = wp.media.view.AttachmentsBrowser.extend({
@@ -1011,7 +1087,9 @@ var wpmfFoldersModule = void 0,
}
// order image gallery
var myMediaControllerGalleryEdit = wp.media.controller.GalleryEdit;
if (typeof wp.media !== "undefined" && typeof wp.media.controller !== "undefined" && typeof wp.media.controller.GalleryEdit !== "undefined") {
var myMediaControllerGalleryEdit = wp.media.controller.GalleryEdit;
}
if (typeof myMediaControllerGalleryEdit !== "undefined") {
wp.media.controller.GalleryEdit = wp.media.controller.GalleryEdit.extend({
gallerySettings: function gallerySettings(browser) {
@@ -1063,7 +1141,9 @@ var wpmfFoldersModule = void 0,
}
// Reload folders after searching
var mySearch = wp.media.view.Search;
if (typeof wp.media !== "undefined" && typeof wp.media.view !== "undefined" && typeof wp.media.view.Search !== "undefined") {
var mySearch = wp.media.view.Search;
}
var search_initialized = false;
if (typeof mySearch !== "undefined") {
wp.media.view.Search = wp.media.view.Search.extend({
@@ -1502,7 +1582,7 @@ var wpmfFoldersModule = void 0,
}
if (parseInt(wpmf.vars.wpmf_post_type) !== 1 || !$('#wpb_visual_composer').is(":visible")) {
if (typeof wp.media.frame !== 'undefined' && typeof wp.media.frame._state !== 'undefined') {
if (typeof wp.media !== 'undefined' && typeof wp.media.frame !== 'undefined' && typeof wp.media.frame._state !== 'undefined') {
var first_file = files[0];
var relativePath = first_file.relativePath;
var relativePaths = relativePath.split('/');

View File

@@ -87,7 +87,12 @@ class WpMediaFolder
add_filter('wp_prepare_attachment_for_js', array($this, 'svgsResponseForSvg'), 10, 3);
add_filter('wp_prepare_attachment_for_js', array($this, 'prepareAttachmentForJs'), 10, 3);
add_action('admin_footer', array($this, 'editorFooter'));
$format_mediatitle = wpmfGetOption('format_mediatitle');
$format_mediatitle = 1;
$settings = get_option('wpmf_settings');
if (isset($settings) && isset($settings['format_mediatitle'])) {
$format_mediatitle = $settings['format_mediatitle'];
}
if ((int) $format_mediatitle === 1) {
add_action('add_attachment', array($this, 'updateFileTitle'));
}
@@ -121,6 +126,7 @@ class WpMediaFolder
add_action('pre_get_posts', array($this, 'addTagFilter'), 10, 1);
add_filter('attachment_fields_to_edit', array($this, 'changeTagSlugToName'), 10, 2);
add_filter('attachment_fields_to_edit', array($this, 'addTagHelps'), 10, 2);
add_action('pre_delete_attachment', array($this, 'deleteAttachmentCloud'), 11, 2);
}
/**
@@ -3489,9 +3495,31 @@ class WpMediaFolder
$attach_data = wp_generate_attachment_metadata($id_file, $file_dir . $newname);
wp_update_attachment_metadata($id_file, $attach_data);
}
//check is cloud
$id_category_new = $id_category;
$parent = $this->getFolderParent($id_category, $id_category);
$cloud_folder_type = wpmfGetCloudFolderType($parent);
if ($cloud_folder_type !== 'local') {
$id_category = 0;
}
do_action('wpmf_add_attachment', $id_file, $id_category);
// set attachment to term
wp_set_object_terms((int)$id_file, (int)$id_category, WPMF_TAXO, false);
wp_set_object_terms((int)$id_file, (int)$id_category_new, WPMF_TAXO, false);
if ($cloud_folder_type !== 'local') {
// check current folder
$current_category = 0;
// compability with WPML plugin
WpmfHelper::moveFileWpml($id_file, $current_category, $parent);
wp_remove_object_terms((int) $id_file, $current_category, WPMF_TAXO);
$params = array('trigger' => 'move_attachment');
$params['local_to_cloud'] = 1;
do_action('wpmf_attachment_set_folder', $id_file, (int)$parent, $params);
}
wp_send_json(array('status' => true, 'id_file' => $id_file, 'name' => $newname, 'id_category' => $id_category));
@@ -3690,6 +3718,21 @@ class WpMediaFolder
if (is_wp_error($inserted)) {
wp_send_json(array('status' => false, 'msg' => $inserted->get_error_message()));
} else {
// create physical folder
$folder_options = get_option('wpmf_queue_options');
if (isset($folder_options['enable_physical_folders']) && !empty($folder_options['enable_physical_folders'])) {
$cat_path = get_term_parents_list($inserted['term_id'], WPMF_TAXO, array(
'separator' => '/',
'link' => false,
'format' => 'name',
));
$upload_dir = wp_upload_dir();
$folder_dir = $upload_dir['basedir'] . '/' . trim($cat_path, '/');
if (!file_exists($folder_dir)) {
wp_mkdir_p($folder_dir);
}
}
// update term_group for new term
$updateted = wp_update_term($inserted['term_id'], WPMF_TAXO, array('term_group' => $user_id));
$termInfos = get_term($updateted['term_id'], WPMF_TAXO);
@@ -3826,11 +3869,12 @@ class WpMediaFolder
/**
* Do remove multiple folders
*
* @param string $folder_list Folder list id
* @param string $folder_list Folder list id
* @param boolean $remove_on_cloud Remove file on cloud
*
* @return boolean
*/
public function doRemoveFolders($folder_list)
public function doRemoveFolders($folder_list, $remove_on_cloud = true)
{
$wpmf_list_sync_media = get_option('wpmf_list_sync_media');
$wpmf_ao_lastRun = get_option('wpmf_ao_lastRun');
@@ -3877,7 +3921,9 @@ class WpMediaFolder
$type = get_term_meta((int) $sub_folder_id, 'wpmf_drive_root_type', true);
if (empty($type)) {
$term = get_term($sub_folder_id, WPMF_TAXO);
do_action('wpmf_before_delete_folder', $term);
if ($remove_on_cloud) {
do_action('wpmf_before_delete_folder', $term);
}
wp_delete_term($sub_folder_id, WPMF_TAXO);
/**
* Delete a folder
@@ -3904,6 +3950,9 @@ class WpMediaFolder
}
} else {
foreach ($attachments as $attachment_id) {
if (!$remove_on_cloud) {
remove_action('pre_delete_attachment', array($this, 'deleteAttachmentCloud'), 11);
}
wp_delete_attachment($attachment_id);
}
@@ -5895,31 +5944,31 @@ class WpMediaFolder
$option_cloud_google_drive = get_option(self::$option_google_drive_config);
$folder_google_drive = get_terms(array('name' => 'Google Drive', 'parent' => 0, 'hide_empty' => false, 'taxonomy' => WPMF_TAXO));
if (!is_wp_error($folder_google_drive) && $folder_google_drive && (!isset($option_cloud_google_drive['connected']) || $option_cloud_google_drive['connected'] !== 1)) {
$this->doRemoveFolders($folder_google_drive[0]->term_id);
$this->doRemoveFolders($folder_google_drive[0]->term_id, false);
}
//on Dropbox
$option_cloud_dropbox = get_option(self::$option_dropbox_config);
$folder_dropbox = get_terms(array('name' => 'Dropbox', 'parent' => 0, 'hide_empty' => false, 'taxonomy' => WPMF_TAXO));
if (!is_wp_error($folder_dropbox) && $folder_dropbox && empty($option_cloud_dropbox['dropboxToken'])) {
$this->doRemoveFolders((int)$folder_dropbox[0]->term_id);
$this->doRemoveFolders((int)$folder_dropbox[0]->term_id, false);
}
//on One Drive
$option_cloud_one_drive = get_option(self::$option_one_drive_config);
$folder_one_drive = get_terms(array('name' => 'Onedrive', 'parent' => 0, 'hide_empty' => false, 'taxonomy' => WPMF_TAXO));
if (!is_wp_error($folder_one_drive) && $folder_one_drive && !isset($option_cloud_one_drive['connected'])) {
$this->doRemoveFolders((int)$folder_one_drive[0]->term_id);
$this->doRemoveFolders((int)$folder_one_drive[0]->term_id, false);
}
//on One Drive business
$option_cloud_one_drive_business = get_option(self::$option_one_drive_business_config);
$folder_one_drive_business = get_terms(array('name' => 'Onedrive Business', 'parent' => 0, 'hide_empty' => false, 'taxonomy' => WPMF_TAXO));
if (!is_wp_error($folder_one_drive_business) && $folder_one_drive_business && !isset($option_cloud_one_drive_business['connected'])) {
$this->doRemoveFolders((int)$folder_one_drive_business[0]->term_id);
$this->doRemoveFolders((int)$folder_one_drive_business[0]->term_id, false);
}
//on Next Cloud
$connect_nextcloud = wpmfGetOption('connect_nextcloud');
$folder_next_cloud = get_terms(array('name' => 'Nextcloud', 'parent' => 0, 'hide_empty' => false, 'taxonomy' => WPMF_TAXO));
if (!is_wp_error($folder_next_cloud) && $folder_next_cloud && empty($connect_nextcloud)) {
$this->doRemoveFolders((int)$folder_next_cloud[0]->term_id);
$this->doRemoveFolders((int)$folder_next_cloud[0]->term_id, false);
}
}
@@ -6033,4 +6082,17 @@ class WpMediaFolder
return $form_fields;
}
/**
* Delete file on cloud
*
* @param object $null Null.
* @param object $post Post.
*
* @return void
*/
public function deleteAttachmentCloud($null, $post)
{
do_action('wpmf_delete_attachment_cloud', $post->ID);
}
}

View File

@@ -176,9 +176,7 @@ class JUQueueActions
'update_database' => false,
'action' => 'wpmf_physical_folders'
);
if (!isset($_POST['no_move']) && wp_verify_nonce($_POST['wpmf_nonce'], 'wpmf_nonce')) {
JUQueueHelper::moveFile($datas);
}
JUQueueHelper::moveFile($datas);
}
if (isset($data['file']) && isset($destination) && $destination) {

View File

@@ -3,7 +3,7 @@ Tags: media, folder
Requires at least: 4.7.0
Tested up to: 6.7
Requires PHP: 5.6
Stable tag: 5.9.11
Stable tag: 5.9.12
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -20,6 +20,10 @@ Stop searching for an image through thousand of media, just navigate like you do
= Changelog =
= 5.9.12 =
* Fix : Thumbnail display issue on file uploads in some cases
* Fix : Error physical folder upload
= 5.9.11 =
* Fix : Disable warning _load_textdomain_just_in_time in WordPress 6.7
* Fix : Error when missing required PHP DOM extension

View File

@@ -163,7 +163,7 @@ class JUCheckRequirements
if (!function_exists('get_plugin_data')) {
include_once(ABSPATH . 'wp-admin/includes/plugin.php');
}
$addonData = get_plugin_data(WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . self::$path, false);
$addonData = get_plugin_data(WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . self::$path, false, false);
self::$version = isset($addonData['Version']) ? $addonData['Version'] : null;
}
@@ -201,7 +201,7 @@ class JUCheckRequirements
}
/* translators: Plugins name and requirement module name */
// phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralDomain,WordPress.WP.I18n.NonSingularStringLiteralText
$message = __('<strong>%s</strong> requires php extension <strong>%s</strong> installed.' . $additionsMessage, self::$namedomain);
$message = '<strong>%s</strong> requires php extension <strong>%s</strong> installed.' . $additionsMessage;
self::addText(
$type,
sprintf(strip_tags($message, '<strong>'), self::$name, $module)
@@ -228,7 +228,7 @@ class JUCheckRequirements
}
/* translators: Plugins name and requirement class name */
// phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralDomain,WordPress.WP.I18n.NonSingularStringLiteralText
$message = __('<strong>%s</strong> requires php class <strong>%s</strong> to be enable.' . $additionsMessage, self::$namedomain);
$message = '<strong>%s</strong> requires php class <strong>%s</strong> to be enable.' . $additionsMessage;
self::addText(
$type,
sprintf(strip_tags($message, '<strong>'), self::$name, $class)
@@ -254,7 +254,7 @@ class JUCheckRequirements
}
/* translators: Plugins name and requirement function name */
// phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralDomain,WordPress.WP.I18n.NonSingularStringLiteralText
$message = __('<strong>%s</strong> requires php function <strong>%s</strong> to be enable.' . $additionsMessage, self::$namedomain);
$message = '<strong>%s</strong> requires php function <strong>%s</strong> to be enable.' . $additionsMessage;
self::addText(
$type,
sprintf(strip_tags($message, '<strong>'), self::$name, $function)
@@ -274,7 +274,7 @@ class JUCheckRequirements
if (version_compare(PHP_VERSION, self::$requirePhpVersion, '<')) {
/* translators: Plugins name and version */
// phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralDomain,WordPress.WP.I18n.NonSingularStringLiteralText
$message = __('<strong>%1$s</strong> need at least PHP %2$s version, please update php before installing the plugin.', self::$namedomain);
$message = '<strong>%1$s</strong> need at least PHP %2$s version, please update php before installing the plugin.';
self::addText(
'error',
sprintf(strip_tags($message, '<strong>'), self::$name, self::$requirePhpVersion)
@@ -300,7 +300,7 @@ class JUCheckRequirements
if (!is_plugin_active($plugin['path'])) {
/* translators: Plugins name and plugin requirement name */
// phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralDomain,WordPress.WP.I18n.NonSingularStringLiteralText
$message = __('<strong>%1$s</strong> requires <strong>%2$s</strong> plugin to be activated.', self::$namedomain);
$message = '<strong>%1$s</strong> requires <strong>%2$s</strong> plugin to be activated.';
self::addText(
isset($plugin['type']) ? $plugin['type'] : 'error',
sprintf(strip_tags($message, '<strong>'), self::$name, $plugin['name'])
@@ -311,13 +311,13 @@ class JUCheckRequirements
// Check minimum of require plugin version if set
if (isset($plugin['requireVersion']) && $plugin['requireVersion'] !== '') {
$requireVersion = $plugin['requireVersion'];
$addonData = get_plugin_data($pluginPath, false);
$addonData = get_plugin_data($pluginPath, false, false);
$installedVersion = (isset($addonData['Version']) && strpos($addonData['Version'], '{{version') === false) ? $addonData['Version'] : null;
if ($installedVersion !== null) {
if (self::versionCompare((string) $installedVersion, '<', (string) $requireVersion)) {
/* translators: Plugins name and requirement function name */
// phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralDomain,WordPress.WP.I18n.NonSingularStringLiteralText
$message = __('<strong>%1$s %2$s</strong> requires at least <strong>%3$s %4$s</strong>.', self::$namedomain);
$message = '<strong>%1$s %2$s</strong> requires at least <strong>%3$s %4$s</strong>.';
self::addText(
'error',
sprintf(strip_tags($message, '<strong>'), self::$name, self::$version, $plugin['name'], $requireVersion)
@@ -356,13 +356,13 @@ class JUCheckRequirements
if (function_exists('get_plugin_data')) {
$pluginPath = WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $addonPath;
if (file_exists($pluginPath)) {
$addonData = get_plugin_data($pluginPath, false);
$addonData = get_plugin_data($pluginPath, false, false);
$addonVersion = (isset($addonData['Version']) && strpos($addonData['Version'], '{{version') === false) ? $addonData['Version'] : null;
if ($addonVersion !== null) {
if (self::versionCompare($addonVersion, '<', $requireVersion)) {
/* translators: Plugins name and requirement function name */
// phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralDomain,WordPress.WP.I18n.NonSingularStringLiteralText
$message = __('Minimum required version of <strong>%1$s is %2$s</strong> to work with <strong>%3$s %4$s</strong>. Please update the plugin automatically or manually by downloading the latest version from JoomUnited website.', self::$namedomain);
$message = 'Minimum required version of <strong>%1$s is %2$s</strong> to work with <strong>%3$s %4$s</strong>. Please update the plugin automatically or manually by downloading the latest version from JoomUnited website.';
self::addText(
'warning',
sprintf(strip_tags($message, '<strong>'), $addonData['Name'], $requireVersion, self::$name, self::$version)

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.9.11
Version: 5.9.12
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.9.11');
define('WPMF_VERSION', '5.9.12');
define('WPMF_HIDE_USER_MEDIA_FOLDER_ROOT', true);
// disable warning function _load_textdomain_just_in_time was called incorrectly
@@ -245,15 +245,17 @@ if (is_admin()) {
* ***** DO NOT REMOVE *****
* End translate for queue class
*/
$args = wpmfGetQueueOptions(false);
$wpmfQueue = call_user_func('\Joomunited\Queue\JuMainQueue::getInstance', 'wpmf');
$wpmfQueue->init($args);
$folder_options = get_option('wpmf_queue_options');
if (!empty($folder_options['enable_physical_folders'])) {
require_once WP_MEDIA_FOLDER_PLUGIN_DIR . 'class/physical-folder' . DIRECTORY_SEPARATOR . 'wpmf.php';
new JUQueueActions();
require_once WP_MEDIA_FOLDER_PLUGIN_DIR . 'class/physical-folder' . DIRECTORY_SEPARATOR . 'helper.php';
}
add_action('init', function () {
$args = wpmfGetQueueOptions(false);
$wpmfQueue = call_user_func('\Joomunited\Queue\JuMainQueue::getInstance', 'wpmf');
$wpmfQueue->init($args);
$folder_options = get_option('wpmf_queue_options');
if (!empty($folder_options['enable_physical_folders'])) {
require_once WP_MEDIA_FOLDER_PLUGIN_DIR . 'class/physical-folder' . DIRECTORY_SEPARATOR . 'wpmf.php';
new JUQueueActions();
require_once WP_MEDIA_FOLDER_PLUGIN_DIR . 'class/physical-folder' . DIRECTORY_SEPARATOR . 'helper.php';
}
});
add_action(
'wpmf_before_delete_folder',
@@ -286,50 +288,66 @@ if (is_admin()) {
}
}
}, 10);
add_action('wpmf_delete_attachment', function ($id) {
$queue_id = get_post_meta($id, 'wpmf_sync_queue', true);
$wpmfQueue = \Joomunited\Queue\JuMainQueue::getInstance('wpmf');
if (!empty($queue_id)) {
if (is_array($queue_id)) {
foreach ($queue_id as $queueID) {
$wpmfQueue->deleteQueue($queueID);
}
} else {
$wpmfQueue->deleteQueue($queue_id);
}
}
}, 10);
}
if (!class_exists('\Joomunited\WPMF\JUCheckRequirements')) {
require_once(trailingslashit(dirname(__FILE__)) . 'requirements.php');
}
if (class_exists('\Joomunited\WPMF\JUCheckRequirements')) {
// Plugins name for translate
$args = array(
'plugin_name' => esc_html__('WP Media Folder', 'wpmf'),
'plugin_path' => wpmfGetPath(),
'plugin_textdomain' => 'wpmf',
'requirements' => array(
'php_version' => '5.6',
'php_modules' => array(
'curl' => 'warning'
),
'functions' => array(
'gd_info' => 'warning'
),
// Minimum addons version
'addons_version' => array(
'wpmfAddons' => '3.6.9',
'wpmfGalleryAddons' => '2.4.6'
)
),
);
$wpmfCheck = call_user_func('\Joomunited\WPMF\JUCheckRequirements::init', $args);
if (!$wpmfCheck['success']) {
// Do not load anything more
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- No action, nonce is not required
unset($_GET['activate']);
return;
add_action('init', function () {
if (!class_exists('\Joomunited\WPMF\JUCheckRequirements')) {
require_once(trailingslashit(dirname(__FILE__)) . 'requirements.php');
}
if (isset($wpmfCheck) && !empty($wpmfCheck['load'])) {
foreach ($wpmfCheck['load'] as $addonName) {
if (function_exists($addonName . 'Init')) {
call_user_func($addonName . 'Init');
if (class_exists('\Joomunited\WPMF\JUCheckRequirements')) {
// Plugins name for translate
$args = array(
'plugin_name' => esc_html__('WP Media Folder', 'wpmf'),
'plugin_path' => wpmfGetPath(),
'plugin_textdomain' => 'wpmf',
'requirements' => array(
'php_version' => '7.4',
'php_modules' => array(
'curl' => 'warning'
),
'functions' => array(
'gd_info' => 'warning'
),
// Minimum addons version
'addons_version' => array(
'wpmfAddons' => '3.6.9',
'wpmfGalleryAddons' => '2.4.6'
)
),
);
$wpmfCheck = call_user_func('\Joomunited\WPMF\JUCheckRequirements::init', $args);
if (!$wpmfCheck['success']) {
// Do not load anything more
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- No action, nonce is not required
unset($_GET['activate']);
return;
}
if (isset($wpmfCheck) && !empty($wpmfCheck['load'])) {
foreach ($wpmfCheck['load'] as $addonName) {
if (function_exists($addonName . 'Init')) {
call_user_func($addonName . 'Init');
}
}
}
}
}
});
/**
* Get queue options
@@ -890,6 +908,7 @@ function wpmfGetOption($option_name)
require_once(WP_MEDIA_FOLDER_PLUGIN_DIR . 'class/class-helper.php');
$frontend = get_option('wpmf_option_mediafolder');
if (!empty($frontend) || is_admin()) {
global $wpmfwatermark;
require_once(WP_MEDIA_FOLDER_PLUGIN_DIR . 'class/class-main.php');
@@ -1252,8 +1271,10 @@ if (isset($enable_gallery) && (int) $enable_gallery === 1) {
}
if (is_admin()) {
require_once(WP_MEDIA_FOLDER_PLUGIN_DIR . 'class/class-wp-folder-option.php');
new WpmfMediaFolderOption;
add_action('init', function () {
require_once(WP_MEDIA_FOLDER_PLUGIN_DIR . 'class/class-wp-folder-option.php');
new WpmfMediaFolderOption;
});
}
$wpmf_option_singlefile = get_option('wpmf_option_singlefile');
@@ -1271,12 +1292,14 @@ if (isset($wpmf_option_lightboximage) && (int) $wpmf_option_lightboximage === 1)
require_once(WP_MEDIA_FOLDER_PLUGIN_DIR . 'class/class-pdf-embed.php');
new WpmfPdfEmbed();
// load gif file on page load or not
$load_gif = wpmfGetOption('load_gif');
if (isset($load_gif) && (int) $load_gif === 0) {
require_once(WP_MEDIA_FOLDER_PLUGIN_DIR . 'class/class-load-gif.php');
new WpmfLoadGif();
}
add_action('init', function () {
// load gif file on page load or not
$load_gif = wpmfGetOption('load_gif');
if (isset($load_gif) && (int) $load_gif === 0) {
require_once(WP_MEDIA_FOLDER_PLUGIN_DIR . 'class/class-load-gif.php');
new WpmfLoadGif();
}
});
require_once(WP_MEDIA_FOLDER_PLUGIN_DIR . 'class/class-folder-post-type.php');
new WpmfMediaFolderPostType();
@@ -1636,10 +1659,13 @@ function wpmfRenderVideoIcon($attachment_id)
return '';
}
$remote_video = wpmfGetOption('hide_remote_video');
if ($remote_video) {
add_filter('the_content', 'wpmfFindImages');
}
add_action('init', function () {
$remote_video = wpmfGetOption('hide_remote_video');
if ($remote_video) {
add_filter('the_content', 'wpmfFindImages');
}
});
/**
* Find image in content
@@ -1707,7 +1733,7 @@ function wpmfFindImages($content)
}
}
}
// otherwise returns the database content
return $content;
}