plugin updates

This commit is contained in:
Tony Volpe
2024-09-17 10:43:54 -04:00
parent 44b413346f
commit b7c8882c8c
1359 changed files with 58219 additions and 11364 deletions

View File

@@ -9,6 +9,12 @@
position: fixed;
background: #0b0b0b;
opacity: 0.8; }
.wpmf_folder_permissions_popup{
z-index: 1042 !important;}
.wpmf_folder_permissions_popup{
z-index: 1042 !important;}
.mfp-wrap {
top: 0;

View File

@@ -19,7 +19,7 @@
width: 90%;
max-width: 510px;
min-height: 25px;
margin: 10% auto;
margin: 13% auto;
z-index: 9999;
padding: 16px;
}

View File

@@ -3890,4 +3890,7 @@ body.wp-admin #wpcontent {
}
body.woocommerce-page th#taxonomy-wpmf-folder-type-product, body.woocommerce-admin-page th#taxonomy-wpmf-folder-type-product {
width: 10% !important;
}
#plupload-upload-ui{
margin-top: 10px;
}

View File

@@ -74,6 +74,9 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
}).then(function (result) {
if (result.status) {
$container.html(result.html);
if($container.find('.wpmf-pdfemb-viewer').length) {
$container.find('.wpmf-pdfemb-viewer').pdfEmbedder();
}
}
},
// errors

View File

@@ -33,6 +33,9 @@
(result) => {
if (result.status) {
$container.html(result.html);
if($container.find('.wpmf-pdfemb-viewer').length) {
$container.find('.wpmf-pdfemb-viewer').pdfEmbedder();
}
}
},
// errors

View File

@@ -95,6 +95,13 @@
if ($(this).find('a[data-lightbox="1"]').length) {
e.preventDefault();
var index = $(this).find('a[data-lightbox="1"]').data('index');
var item = (items[index]);
if (item['src'] !== "undefined") {
var check_video_kaltura = item['src'].indexOf("cdnapisec.kaltura.com");
if (check_video_kaltura !== "undefined" && check_video_kaltura > 0) {
$('.mfp-iframe-holder .mfp-content').css('max-width', '640px');
}
}
$.magnificPopup.open({
items: items,
gallery: {

View File

@@ -0,0 +1,209 @@
/**
* Main WP Media Gallery addon script
*/
var wpmfGalleryModule;
(function ($) {
if (typeof ajaxurl === "undefined") {
ajaxurl = wpmf.vars.ajaxurl;
}
var this_url = new URL(location.href);
var get_wpmf_folder = this_url.searchParams.get("wpmf-folder");
wpmfGalleryModule = {
comment_parent: 0,
upload_from_pc: false,
wpmf_current_gallery: 0, // current gallery selected
target_gallery: 0,
is_gallery_loading: false,
is_perpage_change: false,
current_page_nav: 1, // current page for images gallery selection
gallery_details: {},
shouldconfirm: false,
custom_gird_gutter_change: false,
is_resizing: true,
current_tab: 'main-gallery',
events: [], // event handling
init: function () {
var folder_options_html = '';
var space = '    ';
var list_cloud_google = [];
var list_cloud_dropbox = [];
var list_cloud_odv = [];
var list_cloud_odvbs = [];
var list_cloud_nextcloud = [];
var list_local = [];
$('.form_edit_gallery input, .form_edit_gallery select').on('change', function () {
if ($(this).data('param') === 'gutterwidth') {
wpmfGalleryModule.custom_gird_gutter_change = true;
}
wpmfGalleryModule.shouldconfirm = true;
window.onbeforeunload = function() {
if (wpmfGalleryModule.shouldconfirm) {
return true;
}
};
});
$('.form_edit_gallery .edit-gallery-name').on('keyup', function () {
wpmfGalleryModule.shouldconfirm = true;
window.onbeforeunload = function() {
if (wpmfGalleryModule.shouldconfirm) {
return true;
}
};
});
wpmfFoldersTreeModule.importCategories();
$.each(wpmfFoldersTreeModule.categories, function (i, v) {
if (parseInt(v.id) !== 0) {
if (typeof v.drive_type !== 'undefined' && v.drive_type !== '' && v.drive_type === 'google_drive') {
list_cloud_google.push({id: v.id, label: v.label, depth: v.depth});
} else if(typeof v.drive_type !== 'undefined' && v.drive_type !== '' && v.drive_type === 'dropbox') {
list_cloud_dropbox.push({id: v.id, label: v.label, depth: v.depth});
} else if(typeof v.drive_type !== 'undefined' && v.drive_type !== '' && v.drive_type === 'onedrive') {
list_cloud_odv.push({id: v.id, label: v.label, depth: v.depth});
} else if (typeof v.drive_type !== 'undefined' && v.drive_type !== '' && v.drive_type === 'onedrive_business') {
list_cloud_odvbs.push({id: v.id, label: v.label, depth: v.depth});
} else if (typeof v.drive_type !== 'undefined' && v.drive_type !== '' && v.drive_type === 'nextcloud') {
list_cloud_nextcloud.push({id: v.id, label: v.label, depth: v.depth});
} else {
list_local.push({id: v.id, label: v.label, depth: v.depth});
}
} else {
list_local.push({id: 0, label: v.label, depth: 0});
}
});
$.each(list_local, function (i, v) {
if (typeof v.depth !== "undefined" && parseInt(v.depth) > 0) {
folder_options_html += '<option value="' + v.id + '"';
if (get_wpmf_folder !== 'undefined' && get_wpmf_folder == v.id){
folder_options_html += ' selected ';
}
folder_options_html += '>' + space.repeat(v.depth) + v.label + '</option>';
} else {
folder_options_html += '<option value="' + v.id + '"';
if (get_wpmf_folder !== 'undefined' && get_wpmf_folder == v.id){
folder_options_html += ' selected ';
}
folder_options_html += '>' + v.label + '</option>';
}
});
$.each(list_cloud_dropbox, function (i, v) {
if (typeof v.depth !== "undefined" && parseInt(v.depth) > 0) {
folder_options_html += '<option value="' + v.id + '"';
if (get_wpmf_folder !== 'undefined' && get_wpmf_folder == v.id){
folder_options_html += ' selected ';
}
folder_options_html += '>' + space.repeat(v.depth) + v.label + '</option>';
} else {
folder_options_html += '<option value="' + v.id + '"';
if (get_wpmf_folder !== 'undefined' && get_wpmf_folder == v.id){
folder_options_html += ' selected ';
}
folder_options_html += '>' + v.label + '</option>';
}
});
$.each(list_cloud_google, function (i, v) {
if (typeof v.depth !== "undefined" && parseInt(v.depth) > 0) {
folder_options_html += '<option value="' + v.id + '"';
if (get_wpmf_folder !== 'undefined' && get_wpmf_folder == v.id){
folder_options_html += ' selected ';
}
folder_options_html += '>' + space.repeat(v.depth) + v.label + '</option>';
} else {
folder_options_html += '<option value="' + v.id + '"';
if (get_wpmf_folder !== 'undefined' && get_wpmf_folder == v.id){
folder_options_html += ' selected ';
}
folder_options_html += '>' + v.label + '</option>';
}
});
$.each(list_cloud_odv, function (i, v) {
if (typeof v.depth !== "undefined" && parseInt(v.depth) > 0) {
folder_options_html += '<option value="' + v.id + '"';
if (get_wpmf_folder !== 'undefined' && get_wpmf_folder == v.id){
folder_options_html += ' selected ';
}
folder_options_html += '>' + space.repeat(v.depth) + v.label + '</option>';
} else {
folder_options_html += '<option value="' + v.id + '"';
if (get_wpmf_folder !== 'undefined' && get_wpmf_folder == v.id){
folder_options_html += ' selected ';
}
folder_options_html += '>' + v.label + '</option>';
}
});
$.each(list_cloud_odvbs, function (i, v) {
if (typeof v.depth !== "undefined" && parseInt(v.depth) > 0) {
folder_options_html += '<option value="' + v.id + '"';
if (get_wpmf_folder !== 'undefined' && get_wpmf_folder == v.id){
folder_options_html += ' selected ';
}
folder_options_html += '>' + space.repeat(v.depth) + v.label + '</option>';
} else {
folder_options_html += '<option value="' + v.id + '"';
if (get_wpmf_folder !== 'undefined' && get_wpmf_folder == v.id){
folder_options_html += ' selected ';
}
folder_options_html += '>' + v.label + '</option>';
}
});
$.each(list_cloud_nextcloud, function (i, v) {
if (typeof v.depth !== "undefined" && parseInt(v.depth) > 0) {
folder_options_html += '<option value="' + v.id + '"';
if (get_wpmf_folder !== 'undefined' && get_wpmf_folder == v.id){
folder_options_html += ' selected ';
}
folder_options_html += '>' + space.repeat(v.depth) + v.label + '</option>';
} else {
folder_options_html += '<option value="' + v.id + '"';
if (get_wpmf_folder !== 'undefined' && get_wpmf_folder == v.id){
folder_options_html += ' selected ';
}
folder_options_html += '>' + v.label + '</option>';
}
});
$('.wpmf-gallery-folder').html(folder_options_html);
}
};
$(document).on( 'wp-collapse-menu', function () {
wpmfGalleryModule.initPackery();
});
// initialize WPMF gallery features
$(document).ready(function () {
wpmfGalleryModule.init();
var wmpf_nonce = $('.wpmf-gallery-folder').attr('data-wmpf-nonce');
uploader.bind('BeforeUpload', function(up, file) {
var multipart_params = up.settings.multipart_params;
multipart_params['wpmf_folder'] = 0;
if (get_wpmf_folder !== 'undefined') {
multipart_params['id_category'] = get_wpmf_folder;
multipart_params['wpmf_folder'] = get_wpmf_folder;
multipart_params['wpmf_nonce'] = wmpf_nonce;
}
up.settings.multipart_params = multipart_params;
});
$('.wpmf-gallery-folder').on('change', function(){
var id_category = $(this).val();
uploader.bind('BeforeUpload', function(up, file) {
var multipart_params = up.settings.multipart_params;
multipart_params['id_category'] = id_category;
multipart_params['wpmf_folder'] = id_category;
multipart_params['wpmf_nonce'] = wmpf_nonce;
up.settings.multipart_params = multipart_params;
});
});
});
})(jQuery);

View File

@@ -4388,9 +4388,10 @@ let wpmfFoldersModule, wpmfAddCloudQueue, cloud_sync_loader_icon;
allowHTML: true,
onShow(instance) {
var tippy_html = '';
tippy_html += '<p class="video-tippy-help" style="color: yellow; font-size:14px">Support: youtube, vimeo, facebook watch, wistia, twitch, dailymotion, self-hosted</p>';
tippy_html += '<p class="video-tippy-help" style="color: yellow; font-size:14px">Support: youtube, vimeo, kaltura, facebook watch, wistia, twitch, dailymotion, self-hosted</p>';
tippy_html += '<p class="video-tippy-help">https://www.youtube.com/watch?v=5ncy4gn6S0k</p>';
tippy_html += '<p class="video-tippy-help">https://vimeo.com/496843494</p>';
tippy_html += '<p class="video-tippy-help">https://videos.kaltura.com/media/Kaltura+Overview/1_11mvteme</p>';
tippy_html += '<p class="video-tippy-help">https://www.facebook.com/svmteam/videos/972235670261003</p>';
tippy_html += '<p class="video-tippy-help">https://www.twitch.tv/videos/999290199</p>';
tippy_html += '<p class="video-tippy-help">https://www.dailymotion.com/video/x80wibi</p>';

View File

@@ -1676,13 +1676,13 @@ var wpmfFoldersModule = void 0,
var folder_color = '<div class="custom_color_wrap">';
if (typeof colorlists[wpmf.vars.colors[wpmfFoldersModule.editFolderId]] === 'undefined') {
if (typeof wpmf.vars.colors[wpmfFoldersModule.editFolderId] === 'undefined') {
custom_color = '#8f8f8f';
custom_color = '#b2b2b2';
} else {
custom_color = wpmf.vars.colors[wpmfFoldersModule.editFolderId];
value = wpmf.vars.colors[wpmfFoldersModule.editFolderId];
}
} else {
custom_color = '#8f8f8f';
custom_color = '#b2b2b2';
}
folder_color += '\n <input name="wpmf_color_folder" type="text"\n placeholder="' + wpmf.l18n.placegolder_color + '"\n value="' + value + '"\n class="inputbox input-block-level wp-color-folder wp-color-picker">';
folder_color += '<div data-color="' + custom_color + '" class="color custom_color" style="background: ' + custom_color + '"><i class="material-icons color_uncheck">check</i></div>';
@@ -4056,6 +4056,7 @@ var wpmfFoldersModule = void 0,
html += '<div class="video-thumbnail-btn-wrap"><button class="add-video-thumbnail-btn">' + wpmf.l18n.add_image + '</button></div>';
html += '<p class="add_video_msg"></p>';
html += '</div>';
var folder_id = wpmfFoldersModule.last_selected_folder;
showDialog({
id: 'wpmf-add-video-dialog',
title: wpmf.l18n.add_video,
@@ -4082,7 +4083,7 @@ var wpmfFoldersModule = void 0,
}
}
wpmfFoldersModule.addVideoToGallery(video_url, thumbnail_id);
wpmfFoldersModule.addVideoToGallery(video_url, thumbnail_id, folder_id);
}
}
});
@@ -4097,9 +4098,10 @@ var wpmfFoldersModule = void 0,
allowHTML: true,
onShow: function onShow(instance) {
var tippy_html = '';
tippy_html += '<p class="video-tippy-help" style="color: yellow; font-size:14px">Support: youtube, vimeo, facebook watch, wistia, twitch, dailymotion, self-hosted</p>';
tippy_html += '<p class="video-tippy-help" style="color: yellow; font-size:14px">Support: youtube, vimeo, kaltura, facebook watch, wistia, twitch, dailymotion, self-hosted</p>';
tippy_html += '<p class="video-tippy-help">https://www.youtube.com/watch?v=5ncy4gn6S0k</p>';
tippy_html += '<p class="video-tippy-help">https://vimeo.com/496843494</p>';
tippy_html += '<p class="video-tippy-help">https://videos.kaltura.com/media/Kaltura+Overview/1_11mvteme</p>';
tippy_html += '<p class="video-tippy-help">https://www.facebook.com/svmteam/videos/972235670261003</p>';
tippy_html += '<p class="video-tippy-help">https://www.twitch.tv/videos/999290199</p>';
tippy_html += '<p class="video-tippy-help">https://www.dailymotion.com/video/x80wibi</p>';
@@ -4180,6 +4182,7 @@ var wpmfFoldersModule = void 0,
addVideoToGallery: function addVideoToGallery() {
var video_url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
var thumbnail_id = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
var folder_id = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
if (video_url === '') {
return;
@@ -4193,14 +4196,14 @@ var wpmfFoldersModule = void 0,
task: "create_remote_video",
video_url: video_url,
thumbnail_id: thumbnail_id,
folder_id: wpmfFoldersModule.last_selected_folder,
folder_id: folder_id,
wpmf_nonce: wpmf.vars.wpmf_nonce
},
beforeSend: function beforeSend() {},
success: function success(res) {
if (res.status) {
wpmfFoldersModule.reloadAttachments(true);
wpmfFoldersModule.trigger('addRemoteVideo', wpmfFoldersModule.last_selected_folder);
wpmfFoldersModule.trigger('addRemoteVideo', folder_id);
}
}
});

View File

@@ -41,68 +41,19 @@ class WpmfFolderAccess
$wpmf_capability = apply_filters('wpmf_user_can', current_user_can('upload_files'), 'create_user_folder');
if (($role !== 'administrator' && $wpmf_capability) || $role === 'employer') {
$wpmf_create_folder = get_option('wpmf_create_folder');
$parent = $this->getUserParentFolder();
$cloud_type = get_term_meta($parent, 'wpmf_drive_type', true);
$check_term = false;
if ($wpmf_create_folder === 'user') {
$slug = sanitize_title($current_user->data->user_login) . '-wpmf';
$check_term = get_term_by('slug', $slug, WPMF_TAXO);
if (empty($check_term)) {
$parent = $this->getUserParentFolder();
$this->doCreateUserFolder($current_user->data->user_login, $slug, $parent, $current_user);
}
$google_connect = WpmfHelper::isConnected('google_drive');
$dropbox_connect = WpmfHelper::isConnected('dropbox');
$onedrive_connect = WpmfHelper::isConnected('onedrive');
$onedrive_business_connect = WpmfHelper::isConnected('onedrive_business');
if ($google_connect) {
$is_exist = get_term_by('slug', $current_user->data->user_login . '-wpmf-google_drive', WPMF_TAXO);
if (empty($is_exist)) {
$parent = WpmfHelper::getCloudRootFolderID('google_drive');
if ($parent) {
$this->doCreateUserFolder($current_user->data->user_login, $current_user->data->user_login . '-wpmf-google_drive', $parent, $current_user);
}
}
}
if ($dropbox_connect) {
$is_exist = get_term_by('slug', $current_user->data->user_login . '-wpmf-dropbox', WPMF_TAXO);
if (empty($is_exist)) {
$parent = WpmfHelper::getCloudRootFolderID('dropbox');
if ($parent) {
$this->doCreateUserFolder($current_user->data->user_login, $current_user->data->user_login . '-wpmf-dropbox', $parent, $current_user);
}
}
}
if ($onedrive_connect) {
$is_exist = get_term_by('slug', $current_user->data->user_login . '-wpmf-onedrive', WPMF_TAXO);
if (empty($is_exist)) {
$parent = WpmfHelper::getCloudRootFolderID('onedrive');
if ($parent) {
$this->doCreateUserFolder($current_user->data->user_login, $current_user->data->user_login . '-wpmf-onedrive', $parent, $current_user);
}
}
}
if ($onedrive_business_connect) {
$is_exist = get_term_by('slug', $current_user->data->user_login . '-wpmf-onedrive_business', WPMF_TAXO);
if (empty($is_exist)) {
$parent = WpmfHelper::getCloudRootFolderID('onedrive_business');
if ($parent) {
$this->doCreateUserFolder($current_user->data->user_login, $current_user->data->user_login . '-wpmf-onedrive_business', $parent, $current_user);
}
}
}
} elseif ($wpmf_create_folder === 'role') {
$slug = sanitize_title($role) . '-wpmf-role';
$check_term = get_term_by('slug', $slug, WPMF_TAXO);
if (empty($check_term)) {
$inserted = wp_insert_term($role, WPMF_TAXO, array('parent' => 0, 'slug' => $slug));
if (!is_wp_error($inserted)) {
$role = WpmfHelper::getRoles($current_user->data->ID);
add_term_meta((int)$inserted['term_id'], 'wpmf_folder_role_permissions', array($role, 'add_media', 'move_media', 'view_folder', 'add_folder', 'update_folder', 'remove_folder', 'view_media', 'remove_media', 'update_media'));
do_action('wpmf_create_folder', $inserted['term_id'], $role, 0, array('trigger' => 'media_library_action'));
}
}
}
if (empty($check_term) && !$cloud_type) {
$this->doCreateUserFolder($current_user->data->user_login, $slug, $parent, $current_user);
}
$google_connect = WpmfHelper::isConnected('google_drive');
@@ -115,7 +66,7 @@ class WpmfFolderAccess
$is_exist = get_term_by('slug', $current_user->data->user_login . '-wpmf-google_drive', WPMF_TAXO);
$name = $current_user->data->user_login;
$slug = $current_user->data->user_login . '-wpmf-google_drive';
$type = '';
$type = 'user';
} else {
$is_exist = get_term_by('slug', $role . '-wpmf-role-google_drive', WPMF_TAXO);
$name = $role;
@@ -137,7 +88,7 @@ class WpmfFolderAccess
$is_exist = get_term_by('slug', $current_user->data->user_login . '-wpmf-dropbox', WPMF_TAXO);
$name = $current_user->data->user_login;
$slug = $current_user->data->user_login . '-wpmf-dropbox';
$type = '';
$type = 'user';
} else {
$is_exist = get_term_by('slug', $role . '-wpmf-role-dropbox', WPMF_TAXO);
$name = $role;
@@ -159,7 +110,7 @@ class WpmfFolderAccess
$is_exist = get_term_by('slug', $current_user->data->user_login . '-wpmf-onedrive', WPMF_TAXO);
$name = $current_user->data->user_login;
$slug = $current_user->data->user_login . '-wpmf-onedrive';
$type = '';
$type = 'user';
} else {
$is_exist = get_term_by('slug', $role . '-wpmf-role-onedrive', WPMF_TAXO);
$name = $role;
@@ -181,7 +132,7 @@ class WpmfFolderAccess
$is_exist = get_term_by('slug', $current_user->data->user_login . '-wpmf-onedrive_business', WPMF_TAXO);
$name = $current_user->data->user_login;
$slug = $current_user->data->user_login . '-wpmf-onedrive_business';
$type = '';
$type = 'user';
} else {
$is_exist = get_term_by('slug', $role . '-wpmf-role-onedrive_business', WPMF_TAXO);
$name = $role;
@@ -228,7 +179,10 @@ class WpmfFolderAccess
add_term_meta((int)$inserted['term_id'], 'inherit_folder', 0);
}
// do_action('wpmf_create_folder', $inserted['term_id'], $name, $parent, array('trigger' => 'media_library_action'));
$cloud_type = get_term_meta($parent, 'wpmf_drive_type', true);
if (!empty($cloud_type)) {
do_action('wpmf_create_folder', $inserted['term_id'], $name, $parent, array('trigger' => 'media_library_action'));
}
}
}

View File

@@ -1,6 +1,8 @@
<?php
namespace Joomunited\WPMediaFolder;
use \WP_Query;
/* Prohibit direct script loading */
defined('ABSPATH') || die('No direct script access allowed!');
/**
@@ -995,6 +997,19 @@ class WpmfHelper
return $is_access;
}
/**
* Get kaltura video ID from URL
*
* @param string $url URL of video
*
* @return mixed|string
*/
public static function getKalturaVideoIdFromUrl($url = '')
{
$array = explode('/', basename($url));
return end($array);
}
/**
* Get dailymotion video ID from URL
@@ -1041,7 +1056,7 @@ class WpmfHelper
$title = '';
$ext = '';
$content = '';
if ($action === 'video_to_gallery' && (int)$thumbnail !== 0) {
if ($action === 'video_to_gallery' && (int)$thumbnail !== 0 && !strpos($video_url, 'kaltura')) {
update_post_meta($thumbnail, 'wpmf_remote_video_link', $video_url);
return $thumbnail;
}
@@ -1049,7 +1064,8 @@ class WpmfHelper
$video_url = str_replace('manage/videos/', '', $video_url);
if (!preg_match(self::$vimeo_pattern, $video_url, $output_array)
&& !preg_match('/(youtube.com|youtu.be)\/(watch)?(\?v=)?(\S+)?/', $video_url, $match)
&& !preg_match('/\b(?:dailymotion)\.com\b/i', $video_url, $vresult)) {
&& !preg_match('/\b(?:dailymotion)\.com\b/i', $video_url, $vresult)
&& !preg_match('/(videos.kaltura)\.com\b/i', $video_url, $vresult)) {
return false;
} elseif (preg_match(self::$vimeo_pattern, $video_url, $output_array)) {
// for vimeo
@@ -1154,6 +1170,35 @@ class WpmfHelper
$content = $thumb_gets['body'];
$info_thumbnail = pathinfo($info['thumbnail_url']); // get info thumbnail
$ext = (!empty($info_thumbnail['extension'])) ? $info_thumbnail['extension'] : 'jpg';
} elseif (preg_match('/(videos.kaltura)\.com\b/i', $video_url, $vresult)) {
// for kaltura
$id = self::getKalturaVideoIdFromUrl($video_url);
$partner_id = '5944002'; //partner id from account on Kaltura
$thumb = 'http://cdnsecakmi.kaltura.com/p/' . $partner_id . '/thumbnail/entry_id/' . $id . '/width/2560/height/1920';
$gets = wp_remote_get($thumb);
if (empty($gets)) {
return false;
}
$content = $gets['body'];
//get title video
$array_video_url = explode('/', $video_url);
array_pop($array_video_url);
$title = str_replace('+', ' ', end($array_video_url));
$src = 'https://cdnapisec.kaltura.com/p/' . $partner_id . '/sp/' . $partner_id . '00/playManifest/entryId/'.$id.'/format/url/protocol/https/'.$partner_id.'/2000/name/'.$id.'.mp4';
$video_url = $src;
update_post_meta($thumbnail, 'wpmf_remote_video_link', $video_url);
$json_datas = wp_remote_get('https://cdnapisec.kaltura.com/p/' . $partner_id . '/sp/' . $partner_id . '00/playManifest/entryId/'.$id.'/format/url/protocol/https/'.$partner_id.'/2000/name/'.$id.'.mp4');
if (empty($json_datas)) {
return false;
}
$infos = array();
$infos['html'] = "<iframe width='200' height='150' src='".$src."' frameborder='0' allow='accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share' referrerpolicy='strict-origin-when-cross-origin' allowfullscreen title='".$title."'></iframe>";
$ext = 'jpeg';
}
$upload_dir = wp_upload_dir();
@@ -2310,7 +2355,7 @@ class WpmfHelper
$settings = get_option('wpmf_settings');
if (isset($settings) && isset($settings['wpmf_active_folders_post_types'])) {
$post_types = $settings['wpmf_active_folders_post_types'];
$post_types = is_array($post_types) ? $post_types : [];
$post_types = is_array($post_types) ? $post_types : array();
} else {
$post_types = array();
}

View File

@@ -91,6 +91,8 @@ class WpMediaFolder
add_filter('pre_delete_attachment', array($this, 'preDeleteAttachment'), 10, 3);
add_action('check_ajax_referer', array($this, 'disableSaveAjax'), 10, 2);
add_filter('wp_insert_post_empty_content', array($this, 'disableSave'), 999999, 2);
add_action('pre-upload-ui', array( $this, 'selectFolderUpload'));
add_filter('add_attachment', array($this, 'moveFileUploadToSelectFolder'), 0, 1);
}
/**
@@ -617,7 +619,8 @@ class WpMediaFolder
$video_url = (isset($_POST['video_url'])) ? $_POST['video_url'] : '';
if (!preg_match(WpmfHelper::$vimeo_pattern, $video_url, $output_array)
&& !preg_match('/(youtube.com|youtu.be)\/(watch)?(\?v=)?(\S+)?/', $video_url, $match)
&& !preg_match('/\b(?:dailymotion)\.com\b/i', $video_url, $vresult)) {
&& !preg_match('/\b(?:dailymotion)\.com\b/i', $video_url, $vresult)
&& !preg_match('/(videos.kaltura)\.com\b/i', $video_url, $vresult)) {
wp_send_json(array('status' => false));
} elseif (preg_match(WpmfHelper::$vimeo_pattern, $video_url, $output_array)) {
// for vimeo
@@ -681,6 +684,11 @@ class WpMediaFolder
if (!empty($info['thumbnail_url'])) {
$thumb_url = $info['thumbnail_url'];
}
} elseif (preg_match('/(videos.kaltura)\.com\b/i', $video_url, $vresult)) {
// for kaltura
$id = WpmfHelper::getKalturaVideoIdFromUrl($video_url);
$partner_id = 5944002;
$thumb_url = 'http://cdnsecakmi.kaltura.com/p/' . $partner_id . '/thumbnail/entry_id/' . $id . '/width/2560/height/1920';
}
if (!empty($thumb_url)) {
@@ -1009,6 +1017,50 @@ class WpMediaFolder
wp_send_json(false);
}
/**
* Load styles
*
* @return void
*/
public function loadAssetsMediaUpload()
{
wp_enqueue_style(
'wpmf-style',
plugins_url('/assets/css/style.css', dirname(__FILE__)),
array(),
WPMF_VERSION
);
wp_register_script(
'wpmf-base',
plugins_url('/assets/js/script.js', dirname(__FILE__)),
array('jquery', 'plupload'),
WPMF_VERSION
);
wp_enqueue_script('wpmf-base');
wp_register_script(
'wpmf-folder-upload',
plugins_url('/assets/js/folder_upload.js', dirname(__FILE__)),
array('jquery'),
WPMF_VERSION
);
wp_enqueue_script('wpmf-folder-upload');
wp_register_script(
'wpmf-folder-tree',
plugins_url('/assets/js/folder_tree.js', dirname(__FILE__)),
array('wpmf-base'),
WPMF_VERSION
);
wp_enqueue_script('wpmf-folder-tree');
$params = $this->localizeScript();
wp_localize_script('wpmf-base', 'wpmf', $params);
}
/**
* Load styles
*
@@ -1018,7 +1070,7 @@ class WpMediaFolder
{
global $typenow, $current_screen;
if (WpmfHelper::isForThisPostType($typenow) && 'edit' == $current_screen->base) {
if (WpmfHelper::isForThisPostType($typenow) && 'edit' === $current_screen->base) {
return;
}
@@ -1257,6 +1309,7 @@ class WpMediaFolder
$this->loadAssets();
}
} elseif ($pagenow === 'media-new.php') {
$this->loadAssetsMediaUpload();
// Add current folder to hidden fields on media-new.php page
add_filter('upload_post_params', function ($params) {
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- No action, nonce is not required
@@ -2113,11 +2166,11 @@ class WpMediaFolder
public function getMultiFolderInfos($terms)
{
if (!$terms) {
return [];
return array();
}
$term_ids = array_keys($terms);
$return = [];
$drive_types = [];
$return = array();
$drive_types = array();
if (defined('WPMFAD_PLUGIN_DIR')) {
$drive_types = $this->getDriveType($term_ids);
@@ -2134,8 +2187,8 @@ class WpMediaFolder
'parent_id' => $term->category_parent,
'depth' => $term->depth,
'term_group' => $term->term_group,
'order' => $orders[$term_id] ?? '',
'drive_type' => $drive_types[$term_id] ?? ''
'order' => isset($orders[$term_id]) ? $orders[$term_id] : '',
'drive_type' => isset($drive_types[$term_id]) ? $drive_types[$term_id] : ''
);
// $view_media = WpmfHelper::getAccess($term->term_id, get_current_user_id(), 'view_media');
@@ -5645,4 +5698,94 @@ class WpMediaFolder
return $exclude;
}
/**
* Select Folder To Upload
*
* @return void
*/
public function selectFolderUpload()
{
if (strpos($_SERVER['REQUEST_URI'], 'media-new')) {
?>
<div class="wpmf-upload-inline">
<label for="wpmfu"><?php esc_html_e('Choose folder: ', 'wpmf'); ?></label>
<select class="wpmf-gallery-folder" data-wmpf-nonce="<?php echo esc_attr(wp_create_nonce('wpmf_nonce')) ?>"></select>
</div>
<?php
}
}
/**
* Set file to current folder after upload files
*
* @param integer $attachment_id Id of attachment
*
* @return void
*/
public function moveFileUploadToSelectFolder($attachment_id)
{
if (isset($_POST['id_category'])) {
if (empty($_POST['wpmf_nonce']) || !wp_verify_nonce($_POST['wpmf_nonce'], 'wpmf_nonce')) {
die();
}
if ($attachment_id) {
//move file
$_POST['ids'][] = $attachment_id;
$parent = $this->getFolderParent($_POST['id_category'], $_POST['id_category']);
$user_id = get_current_user_id();
$is_access = WpmfHelper::getAccess($parent, $user_id, 'move_media');
if (empty($_POST['current_category'])) {
$is_access1 = true;
} else {
$is_access1 = WpmfHelper::getAccess($_POST['current_category'], $user_id, 'move_media');
}
if (!$is_access || !$is_access1) {
wp_send_json(array('status' => false, 'msg' => esc_html__('You not have a permission to move the file to this folder!', 'wpmf')));
}
// check current folder
$current_category = $this->folderRootId;
if (!empty($_POST['ids']) && is_array($_POST['ids'])) {
foreach (array_unique($_POST['ids']) as $id) {
$cloud_file_type = wpmfGetCloudFileType($id);
$cloud_folder_type = wpmfGetCloudFolderType($parent);
$file_s3_infos = get_post_meta((int) $id, 'wpmf_awsS3_info', true);
if (($cloud_file_type === $cloud_folder_type) || ($cloud_file_type === 'local' && $cloud_folder_type !== 'local' && empty($file_s3_infos))) {
// compability with WPML plugin
WpmfHelper::moveFileWpml($id, $current_category, $parent);
wp_remove_object_terms((int) $id, $current_category, WPMF_TAXO);
if ((int)$parent === 0 || wp_set_object_terms((int) $id, (int)$parent, WPMF_TAXO, true)) {
$params = array('trigger' => 'move_attachment');
if (($cloud_file_type === 'local' && $cloud_folder_type !== 'local' && empty($file_s3_infos))) {
$params['local_to_cloud'] = 1;
}
/**
* Set attachment folder after moving an attachment to a folder in the media manager
* This hook is also used when importing attachment to categories, after an attachment upload and
* when assigning multiple folder to an attachment
*
* @param integer Attachment ID
* @param integer|array Target folder or array of target folders
* @param array Extra informations
*/
do_action('wpmf_attachment_set_folder', $id, (int)$parent, $params);
// reset order
update_post_meta(
(int) $id,
'wpmf_order',
0
);
}
}
}
}
}
}
}
}

View File

@@ -75,6 +75,9 @@ class WpmfPdfEmbedDivi extends Component {
componentDidUpdate(prevProps, prevState) {
if (this.props.embed === 'on' && !this.state.embed) {
if($(this.wrap.current).find(".wpmf-pdfemb-viewer").length) {
$(this.wrap.current).find(".wpmf-pdfemb-viewer").pdfEmbedder();
}
this.setState({
embed: true
});

File diff suppressed because one or more lines are too long

View File

@@ -3,7 +3,7 @@ Tags: media, folder
Requires at least: 4.7.0
Tested up to: 6.6
Requires PHP: 5.6
Stable tag: 5.9.3
Stable tag: 5.9.5
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -20,6 +20,14 @@ Stop searching for an image through thousand of media, just navigate like you do
= Changelog =
= 5.9.5 =
* Fix : Upload image error at the 'Add new media' page
= 5.9.4 =
* Add : Remote video: support for Kaltura videos
* Add : Folder selection when no folder tree
* Add : Set the default icon folder color on the color picker
= 5.9.3 =
* Fix : The Screen Options dropdown menu on the admin screen is not working

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.3
Version: 5.9.5
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.3');
define('WPMF_VERSION', '5.9.5');
define('WPMF_HIDE_USER_MEDIA_FOLDER_ROOT', true);
include_once(ABSPATH . 'wp-admin/includes/plugin.php');