plugin updates
This commit is contained in:
@@ -15,12 +15,55 @@
|
||||
url('../fonts/MaterialIcons-Regular.ttf') format('truetype');
|
||||
}
|
||||
|
||||
/* Remote video CSS */
|
||||
/* Tagify */
|
||||
.tagify {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.tagify--outside {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.tagify--outside .tagify__input {
|
||||
order: -1;
|
||||
flex: 100%;
|
||||
border: 1px solid var(--tags-border-color);
|
||||
margin-bottom: 1em;
|
||||
transition: .1s;
|
||||
}
|
||||
|
||||
.tagify--outside .tagify__input:hover {
|
||||
border-color: var(--tags-hover-border-color);
|
||||
}
|
||||
|
||||
.tagify--outside.tagify--focus .tagify__input {
|
||||
transition: 0s;
|
||||
border-color: var(--tags-focus-border-color);
|
||||
}
|
||||
|
||||
.tagify__dropdown {
|
||||
z-index: 999999999 !important;
|
||||
}
|
||||
|
||||
.wpmf-dialog-text .tagify__input {
|
||||
margin: 5px 0;
|
||||
}
|
||||
|
||||
.wpmf-dialog-text .tagify__tag>div {
|
||||
padding-left: 0 !important;
|
||||
}
|
||||
|
||||
.wpmf-dialog-text .tagify__tag {
|
||||
margin-left: 0;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
/* Remote video, add tag CSS */
|
||||
#wpmf-add-video-dialog {
|
||||
z-index: 9999 !important;
|
||||
}
|
||||
|
||||
#wpmf-add-video-dialog h5 {
|
||||
#wpmf-add-video-dialog h5, #wpmf-add-tag-dialog h5 {
|
||||
font-size: 16px;
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
@@ -29,8 +72,8 @@
|
||||
max-width: 600px;
|
||||
}
|
||||
|
||||
#wpmf-add-video-dialog_content {
|
||||
max-width: 600px;
|
||||
#tagcloud-wpmf_tag .wp-tag-cloud a {
|
||||
font-size: 14px !important;
|
||||
}
|
||||
|
||||
.add_video_msg {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -489,6 +489,21 @@ var wpmfFoldersTreeModule = void 0;
|
||||
if ($(e.target).hasClass('wpmf-arrow') || $(e.target).hasClass('wpmf-tree-checkbox')) {
|
||||
return;
|
||||
}
|
||||
// Set cookie filter tag
|
||||
var this_url = new URL(location.href);
|
||||
var get_taxonomy = this_url.searchParams.get("taxonomy");
|
||||
var get_term = this_url.searchParams.get("term");
|
||||
var get_wpmf_tag = this_url.searchParams.get("wpmf_tag");
|
||||
var wpmf_tag = 0;
|
||||
if ((get_taxonomy && get_term && get_taxonomy == 'wpmf_tag') || get_wpmf_tag) {
|
||||
if (get_term) {
|
||||
wpmf_tag = get_term;
|
||||
}
|
||||
if (get_wpmf_tag) {
|
||||
wpmf_tag = get_wpmf_tag;
|
||||
}
|
||||
wpmfFoldersModule.setCookie('wpmf_tag', wpmf_tag, 365);
|
||||
}
|
||||
// single click
|
||||
var id = $(this).data('id');
|
||||
if (parseInt(id) !== parseInt(wpmfFoldersModule.last_selected_folder)) {
|
||||
|
||||
@@ -5,6 +5,11 @@
|
||||
*/
|
||||
var wpmfFoldersFiltersModule = void 0;
|
||||
(function ($) {
|
||||
var this_url = new URL(location.href);
|
||||
var get_taxonomy = this_url.searchParams.get("taxonomy");
|
||||
var get_term = this_url.searchParams.get("term");
|
||||
var get_wpmf_tag = this_url.searchParams.get("wpmf_tag");
|
||||
var wpmf_tag = 0;
|
||||
|
||||
wpmfFoldersFiltersModule = {
|
||||
events: [], // event handling
|
||||
@@ -928,6 +933,17 @@ var wpmfFoldersFiltersModule = void 0;
|
||||
* @param value
|
||||
*/
|
||||
selectFilter: function selectFilter(filter_elem, value) {
|
||||
// Check filter tags
|
||||
if ((get_taxonomy && get_term && get_taxonomy == 'wpmf_tag') || get_wpmf_tag) {
|
||||
if (get_term) {
|
||||
wpmf_tag = get_term;
|
||||
}
|
||||
if (get_wpmf_tag) {
|
||||
wpmf_tag = get_wpmf_tag;
|
||||
}
|
||||
wpmfFoldersModule.setCookie('wpmf_tag', wpmf_tag, 365);
|
||||
}
|
||||
|
||||
var multiple = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
||||
var selector = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
|
||||
var query_param = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : '';
|
||||
@@ -1187,6 +1203,9 @@ var wpmfFoldersFiltersModule = void 0;
|
||||
* Clear all filters
|
||||
*/
|
||||
clearFilters: function clearFilters() {
|
||||
// delete cookie filter tag
|
||||
wpmfFoldersModule.setCookie('wpmf_tag', '0');
|
||||
|
||||
$(['wpmf_post_mime_type', 'attachment-filter', 'wpmf_wpmf_date', 'wpmf_wpmf_size', 'wpmf_wpmf_weight', 'media-order-folder', 'media-order-media', 'wpmf-display-media-filters', 'wpmf_all_media']).each(function () {
|
||||
// delete cookie filter
|
||||
wpmfFoldersModule.setCookie(this.toString() + wpmf.vars.host, 'all', 365);
|
||||
@@ -1223,6 +1242,10 @@ var wpmfFoldersFiltersModule = void 0;
|
||||
wpmfFoldersModule.renderFolders();
|
||||
// Reload the dropdown
|
||||
wpmfFoldersFiltersModule.initDropdown(wpmfFoldersModule.getFrame());
|
||||
if (wpmfFoldersModule.page_type === 'upload-grid') {
|
||||
wpmfFoldersModule.setCookie('wpmf_tag', '0');
|
||||
location.href = wpmf.vars.site_url + '/wp-admin/upload.php';
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -1283,4 +1306,38 @@ var wpmfFoldersFiltersModule = void 0;
|
||||
wpmfFoldersModule.on('afterFiltersInitialization', function () {
|
||||
wpmfFoldersFiltersModule.initModule(wpmfFoldersModule.page_type);
|
||||
});
|
||||
|
||||
jQuery(document).ready(function ($) {
|
||||
if (get_wpmf_tag) {
|
||||
wpmfFoldersModule.setCookie('lastAccessFolder_' + wpmf.vars.host, 0);
|
||||
wpmfFoldersModule.setCookie('wpmf_all_media' + wpmf.vars.host, 1);
|
||||
wpmfFoldersModule.setCookie('wpmf_tag', get_wpmf_tag, 365);
|
||||
};
|
||||
// Count tag button
|
||||
var element_count_tag = $('#the-list .column-posts').attr('data-colname');
|
||||
if (element_count_tag && element_count_tag.toLowerCase() == 'count') {
|
||||
$('#the-list .column-posts a').on('click', function(e){
|
||||
e.preventDefault();
|
||||
let url = $(this).attr('href');
|
||||
let url_array = url.split("=");
|
||||
let wpmf_tag_array = null;
|
||||
let wpmf_tag_filter = null;
|
||||
if (url_array) {
|
||||
wpmf_tag_array = url_array[1].split("&");
|
||||
if (wpmf_tag_array) {
|
||||
wpmf_tag_filter = wpmf_tag_array[0];
|
||||
}
|
||||
}
|
||||
|
||||
if (url) {
|
||||
wpmfFoldersModule.setCookie('lastAccessFolder_' + wpmf.vars.host, 0);
|
||||
wpmfFoldersModule.setCookie('wpmf_all_media' + wpmf.vars.host, 1);
|
||||
if (wpmf_tag_filter) {
|
||||
wpmfFoldersModule.setCookie('wpmf_tag', wpmf_tag_filter, 365);
|
||||
}
|
||||
location.href = url;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
||||
|
||||
@@ -181,6 +181,125 @@ var wpmfFoldersModule = void 0,
|
||||
$('.page-title-action').after('<a href="#" class="wpmf_btn_upload_folder">' + wpmf.l18n.upload_folder_label + '</a><input name="id_category" class="wpmf_id_category" type="hidden" value="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);
|
||||
}
|
||||
}
|
||||
}
|
||||
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">';
|
||||
//show tagify for tags
|
||||
showDialog({
|
||||
id: 'wpmf-add-tag-dialog',
|
||||
title: wpmf.l18n.create_or_select_tag,
|
||||
text: html,
|
||||
negative: {
|
||||
title: wpmf.l18n.cancel
|
||||
},
|
||||
positive: {
|
||||
title: wpmf.l18n.add,
|
||||
onClick: function onClick(e) {
|
||||
var value = $('input[name=tags-outside]').val();
|
||||
if (value) {
|
||||
var array_value = JSON.parse(value);
|
||||
var tag_name = [];
|
||||
array_value.forEach(element => {
|
||||
tag_name.push(element.value);
|
||||
});
|
||||
//save tag
|
||||
if (tag_name.length) {
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
dataType: "json",
|
||||
url: wpmf.vars.ajaxurl,
|
||||
data: {
|
||||
action: "wpmf",
|
||||
task: "save_tag_item",
|
||||
tag_name: tag_name,
|
||||
post_ids: post_ids,
|
||||
wpmf_nonce: wpmf.vars.wpmf_nonce
|
||||
},
|
||||
success: function success(response) {
|
||||
if (response.status) {
|
||||
window.location.reload();
|
||||
} else {
|
||||
console.log(response.status);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
//set tagify
|
||||
var input = document.querySelector('input[name=tags-outside]')
|
||||
var tagify = new Tagify(input, {
|
||||
focusable: false,
|
||||
dropdown: {
|
||||
position: 'input',
|
||||
enabled: 0 // always opens dropdown when input gets focus
|
||||
}
|
||||
});
|
||||
//get 10 tag items
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
dataType: "json",
|
||||
url: wpmf.vars.ajaxurl,
|
||||
data: {
|
||||
action: "wpmf",
|
||||
task: "get_tag_item",
|
||||
wpmf_nonce: wpmf.vars.wpmf_nonce
|
||||
},
|
||||
success: function success(response) {
|
||||
if (response.status) {
|
||||
tagify.whitelist = response.list_tags; // update whitelist
|
||||
}
|
||||
}
|
||||
});
|
||||
//search tag
|
||||
document.querySelector('.tagify__input').addEventListener("keyup", function (e) {
|
||||
var tag_name = $(this).html();
|
||||
if (tag_name.length > 1) {
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
dataType: "json",
|
||||
url: wpmf.vars.ajaxurl,
|
||||
data: {
|
||||
action: "wpmf",
|
||||
task: "get_tag_item",
|
||||
tag_name : tag_name,
|
||||
wpmf_nonce: wpmf.vars.wpmf_nonce
|
||||
},
|
||||
success: function success(response) {
|
||||
if (response.status) {
|
||||
tagify.whitelist = response.list_tags // update whitelist
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
showDialog({
|
||||
text: wpmf.l18n.select_file_required,
|
||||
closeicon: true
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// add bulk upload to s3 button
|
||||
if (parseInt(wpmf.vars.copy_files_to_bucket) === 1) {
|
||||
if (!$current_frame.find('.bulk-upload-s3-btn').length) {
|
||||
|
||||
29
wp/wp-content/plugins/wp-media-folder/assets/js/tagify.js
Normal file
29
wp/wp-content/plugins/wp-media-folder/assets/js/tagify.js
Normal file
File diff suppressed because one or more lines are too long
@@ -116,7 +116,11 @@ class WpMediaFolder
|
||||
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);
|
||||
add_filter('bulk_actions-upload', array($this, 'registerTagBulkAction'), 10, 1);
|
||||
add_action('wp_enqueue_media', array($this, 'removeDatabaseWhenCloudDisconnected'));
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -623,6 +627,12 @@ class WpMediaFolder
|
||||
case 'auto_load_video_thumbnail':
|
||||
$this->autoLoadVideoThumbnail();
|
||||
break;
|
||||
case 'get_tag_item':
|
||||
$this->getTagItem();
|
||||
break;
|
||||
case 'save_tag_item':
|
||||
$this->saveTagItem();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1174,6 +1184,13 @@ class WpMediaFolder
|
||||
WPMF_VERSION
|
||||
);
|
||||
|
||||
wp_enqueue_style(
|
||||
'wpmf-tagify-style',
|
||||
plugins_url('/assets/css/tagify.css', dirname(__FILE__)),
|
||||
array(),
|
||||
WPMF_VERSION
|
||||
);
|
||||
|
||||
wp_enqueue_script(
|
||||
'wpmf-gallery-popup',
|
||||
plugins_url('/assets/js/display-gallery/jquery.magnific-popup.min.js', dirname(__FILE__)),
|
||||
@@ -1199,6 +1216,15 @@ class WpMediaFolder
|
||||
);
|
||||
}
|
||||
|
||||
wp_register_script(
|
||||
'wpmf-tagify',
|
||||
plugins_url('/assets/js/tagify.js', dirname(__FILE__)),
|
||||
array(),
|
||||
WPMF_VERSION
|
||||
);
|
||||
|
||||
wp_enqueue_script('wpmf-tagify');
|
||||
|
||||
wp_enqueue_script('resumable', plugins_url('/assets/js/resumable.js', dirname(__FILE__)), array('jquery'), WPMF_VERSION);
|
||||
wp_register_script(
|
||||
'wpmf-base',
|
||||
@@ -1327,7 +1353,7 @@ class WpMediaFolder
|
||||
*/
|
||||
$wpmf_capability = apply_filters('wpmf_user_can', current_user_can('upload_files'), 'load_script_style');
|
||||
if ($wpmf_capability) {
|
||||
if ($pagenow === 'upload.php') {
|
||||
if ($pagenow === 'upload.php' || $pagenow === 'edit-tags.php') {
|
||||
$mode = get_user_option('media_library_mode', get_current_user_id()) ? get_user_option('media_library_mode', get_current_user_id()) : 'grid';
|
||||
if ($mode === 'list') {
|
||||
$this->loadAssets();
|
||||
@@ -1591,6 +1617,14 @@ class WpMediaFolder
|
||||
$enable_permissions_settings = ((isset($current_user->allcaps['wpmf_enable_permissions_settings']) && $current_user->allcaps['wpmf_enable_permissions_settings']) || in_array('administrator', $current_user->roles));
|
||||
}
|
||||
|
||||
$enable_all_files_button = in_array('administrator', $current_user->roles) || !$active_media_access ;
|
||||
/**
|
||||
* Filter to enable "Display all files" button for specific user roles
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
$show_all_files_button = apply_filters('wpmf_enable_all_files_button', $enable_all_files_button) ? 1 : 0;
|
||||
|
||||
$l18n = $this->translation();
|
||||
$vars = array(
|
||||
'site_url' => site_url(),
|
||||
@@ -1660,7 +1694,7 @@ class WpMediaFolder
|
||||
'img_url' => WPMF_PLUGIN_URL . 'assets/images/',
|
||||
'copy_files_to_bucket' => (!empty($configs['copy_files_to_bucket']) && is_plugin_active('wp-media-folder-addon/wp-media-folder-addon.php')) ? 1 : 0,
|
||||
'hide_own_media_button' => current_user_can('wpmf_hide_own_media_button') ? 1 : 0,
|
||||
'show_all_files_button' => in_array('administrator', $current_user->roles) || !$active_media_access ? 1 : 0
|
||||
'show_all_files_button' => $show_all_files_button
|
||||
);
|
||||
|
||||
return array('l18n' => $l18n, 'vars' => $vars);
|
||||
@@ -1755,6 +1789,9 @@ class WpMediaFolder
|
||||
'wpmf_remove_filter' => __('Media filters removed', 'wpmf'),
|
||||
'cancel' => __('Cancel', 'wpmf'),
|
||||
'create' => __('Create', 'wpmf'),
|
||||
'add' => __('Add', 'wpmf'),
|
||||
'add_tag' => __('Add tags', 'wpmf'),
|
||||
'create_or_select_tag' => __('Create or select tags', 'wpmf'),
|
||||
'save' => __('Save', 'wpmf'),
|
||||
'save_close' => __('Save and close', 'wpmf'),
|
||||
'ok' => __('OK', 'wpmf'),
|
||||
@@ -1966,7 +2003,8 @@ class WpMediaFolder
|
||||
'by_user' => esc_html__('By User', 'wpmf'),
|
||||
'remove_file_permission_msg' => esc_html__('You do not have permission to delete this file. Refresh folder to see image again', 'wpmf'),
|
||||
'remove_file_permission_msg1' => esc_html__('You do not have permission to delete this file', 'wpmf'),
|
||||
'update_file_permission_msg' => esc_html__('You do not have permission to update this file', 'wpmf')
|
||||
'update_file_permission_msg' => esc_html__('You do not have permission to update this file', 'wpmf'),
|
||||
'select_file_required' => esc_html__('Please select file to do this action', 'wpmf')
|
||||
);
|
||||
|
||||
return $l18n;
|
||||
@@ -5813,6 +5851,72 @@ class WpMediaFolder
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add bulk select tag
|
||||
*
|
||||
* @param array $bulk_actions List bulk actions
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function registerTagBulkAction($bulk_actions)
|
||||
{
|
||||
$bulk_actions['tag'] = __('Add tags', 'wpmf');
|
||||
return $bulk_actions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list tags
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function getTagItem()
|
||||
{
|
||||
if (empty($_POST['wpmf_nonce'])
|
||||
|| !wp_verify_nonce($_POST['wpmf_nonce'], 'wpmf_nonce')) {
|
||||
die();
|
||||
}
|
||||
global $wpdb;
|
||||
|
||||
if (isset($_POST['tag_name']) && !empty($_POST['tag_name'])) {
|
||||
$list_tags = $wpdb->get_results($wpdb->prepare('SELECT t.name FROM ' . $wpdb->terms . ' as t INNER JOIN ' . $wpdb->term_taxonomy . ' AS tt ON tt.term_id = t.term_id WHERE tt.taxonomy="wpmf_tag" AND t.name LIKE %s LIMIT %d', array('%' . $_POST['tag_name'] . '%',(int)10)));
|
||||
} else {
|
||||
$list_tags = $wpdb->get_results($wpdb->prepare('SELECT t.name FROM ' . $wpdb->terms . ' as t INNER JOIN ' . $wpdb->term_taxonomy . ' AS tt ON tt.term_id = t.term_id WHERE tt.taxonomy="wpmf_tag" ORDER BY RAND() LIMIT %d', array((int)10)));
|
||||
}
|
||||
|
||||
if ($list_tags) {
|
||||
$list_tags = array_column($list_tags, 'name');
|
||||
wp_send_json(array('status' => true, 'list_tags' => $list_tags));
|
||||
} else {
|
||||
wp_send_json(array('status' => false));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save tags
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function saveTagItem()
|
||||
{
|
||||
if (empty($_POST['wpmf_nonce'])
|
||||
|| !wp_verify_nonce($_POST['wpmf_nonce'], 'wpmf_nonce')) {
|
||||
die();
|
||||
}
|
||||
if (isset($_POST['tag_name']) && !empty($_POST['tag_name']) && isset($_POST['post_ids'])) {
|
||||
foreach ($_POST['post_ids'] as $post_id) {
|
||||
$old_terms = array();
|
||||
$terms = wp_get_post_terms($post_id, 'wpmf_tag');
|
||||
if ($terms) {
|
||||
$old_terms = array_column($terms, 'name');
|
||||
}
|
||||
$new_term = array_unique(array_merge($_POST['tag_name'], $old_terms));
|
||||
wp_set_post_terms($post_id, $new_term, 'wpmf_tag');
|
||||
}
|
||||
wp_send_json(array('status' => true));
|
||||
}
|
||||
wp_send_json(array('status' => false));
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete files and folders information in database if cloud was disconnected
|
||||
*
|
||||
@@ -5851,4 +5955,59 @@ class WpMediaFolder
|
||||
$this->doRemoveFolders((int)$folder_next_cloud[0]->term_id);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add tag helps
|
||||
*
|
||||
* @param array $form_fields Array of post fields.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function addTagHelps($form_fields)
|
||||
{
|
||||
$form_fields['wpmf_tag']['helps'] = 'Separate tags with commas';
|
||||
return $form_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add tag filter
|
||||
*
|
||||
* @param object $query Query params.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addTagFilter($query)
|
||||
{
|
||||
$query->unset('wpmf_tag');
|
||||
if (isset($_COOKIE['wpmf_tag']) && !empty($_COOKIE['wpmf_tag'])) {
|
||||
$query->set('wpmf_tag', $_COOKIE['wpmf_tag']);
|
||||
} else {
|
||||
$query->unset('wpmf_tag');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Change value of tags from slug to name
|
||||
*
|
||||
* @param array $form_fields Form fields.
|
||||
* @param object $post Post.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function changeTagSlugToName($form_fields, $post)
|
||||
{
|
||||
global $wpdb;
|
||||
|
||||
$terms = $wpdb->get_results($wpdb->prepare('SELECT tr.object_id, t.name FROM ' . $wpdb->terms . ' as t INNER JOIN ' . $wpdb->term_taxonomy . ' as tt ON tt.term_id = t.term_id INNER JOIN ' . $wpdb->term_relationships . ' as tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy="wpmf_tag" AND tr.object_id = %s', array($post->ID)));
|
||||
|
||||
$values = array();
|
||||
|
||||
foreach ($terms as $term) {
|
||||
$values[] = $term->name;
|
||||
}
|
||||
|
||||
$form_fields['wpmf_tag']['value'] = implode(', ', $values);
|
||||
|
||||
return $form_fields;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,15 +72,25 @@ class WpmfGalleryAddonDivi extends ET_Builder_Module
|
||||
)
|
||||
);
|
||||
|
||||
if (count($galleries) < 100) {
|
||||
$galleries = wpmfParentSort($galleries);
|
||||
|
||||
$galleries = wpmfParentSort($galleries);
|
||||
|
||||
$term_ids = array();
|
||||
foreach ($galleries as $gallery) {
|
||||
$term_ids[] = (int)$gallery->term_id;
|
||||
}
|
||||
$galleries_types = array();
|
||||
if (file_exists(WPMF_GALLERY_ADDON_PLUGIN_DIR . 'admin/class/helper.php')) {
|
||||
require_once WPMF_GALLERY_ADDON_PLUGIN_DIR . 'admin/class/helper.php';
|
||||
$WpmfGlrAddonHelper = new WpmfGlrAddonHelper();
|
||||
$galleries_types = $WpmfGlrAddonHelper->getGalleriesType($term_ids);
|
||||
}
|
||||
|
||||
$galleries_list = array();
|
||||
$galleries_list[0] = esc_html__('WP Media Folder Gallery', 'wpmf');
|
||||
$i = 0;
|
||||
foreach ($galleries as $gallery) {
|
||||
$gallery_type = get_term_meta((int)$gallery->term_id, 'gallery_type', true);
|
||||
$gallery_type = isset($galleries_types[(int)$gallery->term_id])? $galleries_types[(int)$gallery->term_id] : '' ;
|
||||
if (!empty($gallery_type) && ($gallery_type === 'photographer' || $gallery_type === 'archive')) {
|
||||
continue;
|
||||
}
|
||||
@@ -89,13 +99,14 @@ class WpmfGalleryAddonDivi extends ET_Builder_Module
|
||||
$i++;
|
||||
}
|
||||
|
||||
//List photographer galleries
|
||||
$root = get_term_by('slug', 'photographer-gallery', WPMF_GALLERY_ADDON_TAXO);
|
||||
foreach ($galleries as $gallery) {
|
||||
$gallery_type = get_term_meta((int)$gallery->term_id, 'gallery_type', true);
|
||||
$gallery_type = isset($galleries_types[(int)$gallery->term_id])? $galleries_types[(int)$gallery->term_id] : '' ;
|
||||
if (!empty($gallery_type) && $gallery_type === 'archive') {
|
||||
continue;
|
||||
}
|
||||
if (!empty($gallery_type) && $gallery_type === 'photographer') {
|
||||
$root = get_term_by('slug', 'photographer-gallery', WPMF_GALLERY_ADDON_TAXO);
|
||||
if ((int)$root->term_id === (int)$gallery->term_id) {
|
||||
$galleries_list[$i . '-' . $gallery->term_id] = esc_html__('Photographer Gallery', 'wpmf');
|
||||
} else {
|
||||
|
||||
Binary file not shown.
@@ -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.7
|
||||
Stable tag: 5.9.8
|
||||
License: GPLv2 or later
|
||||
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
@@ -20,6 +20,11 @@ Stop searching for an image through thousand of media, just navigate like you do
|
||||
|
||||
= Changelog =
|
||||
|
||||
= 5.9.8 =
|
||||
* Add : Create tags: Possibility to create tags for media files
|
||||
* Add : Bulk add tags: You can add tags to multiple media files at once.
|
||||
* Add : Filter by tag: Filter your media files by tag
|
||||
|
||||
= 5.9.7 =
|
||||
* Fix : Error while using Elementor theme builder
|
||||
|
||||
@@ -125,7 +130,7 @@ Stop searching for an image through thousand of media, just navigate like you do
|
||||
|
||||
= 5.6.0 =
|
||||
* Add : Download a folder in the media library using right click
|
||||
* Add : Folder bulk selet and remove in folder tree
|
||||
* Add : Folder bulk select and remove in folder tree
|
||||
* Add : New uploader styling and notifications
|
||||
* Add : Media download button in block editor improvement
|
||||
* Fix : Single file download style
|
||||
|
||||
@@ -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.7
|
||||
Version: 5.9.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.9.7');
|
||||
define('WPMF_VERSION', '5.9.8');
|
||||
define('WPMF_HIDE_USER_MEDIA_FOLDER_ROOT', true);
|
||||
|
||||
include_once(ABSPATH . 'wp-admin/includes/plugin.php');
|
||||
@@ -472,98 +472,20 @@ function wpmfUnInstall()
|
||||
global $wpdb;
|
||||
$wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'wpmf_s3_queue');
|
||||
|
||||
// delete option
|
||||
// delete all options with prefix 'wpmf_';
|
||||
$wpdb->query('DELETE FROM '.$wpdb->options. " WHERE option_name LIKE '%wpmf_%'");
|
||||
// delete all options with prefix '_wpmfAddon_';
|
||||
$wpdb->query('DELETE FROM '.$wpdb->options. " WHERE option_name LIKE '%_wpmfAddon_%'");
|
||||
|
||||
// delete other options
|
||||
$options_list = array(
|
||||
'wpmf_addon_version',
|
||||
'wpmf_folder_root_id',
|
||||
'wpmf_update_count',
|
||||
'wpmf_version',
|
||||
'wpmf_gallery_image_size_value',
|
||||
'wpmf_padding_masonry',
|
||||
'wpmf_padding_portfolio',
|
||||
'wpmf_usegellery',
|
||||
'wpmf_useorder',
|
||||
'wpmf_create_folder',
|
||||
'wpmf_option_override',
|
||||
'wpmf_option_duplicate',
|
||||
'wpmf_active_media',
|
||||
'wpmf_folder_option2',
|
||||
'wpmf_usegellery_lightbox',
|
||||
'wpmf_media_rename',
|
||||
'wpmf_patern_rename',
|
||||
'wpmf_rename_number',
|
||||
'wpmf_option_media_remove',
|
||||
'wpmf_default_dimension',
|
||||
'wpmf_selected_dimension',
|
||||
'wpmf_weight_default',
|
||||
'wpmf_weight_selected',
|
||||
'wpmf_color_singlefile',
|
||||
'wpmf_option_singlefile',
|
||||
'wpmf_option_sync_media',
|
||||
'wpmf_option_sync_media_external',
|
||||
'wpmf_list_sync_media',
|
||||
'wpmf_time_sync',
|
||||
'wpmf_lastRun_sync',
|
||||
'wpmf_slider_animation',
|
||||
'wpmf_option_mediafolder',
|
||||
'wpmf_option_countfiles',
|
||||
'wpmf_option_lightboximage',
|
||||
'wpmf_option_hoverimg',
|
||||
'wpmf_options_format_title',
|
||||
'wpmf_image_watermark_apply',
|
||||
'wpmf_option_image_watermark',
|
||||
'wpmf_watermark_position',
|
||||
'wpmf_watermark_image',
|
||||
'wpmf_watermark_image_id',
|
||||
'wpmf_gallery_settings',
|
||||
'_wpmf_import_notice_flag',
|
||||
'_wpmf_import_order_notice_flag',
|
||||
'_wpmfAddon_cloud_config',
|
||||
'_wpmfAddon_dropbox_config',
|
||||
'wpmf_onedrive_business',
|
||||
'_wpmfAddon_aws3_config',
|
||||
'wpmf_gallery_img_per_page',
|
||||
'_wpmf_import_size_notice_flag',
|
||||
'_wpmf_activation_redirect',
|
||||
'wpmfgrl_relationships_media',
|
||||
'wpmfgrl_relationships',
|
||||
'wpmf_galleries',
|
||||
'wpmf_import_nextgen_gallery',
|
||||
'wpmf_onedrive_business_files',
|
||||
'wpmf_odv_business_files',
|
||||
'wpmf_odv_allfiles',
|
||||
'wpmf_google_folders',
|
||||
'wpmf_google_allfiles',
|
||||
'wpmf_dropbox_allfiles',
|
||||
'wpmf_dropbox_folders',
|
||||
'wpmf_odv_folders',
|
||||
'wpmf_odv_business_folders',
|
||||
'wpmf_odv_business_allfiles',
|
||||
'_wpmfAddon_onedrive_business_config',
|
||||
'wpmf_onedrive_notice',
|
||||
'_wpmfAddon_onedrive_config',
|
||||
'wpmf_google_folder_id',
|
||||
'wpmf_dropbox_folder_id',
|
||||
'wpmf_odv_business_folder_id',
|
||||
'wpmf_odv_folder_id',
|
||||
'wpmf_cloud_connection_notice',
|
||||
'wp-media-folder-addon-tables',
|
||||
'_wpmf_activation_redirect',
|
||||
'wpmf_use_taxonomy',
|
||||
'wpmf_cloud_time_last_sync',
|
||||
'wpmf_dropbox_attachments',
|
||||
'wpmf_dropbox_folders',
|
||||
'wpmf_dropbox_allfiles',
|
||||
'wpmf_google_attachments',
|
||||
'wpmf_google_folders',
|
||||
'wpmf_google_allfiles',
|
||||
'wpmf_odv_attachments',
|
||||
'wpmf_odv_folders',
|
||||
'wpmf_odv_allfiles',
|
||||
'wpmf_odv_business_attachments',
|
||||
'wpmf_odv_business_folders',
|
||||
'wpmf_odv_business_allfiles',
|
||||
'wpmf_cloud_name_syncing',
|
||||
'wpmf_ftp_sync_time',
|
||||
'wpmf_ftp_sync_token',
|
||||
'wpmf_settings'
|
||||
'wp-media-folder-addon-tables'
|
||||
);
|
||||
|
||||
foreach ($options_list as $option) {
|
||||
@@ -2027,3 +1949,42 @@ function wpmfDownloadFile()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Register wpmf_tag taxonomy */
|
||||
add_action('init', 'wpmfTagRegisterTaxonomy', 0);
|
||||
/**
|
||||
* Register gallery taxonomy
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function wpmfTagRegisterTaxonomy()
|
||||
{
|
||||
if (!taxonomy_exists('wpmf_tag')) {
|
||||
register_taxonomy(
|
||||
'wpmf_tag',
|
||||
'attachment',
|
||||
array(
|
||||
'hierarchical' => false,
|
||||
'show_in_nav_menus' => false,
|
||||
'show_admin_column' => true,
|
||||
'show_ui' => true,
|
||||
'public' => true,
|
||||
'update_count_callback' => '_update_generic_term_count',
|
||||
'labels' => array(
|
||||
'name' => __('Tags', 'wpmf'),
|
||||
'singular_name' => __('Tags', 'wpmf'),
|
||||
'menu_name' => __('Media Folder Tags', 'wpmf'),
|
||||
'all_items' => __('All Tags', 'wpmf'),
|
||||
'edit_item' => __('Edit Tag', 'wpmf'),
|
||||
'view_item' => __('View Tag', 'wpmf'),
|
||||
'update_item' => __('Update Tag', 'wpmf'),
|
||||
'add_new_item' => __('Add New Tag', 'wpmf'),
|
||||
'new_item_name' => __('New Tag Name', 'wpmf'),
|
||||
'parent_item' => __('Parent Tag', 'wpmf'),
|
||||
'parent_item_colon' => __('Parent Tag:', 'wpmf'),
|
||||
'search_items' => __('Search Tag', 'wpmf'),
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user