Version Description
Move elements (media library, posts, pages, custom posts) to folders by selecting the element and selecting the relevant folder from our dropdown. Also added some UI improvements :)
Download this release
Release Info
Developer | galdub |
Plugin | Folders – Unlimited Folders to Organize Media Library Folder, Pages, Posts, File Manager |
Version | 2.4 |
Comparing to | |
See all releases |
Code changes from version 2.3.9 to 2.4
- assets/css/design.css +26 -0
- assets/css/media.css +3 -3
- assets/images/thanks.gif +0 -0
- assets/js/custom.js +212 -13
- folders.php +2 -2
- includes/class-review-box.php +80 -12
- includes/folders.class.php +69 -16
- includes/tree.class.php +3 -2
- readme.txt +5 -1
- templates/admin/admin-content.php +20 -1
assets/css/design.css
CHANGED
@@ -1338,6 +1338,32 @@ svg#successAnimation {
|
|
1338 |
.mCSB_scrollTools a+.mCSB_draggerContainer {
|
1339 |
margin: 10px 0 !important;
|
1340 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1341 |
@media screen and (max-width: 1300px) {
|
1342 |
.tree-structure li {
|
1343 |
width: 20%;
|
1338 |
.mCSB_scrollTools a+.mCSB_draggerContainer {
|
1339 |
margin: 10px 0 !important;
|
1340 |
}
|
1341 |
+
.popup-folder-title {
|
1342 |
+
font-weight: bold;
|
1343 |
+
font-size: 24px;
|
1344 |
+
padding: 0 0 20px 0;
|
1345 |
+
}
|
1346 |
+
.select-box {
|
1347 |
+
padding: 20px 0 10px 0;
|
1348 |
+
}
|
1349 |
+
.select-box select {
|
1350 |
+
width: 100%;
|
1351 |
+
max-width: 300px;
|
1352 |
+
}
|
1353 |
+
.actions #media_folder, select.media-select-folder {
|
1354 |
+
width: 132px;
|
1355 |
+
}
|
1356 |
+
select#media-attachment-taxonomy-filter {
|
1357 |
+
width: 132px;
|
1358 |
+
}
|
1359 |
+
.custom-media-select {
|
1360 |
+
float: right;
|
1361 |
+
padding: 10px 0 0 0;
|
1362 |
+
display: none;
|
1363 |
+
}
|
1364 |
+
.custom-media-select.active {
|
1365 |
+
display: block;
|
1366 |
+
}
|
1367 |
@media screen and (max-width: 1300px) {
|
1368 |
.tree-structure li {
|
1369 |
width: 20%;
|
assets/css/media.css
CHANGED
@@ -5,15 +5,15 @@
|
|
5 |
.media-modal-content .media-frame select.attachment-filters {
|
6 |
width: 28% !important;
|
7 |
}
|
8 |
-
#media-attachment-taxonomy-filter {
|
9 |
border: solid 1px #FF5983;
|
10 |
color: #FF5983;
|
11 |
font-weight: bold;
|
12 |
}
|
13 |
-
#media-attachment-taxonomy-filter option {
|
14 |
color: #000000;
|
15 |
}
|
16 |
-
#media-attachment-taxonomy-filter option:first-child {
|
17 |
font-weight: bold;
|
18 |
}
|
19 |
.media-frame .uploader-inline {
|
5 |
.media-modal-content .media-frame select.attachment-filters {
|
6 |
width: 28% !important;
|
7 |
}
|
8 |
+
#media-attachment-taxonomy-filter, select.media-select-folder {
|
9 |
border: solid 1px #FF5983;
|
10 |
color: #FF5983;
|
11 |
font-weight: bold;
|
12 |
}
|
13 |
+
#media-attachment-taxonomy-filter option, select.media-select-folder option {
|
14 |
color: #000000;
|
15 |
}
|
16 |
+
#media-attachment-taxonomy-filter option:first-child, select.media-select-folder option:first-child {
|
17 |
font-weight: bold;
|
18 |
}
|
19 |
.media-frame .uploader-inline {
|
assets/images/thanks.gif
ADDED
Binary file
|
assets/js/custom.js
CHANGED
@@ -14,6 +14,7 @@ var activeRecordID = "";
|
|
14 |
var folderIDs = "";
|
15 |
var isMultipleRemove = false;
|
16 |
var isItFromMedia = false;
|
|
|
17 |
|
18 |
var listFolderString = "<li class='grid-view' data-id='__folder_id__' id='folder___folder_id__'>" +
|
19 |
"<div class='folder-item is-folder' data-id='__folder_id__'>" +
|
@@ -27,6 +28,39 @@ var listFolderString = "<li class='grid-view' data-id='__folder_id__' id='folder
|
|
27 |
"</li>";
|
28 |
|
29 |
jQuery(document).ready(function(){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
jQuery(document).on("click", ".form-cancel-btn", function(){
|
31 |
jQuery(".folder-popup-form").hide();
|
32 |
});
|
@@ -90,6 +124,58 @@ jQuery(document).ready(function(){
|
|
90 |
}
|
91 |
return false;
|
92 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
jQuery(document).on("submit", "#update-folder-form", function(e){
|
94 |
e.stopPropagation();
|
95 |
e.preventDefault();
|
@@ -180,6 +266,34 @@ jQuery(document).ready(function(){
|
|
180 |
});
|
181 |
});
|
182 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
function removeMultipleFolderItems() {
|
184 |
if(jQuery("#folder-hide-show-checkbox").is(":checked")) {
|
185 |
if(jQuery("#custom-menu input.checkbox:checked").length > 0) {
|
@@ -244,6 +358,9 @@ function triggerInlineUpdate() {
|
|
244 |
|
245 |
jQuery(".form-loader-count").css("width", "0");
|
246 |
if(typeof inlineEditPost == "object") {
|
|
|
|
|
|
|
247 |
jQuery("#the-list").on("click",".editinline",function(){jQuery(this).attr("aria-expanded","true"),inlineEditPost.edit(this)});
|
248 |
jQuery(document).on("click", ".inline-edit-save .save", function(){
|
249 |
var thisID = jQuery(this).closest("tr").attr("id");
|
@@ -256,6 +373,8 @@ function triggerInlineUpdate() {
|
|
256 |
inlineEditPost.revert(thisID);
|
257 |
});
|
258 |
}
|
|
|
|
|
259 |
}
|
260 |
|
261 |
function ajaxAnimation() {
|
@@ -340,6 +459,12 @@ function removeFolderFromID(popup_type) {
|
|
340 |
}
|
341 |
|
342 |
function resetMediaAndPosts() {
|
|
|
|
|
|
|
|
|
|
|
|
|
343 |
if(folderIDs != "" && (jQuery("#custom-menu li.active-item").length > 0 || activeRecordID == "-1")) {
|
344 |
if(jQuery("#media-attachment-taxonomy-filter").length) {
|
345 |
folderIDs = folderIDs.split(",");
|
@@ -368,7 +493,7 @@ function resetMediaAndPosts() {
|
|
368 |
if(!jQuery("#title_"+res.taxonomies[i].term_id+" .total-count").length) {
|
369 |
jQuery("#title_"+res.taxonomies[i].term_id+" .star-icon").before("<span class='total-count'></span>");
|
370 |
}
|
371 |
-
jQuery("#title_"+res.taxonomies[i].term_id+" .total-count").text(parseInt(res.taxonomies[i].
|
372 |
}
|
373 |
|
374 |
jQuery("#custom-menu .total-count").each(function(){
|
@@ -539,6 +664,7 @@ jQuery(document).ready(function(){
|
|
539 |
if(jQuery(this).hasClass("is-new-item")) {
|
540 |
thisSlug = jQuery(this).closest("li.route").data("slug");
|
541 |
}
|
|
|
542 |
//add_menu_to_list();
|
543 |
}
|
544 |
add_active_item_to_list();
|
@@ -609,9 +735,15 @@ jQuery(document).ready(function(){
|
|
609 |
} else if( ui.draggable.hasClass( 'wcp-move-file' ) ){
|
610 |
postID = ui.draggable[0].attributes['data-id'].nodeValue;
|
611 |
nonce = jQuery.trim(jQuery("#wcp_folder_"+folderID).data("nonce"));
|
|
|
|
|
|
|
|
|
|
|
|
|
612 |
jQuery.ajax({
|
613 |
url: wcp_settings.ajax_url,
|
614 |
-
data: "
|
615 |
method: 'post',
|
616 |
success: function (res) {
|
617 |
res = jQuery.parseJSON(res);
|
@@ -763,9 +895,15 @@ jQuery(document).ready(function(){
|
|
763 |
}
|
764 |
} else if (ui.draggable.hasClass('wcp-move-file')) {
|
765 |
postID = ui.draggable[0].attributes['data-id'].nodeValue;
|
|
|
|
|
|
|
|
|
|
|
|
|
766 |
jQuery.ajax({
|
767 |
url: wcp_settings.ajax_url,
|
768 |
-
data: "post_id=" +
|
769 |
method: 'post',
|
770 |
success: function (res) {
|
771 |
//window.location.reload();
|
@@ -868,9 +1006,15 @@ jQuery(document).ready(function(){
|
|
868 |
} else if ( ui.draggable.hasClass( 'wcp-move-file' ) ) {
|
869 |
postID = ui.draggable[0].attributes['data-id'].nodeValue;
|
870 |
nonce = jQuery.trim(jQuery("#wcp_folder_"+folderID).data("nonce"));
|
|
|
|
|
|
|
|
|
|
|
|
|
871 |
jQuery.ajax({
|
872 |
url: wcp_settings.ajax_url,
|
873 |
-
data: "
|
874 |
method: 'post',
|
875 |
success: function (res) {
|
876 |
// window.location.reload();
|
@@ -1474,7 +1618,8 @@ if(wcp_settings.post_type == "attachment") {
|
|
1474 |
jQuery(window).load(function() {
|
1475 |
jQuery("button.button.media-button.select-mode-toggle-button").after("<button class='button organize-button'>Bulk Organize</button>");
|
1476 |
jQuery(".media-toolbar-secondary").append("<span class='media-info-message'>Drag and drop your media files to the relevant folders</span>");
|
1477 |
-
jQuery(".delete-selected-button").before("<button type='button' class='button button-primary select-all-item-btn'>Select All</button>")
|
|
|
1478 |
if(jQuery(".wcp-custom-form").length) {
|
1479 |
if (wp.Uploader !== undefined) {
|
1480 |
wp.Uploader.queue.on('reset', function () {
|
@@ -1496,20 +1641,71 @@ if(wcp_settings.post_type == "attachment") {
|
|
1496 |
mediaMode = getCookie("media-select-mode");
|
1497 |
if (mediaMode == "on") {
|
1498 |
jQuery("button.button.media-button.select-mode-toggle-button").trigger("click");
|
1499 |
-
jQuery(".attachments-browser li.attachment").draggable("enable");
|
1500 |
|
1501 |
if (jQuery(".media-frame").hasClass("mode-select")) {
|
1502 |
jQuery(".media-info-message").addClass("active");
|
1503 |
} else {
|
1504 |
-
jQuery(".media-info-message").removeClass("active");
|
1505 |
}
|
1506 |
}
|
1507 |
} else {
|
1508 |
eraseCookie("media-select-mode");
|
1509 |
}
|
1510 |
-
resetMediaData(
|
1511 |
}, 1000);
|
1512 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1513 |
|
1514 |
function resetMediaData(loadData) {
|
1515 |
jQuery.ajax({
|
@@ -1537,10 +1733,13 @@ if(wcp_settings.post_type == "attachment") {
|
|
1537 |
folders_media_options.terms = res.taxonomies;
|
1538 |
var selectedDD = jQuery("#media-attachment-taxonomy-filter");
|
1539 |
selectedDD.html("<option value='all'>All Folders</option><option value='unassigned'>(Unassigned)</option>");
|
|
|
1540 |
for (i = 0; i < res.taxonomies.length; i++) {
|
1541 |
-
selectedDD.append("<option value='" + res.taxonomies[i].term_id + "'>" + res.taxonomies[i].name + " (" + res.taxonomies[i].
|
|
|
1542 |
}
|
1543 |
selectedDD.val(selectedVal);
|
|
|
1544 |
}
|
1545 |
if(jQuery("select.folder_for_media").length) {
|
1546 |
selectedVal = jQuery("select.folder_for_media").val();
|
@@ -1556,7 +1755,7 @@ if(wcp_settings.post_type == "attachment") {
|
|
1556 |
if(!jQuery("#title_"+res.taxonomies[i].term_id+" .total-count").length) {
|
1557 |
jQuery("#title_"+res.taxonomies[i].term_id+" .star-icon").before("<span class='total-count'></span>");
|
1558 |
}
|
1559 |
-
jQuery("#title_"+res.taxonomies[i].term_id+" .total-count").text(parseInt(res.taxonomies[i].
|
1560 |
}
|
1561 |
|
1562 |
jQuery("#custom-menu .total-count").each(function(){
|
@@ -1602,7 +1801,7 @@ if(wcp_settings.post_type == "attachment") {
|
|
1602 |
jQuery(".media-info-message").addClass("active");
|
1603 |
jQuery(".select-all-item-btn").addClass("active");
|
1604 |
} else {
|
1605 |
-
jQuery(".media-info-message").removeClass("active");
|
1606 |
jQuery(".select-all-item-btn").removeClass("active");
|
1607 |
}
|
1608 |
});
|
@@ -1616,7 +1815,7 @@ if(wcp_settings.post_type == "attachment") {
|
|
1616 |
jQuery(".media-info-message").addClass("active");
|
1617 |
jQuery(".select-all-item-btn").addClass("active");
|
1618 |
} else {
|
1619 |
-
jQuery(".media-info-message").removeClass("active");
|
1620 |
jQuery(".select-all-item-btn").removeClass("active");
|
1621 |
}
|
1622 |
}, 10);
|
14 |
var folderIDs = "";
|
15 |
var isMultipleRemove = false;
|
16 |
var isItFromMedia = false;
|
17 |
+
var $action_form;
|
18 |
|
19 |
var listFolderString = "<li class='grid-view' data-id='__folder_id__' id='folder___folder_id__'>" +
|
20 |
"<div class='folder-item is-folder' data-id='__folder_id__'>" +
|
28 |
"</li>";
|
29 |
|
30 |
jQuery(document).ready(function(){
|
31 |
+
//jQuery("#bulk-action-selector-top").closest("form").on("submit", function(){
|
32 |
+
// alert("submitted");
|
33 |
+
// return false;
|
34 |
+
//});
|
35 |
+
jQuery(document).on("click", ".select-all-item-btn", function(e){
|
36 |
+
if(jQuery("ul.attachments li.selected").length == 0) {
|
37 |
+
jQuery(".custom-media-select").removeClass("active");
|
38 |
+
} else {
|
39 |
+
jQuery(".custom-media-select").addClass("active");
|
40 |
+
}
|
41 |
+
});
|
42 |
+
jQuery(document).on("click", "#doaction", function(e){
|
43 |
+
if(jQuery("#bulk-action-selector-top").val() == "move_to_folder") {
|
44 |
+
show_folder_popup();
|
45 |
+
return false;
|
46 |
+
} else if(jQuery("#bulk-action-selector-top").val() == "edit") {
|
47 |
+
if(typeof inlineEditPost == "object") {
|
48 |
+
inlineEditPost.setBulk();
|
49 |
+
return false;
|
50 |
+
}
|
51 |
+
}
|
52 |
+
});
|
53 |
+
jQuery(document).on("click", "#doaction2", function(e){
|
54 |
+
if(jQuery("#bulk-action-selector-bottom").val() == "move_to_folder") {
|
55 |
+
show_folder_popup();
|
56 |
+
return false;
|
57 |
+
} else if(jQuery("#bulk-action-selector-bottom").val() == "edit") {
|
58 |
+
if(typeof inlineEditPost == "object") {
|
59 |
+
inlineEditPost.setBulk();
|
60 |
+
return false;
|
61 |
+
}
|
62 |
+
}
|
63 |
+
});
|
64 |
jQuery(document).on("click", ".form-cancel-btn", function(){
|
65 |
jQuery(".folder-popup-form").hide();
|
66 |
});
|
124 |
}
|
125 |
return false;
|
126 |
});
|
127 |
+
jQuery(document).on("change", "#bulk-select", function(e) {
|
128 |
+
if(jQuery("#bulk-select").val() != "") {
|
129 |
+
jQuery("#move-to-folder").attr("disabled", false);
|
130 |
+
} else {
|
131 |
+
jQuery("#move-to-folder").attr("disabled", true);
|
132 |
+
}
|
133 |
+
});
|
134 |
+
jQuery(document).on("submit", "#bulk-folder-form", function(e) {
|
135 |
+
e.stopPropagation();
|
136 |
+
e.preventDefault();
|
137 |
+
|
138 |
+
if(jQuery("#bulk-select").val() != "") {
|
139 |
+
chkStr = "";
|
140 |
+
jQuery(".wp-list-table input:checked").each(function () {
|
141 |
+
chkStr += jQuery(this).val() + ",";
|
142 |
+
});
|
143 |
+
if(jQuery("#bulk-select").val() != "") {
|
144 |
+
if (jQuery("#bulk-select").val() == "-1") {
|
145 |
+
jQuery.ajax({
|
146 |
+
url: wcp_settings.ajax_url,
|
147 |
+
data: "post_id=" + chkStr + "&type=" + wcp_settings.post_type + "&action=wcp_remove_post_folder&folder_id=" + jQuery(this).val() + "&nonce=" + wcp_settings.nonce + "&status=" + wcp_settings.taxonomy_status + "&taxonomy=" + activeRecordID,
|
148 |
+
method: 'post',
|
149 |
+
success: function (res) {
|
150 |
+
jQuery("#bulk-move-folder").hide();
|
151 |
+
resetMediaAndPosts();
|
152 |
+
ajaxAnimation();
|
153 |
+
}
|
154 |
+
});
|
155 |
+
} else {
|
156 |
+
nonce = jQuery.trim(jQuery("#wcp_folder_" + jQuery("#bulk-select").val()).data("nonce"));
|
157 |
+
jQuery.ajax({
|
158 |
+
url: wcp_settings.ajax_url,
|
159 |
+
data: "post_ids=" + chkStr + "&type=" + wcp_settings.post_type + "&action=wcp_change_multiple_post_folder&folder_id=" + jQuery("#bulk-select").val() + "&nonce=" + nonce + "&status=" + wcp_settings.taxonomy_status + "&taxonomy=" + activeRecordID,
|
160 |
+
method: 'post',
|
161 |
+
success: function (res) {
|
162 |
+
res = jQuery.parseJSON(res);
|
163 |
+
jQuery("#bulk-move-folder").hide();
|
164 |
+
if (res.status == "1") {
|
165 |
+
resetMediaAndPosts();
|
166 |
+
ajaxAnimation();
|
167 |
+
} else {
|
168 |
+
jQuery(".folder-popup-form").hide();
|
169 |
+
jQuery(".folder-popup-form").removeClass("disabled");
|
170 |
+
jQuery("#error-folder-popup-message").html(res.message);
|
171 |
+
jQuery("#error-folder-popup").show()
|
172 |
+
}
|
173 |
+
}
|
174 |
+
});
|
175 |
+
}
|
176 |
+
}
|
177 |
+
}
|
178 |
+
});
|
179 |
jQuery(document).on("submit", "#update-folder-form", function(e){
|
180 |
e.stopPropagation();
|
181 |
e.preventDefault();
|
266 |
});
|
267 |
});
|
268 |
|
269 |
+
function show_folder_popup() {
|
270 |
+
jQuery("#bulk-action-selector-top, #bulk-action-selector-bottom").val("-1");
|
271 |
+
if(jQuery(".wp-list-table tbody input[type='checkbox']:checked").length == 0) {
|
272 |
+
alert("Please select items to move in folder");
|
273 |
+
} else {
|
274 |
+
jQuery("#bulk-move-folder").show();
|
275 |
+
jQuery("#bulk-select").html("<option value=''>Loading...</option>");
|
276 |
+
jQuery(".move-to-folder").attr("disabled", true);
|
277 |
+
jQuery.ajax({
|
278 |
+
url: wcp_settings.ajax_url,
|
279 |
+
data: "type=" + wcp_settings.post_type + "&action=wcp_get_default_list&active_id=" + activeRecordID,
|
280 |
+
method: 'post',
|
281 |
+
success: function (res) {
|
282 |
+
res = jQuery.parseJSON(res);
|
283 |
+
jQuery("#bulk-select").html("<option value=''>Select Folder</option><option value='-1'>(Unassigned)</option>");
|
284 |
+
jQuery(".move-to-folder").attr("disabled", false);
|
285 |
+
jQuery("#move-to-folder").attr("disabled", true);
|
286 |
+
if(res.status == 1) {
|
287 |
+
var taxonomies = res.taxonomies;
|
288 |
+
for(i=0;i<taxonomies.length;i++) {
|
289 |
+
jQuery("#bulk-select").append("<option value='"+taxonomies[i].term_id+"'>"+taxonomies[i].name+"</option>");
|
290 |
+
}
|
291 |
+
}
|
292 |
+
}
|
293 |
+
});
|
294 |
+
}
|
295 |
+
}
|
296 |
+
|
297 |
function removeMultipleFolderItems() {
|
298 |
if(jQuery("#folder-hide-show-checkbox").is(":checked")) {
|
299 |
if(jQuery("#custom-menu input.checkbox:checked").length > 0) {
|
358 |
|
359 |
jQuery(".form-loader-count").css("width", "0");
|
360 |
if(typeof inlineEditPost == "object") {
|
361 |
+
|
362 |
+
inlineEditPost.init();
|
363 |
+
|
364 |
jQuery("#the-list").on("click",".editinline",function(){jQuery(this).attr("aria-expanded","true"),inlineEditPost.edit(this)});
|
365 |
jQuery(document).on("click", ".inline-edit-save .save", function(){
|
366 |
var thisID = jQuery(this).closest("tr").attr("id");
|
373 |
inlineEditPost.revert(thisID);
|
374 |
});
|
375 |
}
|
376 |
+
|
377 |
+
|
378 |
}
|
379 |
|
380 |
function ajaxAnimation() {
|
459 |
}
|
460 |
|
461 |
function resetMediaAndPosts() {
|
462 |
+
if(jQuery(".media-toolbar").hasClass("media-toolbar-mode-select")) {
|
463 |
+
if(jQuery("ul.attachments li.selected").length) {
|
464 |
+
jQuery("ul.attachments li.selected").trigger("click");
|
465 |
+
jQuery(".select-mode-toggle-button").trigger("click");
|
466 |
+
}
|
467 |
+
}
|
468 |
if(folderIDs != "" && (jQuery("#custom-menu li.active-item").length > 0 || activeRecordID == "-1")) {
|
469 |
if(jQuery("#media-attachment-taxonomy-filter").length) {
|
470 |
folderIDs = folderIDs.split(",");
|
493 |
if(!jQuery("#title_"+res.taxonomies[i].term_id+" .total-count").length) {
|
494 |
jQuery("#title_"+res.taxonomies[i].term_id+" .star-icon").before("<span class='total-count'></span>");
|
495 |
}
|
496 |
+
jQuery("#title_"+res.taxonomies[i].term_id+" .total-count").text(parseInt(res.taxonomies[i].trash_count));
|
497 |
}
|
498 |
|
499 |
jQuery("#custom-menu .total-count").each(function(){
|
664 |
if(jQuery(this).hasClass("is-new-item")) {
|
665 |
thisSlug = jQuery(this).closest("li.route").data("slug");
|
666 |
}
|
667 |
+
jQuery(".custom-media-select").removeClass("active");
|
668 |
//add_menu_to_list();
|
669 |
}
|
670 |
add_active_item_to_list();
|
735 |
} else if( ui.draggable.hasClass( 'wcp-move-file' ) ){
|
736 |
postID = ui.draggable[0].attributes['data-id'].nodeValue;
|
737 |
nonce = jQuery.trim(jQuery("#wcp_folder_"+folderID).data("nonce"));
|
738 |
+
chkStr = postID+",";
|
739 |
+
jQuery(".wp-list-table input:checked").each(function(){
|
740 |
+
if(jQuery(this).val() != postID) {
|
741 |
+
chkStr += jQuery(this).val() + ",";
|
742 |
+
}
|
743 |
+
});
|
744 |
jQuery.ajax({
|
745 |
url: wcp_settings.ajax_url,
|
746 |
+
data: "post_ids=" + chkStr + "&type=" + wcp_settings.post_type + "&action=wcp_change_multiple_post_folder&folder_id=" + folderID+"&nonce="+nonce+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+activeRecordID,
|
747 |
method: 'post',
|
748 |
success: function (res) {
|
749 |
res = jQuery.parseJSON(res);
|
895 |
}
|
896 |
} else if (ui.draggable.hasClass('wcp-move-file')) {
|
897 |
postID = ui.draggable[0].attributes['data-id'].nodeValue;
|
898 |
+
chkStr = postID+",";
|
899 |
+
jQuery(".wp-list-table input:checked").each(function () {
|
900 |
+
if(postID != jQuery(this).val()) {
|
901 |
+
chkStr += jQuery(this).val() + ",";
|
902 |
+
}
|
903 |
+
});
|
904 |
jQuery.ajax({
|
905 |
url: wcp_settings.ajax_url,
|
906 |
+
data: "post_id=" + chkStr + "&type=" + wcp_settings.post_type + "&action=wcp_remove_post_folder&folder_id=" + folderID + "&nonce=" + nonce+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+activeRecordID,
|
907 |
method: 'post',
|
908 |
success: function (res) {
|
909 |
//window.location.reload();
|
1006 |
} else if ( ui.draggable.hasClass( 'wcp-move-file' ) ) {
|
1007 |
postID = ui.draggable[0].attributes['data-id'].nodeValue;
|
1008 |
nonce = jQuery.trim(jQuery("#wcp_folder_"+folderID).data("nonce"));
|
1009 |
+
chkStr = postID+",";
|
1010 |
+
jQuery(".wp-list-table input:checked").each(function(){
|
1011 |
+
if(jQuery(this).val() != postID) {
|
1012 |
+
chkStr += jQuery(this).val() + ",";
|
1013 |
+
}
|
1014 |
+
});
|
1015 |
jQuery.ajax({
|
1016 |
url: wcp_settings.ajax_url,
|
1017 |
+
data: "post_ids=" + chkStr + "&type=" + wcp_settings.post_type + "&action=wcp_change_multiple_post_folder&folder_id=" + folderID + "&nonce="+nonce+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+activeRecordID,
|
1018 |
method: 'post',
|
1019 |
success: function (res) {
|
1020 |
// window.location.reload();
|
1618 |
jQuery(window).load(function() {
|
1619 |
jQuery("button.button.media-button.select-mode-toggle-button").after("<button class='button organize-button'>Bulk Organize</button>");
|
1620 |
jQuery(".media-toolbar-secondary").append("<span class='media-info-message'>Drag and drop your media files to the relevant folders</span>");
|
1621 |
+
jQuery(".delete-selected-button").before("<button type='button' class='button button-primary select-all-item-btn'>Select All</button>");
|
1622 |
+
jQuery(".media-toolbar-secondary").after("<div class='custom-media-select'>Move Selected files to: <select class='media-select-folder'></select></div>");
|
1623 |
if(jQuery(".wcp-custom-form").length) {
|
1624 |
if (wp.Uploader !== undefined) {
|
1625 |
wp.Uploader.queue.on('reset', function () {
|
1641 |
mediaMode = getCookie("media-select-mode");
|
1642 |
if (mediaMode == "on") {
|
1643 |
jQuery("button.button.media-button.select-mode-toggle-button").trigger("click");
|
1644 |
+
//jQuery(".attachments-browser li.attachment").draggable("enable");
|
1645 |
|
1646 |
if (jQuery(".media-frame").hasClass("mode-select")) {
|
1647 |
jQuery(".media-info-message").addClass("active");
|
1648 |
} else {
|
1649 |
+
jQuery(".media-info-message, .custom-media-select").removeClass("active");
|
1650 |
}
|
1651 |
}
|
1652 |
} else {
|
1653 |
eraseCookie("media-select-mode");
|
1654 |
}
|
1655 |
+
resetMediaData(1);
|
1656 |
}, 1000);
|
1657 |
+
|
1658 |
+
jQuery(document).on("click", ".attachments-browser ul.attachments .thumbnail", function(){
|
1659 |
+
if(jQuery(".media-toolbar").hasClass("media-toolbar-mode-select")) {
|
1660 |
+
if(jQuery("ul.attachments li.selected").length == 0) {
|
1661 |
+
jQuery(".custom-media-select").removeClass("active");
|
1662 |
+
} else {
|
1663 |
+
jQuery(".custom-media-select").addClass("active");
|
1664 |
+
}
|
1665 |
+
}
|
1666 |
+
});
|
1667 |
+
|
1668 |
+
jQuery(document).on("change", ".media-select-folder", function(){
|
1669 |
+
if(jQuery(this).val() != "") {
|
1670 |
+
var checkStr = "";
|
1671 |
+
jQuery(".attachments-browser li.attachment.selected").each(function(){
|
1672 |
+
checkStr += jQuery(this).attr("data-id")+",";
|
1673 |
+
});
|
1674 |
+
console.log(checkStr);
|
1675 |
+
if(jQuery(this).val() == "-1") {
|
1676 |
+
jQuery.ajax({
|
1677 |
+
url: wcp_settings.ajax_url,
|
1678 |
+
data: "post_id=" + checkStr + "&type=" + wcp_settings.post_type + "&action=wcp_remove_post_folder&folder_id=" + jQuery(this).val() + "&nonce=" + wcp_settings.nonce +"&status="+wcp_settings.taxonomy_status+"&taxonomy="+activeRecordID,
|
1679 |
+
method: 'post',
|
1680 |
+
success: function (res) {
|
1681 |
+
resetMediaAndPosts();
|
1682 |
+
ajaxAnimation();
|
1683 |
+
}
|
1684 |
+
});
|
1685 |
+
} else {
|
1686 |
+
nonce = jQuery.trim(jQuery("#wcp_folder_" + jQuery(this).val()).data("nonce"));
|
1687 |
+
jQuery.ajax({
|
1688 |
+
url: wcp_settings.ajax_url,
|
1689 |
+
data: "post_ids=" + checkStr + "&type=" + wcp_settings.post_type + "&action=wcp_change_multiple_post_folder&folder_id=" + jQuery(this).val() + "&nonce=" + nonce + "&status=" + wcp_settings.taxonomy_status + "&taxonomy=" + activeRecordID,
|
1690 |
+
method: 'post',
|
1691 |
+
success: function (res) {
|
1692 |
+
res = jQuery.parseJSON(res);
|
1693 |
+
jQuery("#bulk-move-folder").hide();
|
1694 |
+
if (res.status == "1") {
|
1695 |
+
resetMediaAndPosts();
|
1696 |
+
ajaxAnimation();
|
1697 |
+
} else {
|
1698 |
+
jQuery(".folder-popup-form").hide();
|
1699 |
+
jQuery(".folder-popup-form").removeClass("disabled");
|
1700 |
+
jQuery("#error-folder-popup-message").html(res.message);
|
1701 |
+
jQuery("#error-folder-popup").show()
|
1702 |
+
}
|
1703 |
+
}
|
1704 |
+
});
|
1705 |
+
}
|
1706 |
+
}
|
1707 |
+
});
|
1708 |
+
});
|
1709 |
|
1710 |
function resetMediaData(loadData) {
|
1711 |
jQuery.ajax({
|
1733 |
folders_media_options.terms = res.taxonomies;
|
1734 |
var selectedDD = jQuery("#media-attachment-taxonomy-filter");
|
1735 |
selectedDD.html("<option value='all'>All Folders</option><option value='unassigned'>(Unassigned)</option>");
|
1736 |
+
jQuery(".media-select-folder").html("<option value=''>Select Folder</option><option value='-1'>(Unassigned)</option>");
|
1737 |
for (i = 0; i < res.taxonomies.length; i++) {
|
1738 |
+
selectedDD.append("<option value='" + res.taxonomies[i].term_id + "'>" + res.taxonomies[i].name + " (" + res.taxonomies[i].trash_count + ")</option>");
|
1739 |
+
jQuery(".media-select-folder").append("<option value='" + res.taxonomies[i].term_id + "'>" + res.taxonomies[i].name + " (" + res.taxonomies[i].trash_count + ")</option>");
|
1740 |
}
|
1741 |
selectedDD.val(selectedVal);
|
1742 |
+
jQuery(".media-select-folder").val("");
|
1743 |
}
|
1744 |
if(jQuery("select.folder_for_media").length) {
|
1745 |
selectedVal = jQuery("select.folder_for_media").val();
|
1755 |
if(!jQuery("#title_"+res.taxonomies[i].term_id+" .total-count").length) {
|
1756 |
jQuery("#title_"+res.taxonomies[i].term_id+" .star-icon").before("<span class='total-count'></span>");
|
1757 |
}
|
1758 |
+
jQuery("#title_"+res.taxonomies[i].term_id+" .total-count").text(parseInt(res.taxonomies[i].trash_count));
|
1759 |
}
|
1760 |
|
1761 |
jQuery("#custom-menu .total-count").each(function(){
|
1801 |
jQuery(".media-info-message").addClass("active");
|
1802 |
jQuery(".select-all-item-btn").addClass("active");
|
1803 |
} else {
|
1804 |
+
jQuery(".media-info-message, .custom-media-select").removeClass("active");
|
1805 |
jQuery(".select-all-item-btn").removeClass("active");
|
1806 |
}
|
1807 |
});
|
1815 |
jQuery(".media-info-message").addClass("active");
|
1816 |
jQuery(".select-all-item-btn").addClass("active");
|
1817 |
} else {
|
1818 |
+
jQuery(".media-info-message, .custom-media-select").removeClass("active");
|
1819 |
jQuery(".select-all-item-btn").removeClass("active");
|
1820 |
}
|
1821 |
}, 10);
|
folders.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* Plugin Name: Folders
|
4 |
* Description: Arrange media, pages, custom post types and posts into folders
|
5 |
-
* Version: 2.
|
6 |
* Author: Premio
|
7 |
* Author URI: https://premio.io/downloads/folders/
|
8 |
* Text Domain: folders
|
@@ -30,7 +30,7 @@ if(!defined("WCP_FOLDER_URL")) {
|
|
30 |
define('WCP_FOLDER_URL', plugin_dir_url(__FILE__));
|
31 |
}
|
32 |
if(!defined("WCP_FOLDER_VERSION")) {
|
33 |
-
define('WCP_FOLDER_VERSION', "2.
|
34 |
}
|
35 |
|
36 |
include_once plugin_dir_path(__FILE__)."includes/folders.class.php";
|
2 |
/**
|
3 |
* Plugin Name: Folders
|
4 |
* Description: Arrange media, pages, custom post types and posts into folders
|
5 |
+
* Version: 2.4
|
6 |
* Author: Premio
|
7 |
* Author URI: https://premio.io/downloads/folders/
|
8 |
* Text Domain: folders
|
30 |
define('WCP_FOLDER_URL', plugin_dir_url(__FILE__));
|
31 |
}
|
32 |
if(!defined("WCP_FOLDER_VERSION")) {
|
33 |
+
define('WCP_FOLDER_VERSION', "2.4");
|
34 |
}
|
35 |
|
36 |
include_once plugin_dir_path(__FILE__)."includes/folders.class.php";
|
includes/class-review-box.php
CHANGED
@@ -152,19 +152,74 @@ class folders_review_box {
|
|
152 |
vertical-align: middle;
|
153 |
border-radius: 15px;
|
154 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
</style>
|
156 |
<div class="notice notice-info premio-notice <?php echo $this->plugin_slug ?>-premio-review-box <?php echo $this->plugin_slug ?>-premio-review-box">
|
157 |
-
<
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
<
|
165 |
-
|
166 |
-
|
167 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
</div>
|
169 |
<div class="<?php echo $this->plugin_slug ?>-review-box-popup">
|
170 |
<div class="<?php echo $this->plugin_slug ?>-review-box-popup-content">
|
@@ -186,8 +241,21 @@ class folders_review_box {
|
|
186 |
jQuery(document).on("click", ".<?php echo $this->plugin_slug ?>-close-review-box-popup", function(){
|
187 |
jQuery(".<?php echo $this->plugin_slug ?>-review-box-popup").hide();
|
188 |
});
|
|
|
|
|
|
|
|
|
189 |
jQuery(document).on("click",".<?php echo $this->plugin_slug ?>-premio-review-box-hide-btn",function(){
|
190 |
-
jQuery("
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
191 |
});
|
192 |
jQuery(document).on("click", ".<?php echo $this->plugin_slug ?>-review-box-options a", function(){
|
193 |
var dataDays = jQuery(this).attr("data-days");
|
152 |
vertical-align: middle;
|
153 |
border-radius: 15px;
|
154 |
}
|
155 |
+
.review-thanks-img img {
|
156 |
+
width: 100%;
|
157 |
+
height: auto;
|
158 |
+
max-width: 200px;
|
159 |
+
}
|
160 |
+
.review-thanks-msg {
|
161 |
+
padding: 5px 0 0 10px;
|
162 |
+
display: inline-block;
|
163 |
+
text-align: left;
|
164 |
+
}
|
165 |
+
.review-thanks-box {
|
166 |
+
padding: 10px 0 10px 0;
|
167 |
+
position: relative;
|
168 |
+
text-align: center;
|
169 |
+
display: none;
|
170 |
+
}
|
171 |
+
.review-box-default {
|
172 |
+
}
|
173 |
+
.review-thanks-btn {
|
174 |
+
border: 0;
|
175 |
+
background: transparent;
|
176 |
+
position: absolute;
|
177 |
+
right: -30px;
|
178 |
+
top: 5px;
|
179 |
+
}
|
180 |
+
.review-thanks-img {
|
181 |
+
display: inline-block;
|
182 |
+
vertical-align: top;
|
183 |
+
width: 200px;
|
184 |
+
}
|
185 |
+
.thanks-msg-title {
|
186 |
+
font-weight: bold;
|
187 |
+
font-size: 18px;
|
188 |
+
}
|
189 |
+
.thanks-msg-desc {
|
190 |
+
padding: 24px 0;
|
191 |
+
}
|
192 |
+
.thanks-msg-footer {
|
193 |
+
font-weight: bold;
|
194 |
+
}
|
195 |
</style>
|
196 |
<div class="notice notice-info premio-notice <?php echo $this->plugin_slug ?>-premio-review-box <?php echo $this->plugin_slug ?>-premio-review-box">
|
197 |
+
<div class="review-box-default" id="default-review-box-<?php echo $this->plugin_slug ?>">
|
198 |
+
<p>
|
199 |
+
Hi there, it seems like <b><?php echo $this->plugin_name ?></b> is bringing you some value, and that's pretty awesome! Can you please show us some love and rate <?php echo $this->plugin_name ?> on WordPress? It'll only take 2 minutes of your time, and will really help us spread the word
|
200 |
+
- <b>Gal Dubinski</b>, Co-founder <img width="30px" src="<?php echo esc_url(plugin_dir_url(__FILE__)."../assets/images/premio-owner.png") ?>" />
|
201 |
+
<a href="javascript:;" class="dismiss-btn <?php echo $this->plugin_slug ?>-premio-review-dismiss-btn"><span class="dashicons dashicons-no-alt"></span></a>
|
202 |
+
</p>
|
203 |
+
<div class="clear clearfix"></div>
|
204 |
+
<ul>
|
205 |
+
<li><a class="<?php echo $this->plugin_slug ?>-premio-review-box-hide-btn" href="https://wordpress.org/support/plugin/folders/reviews/?filter=5" target="_blank">I'd love to help :)</a></li>
|
206 |
+
<li><a class="<?php echo $this->plugin_slug ?>-premio-review-box-future-btn" href="javascript:;">Not this time</a></li>
|
207 |
+
<li><a class="<?php echo $this->plugin_slug ?>-premio-review-box-hide-btn" href="javascript:;">I've already rated you</a></li>
|
208 |
+
</ul>
|
209 |
+
</div>
|
210 |
+
<div class="review-thanks-box" id="review-thanks-<?php echo $this->plugin_slug ?>">
|
211 |
+
<button class="<?php echo $this->plugin_slug ?>-close-thanks-btn review-thanks-btn"><span class="dashicons dashicons-no-alt"></span></button>
|
212 |
+
|
213 |
+
<div class="review-thanks-img">
|
214 |
+
<img width="30px" src="<?php echo esc_url(plugin_dir_url(__FILE__)."../assets/images/thanks.gif") ?>" />
|
215 |
+
</div>
|
216 |
+
<div class="review-thanks-msg">
|
217 |
+
<div class="thanks-msg-title">You are awesome 🙏</div>
|
218 |
+
<div class="thanks-msg-desc">Thanks for your support, We really appreciate it!</div>
|
219 |
+
<div class="thanks-msg-footer">Premio team</div>
|
220 |
+
</div>
|
221 |
+
<div class="clear clearfix"></div>
|
222 |
+
</div>
|
223 |
</div>
|
224 |
<div class="<?php echo $this->plugin_slug ?>-review-box-popup">
|
225 |
<div class="<?php echo $this->plugin_slug ?>-review-box-popup-content">
|
241 |
jQuery(document).on("click", ".<?php echo $this->plugin_slug ?>-close-review-box-popup", function(){
|
242 |
jQuery(".<?php echo $this->plugin_slug ?>-review-box-popup").hide();
|
243 |
});
|
244 |
+
jQuery(document).on("click", ".<?php echo $this->plugin_slug ?>-close-thanks-btn", function(){
|
245 |
+
jQuery(".<?php echo $this->plugin_slug ?>-review-box-popup").remove();
|
246 |
+
jQuery(".<?php echo $this->plugin_slug ?>-premio-review-box").remove();
|
247 |
+
});
|
248 |
jQuery(document).on("click",".<?php echo $this->plugin_slug ?>-premio-review-box-hide-btn",function(){
|
249 |
+
jQuery("#default-review-box-<?php echo $this->plugin_slug ?>").hide();
|
250 |
+
jQuery("#review-thanks-<?php echo $this->plugin_slug ?>").show();
|
251 |
+
jQuery.ajax({
|
252 |
+
url: "<?php echo admin_url("admin-ajax.php") ?>",
|
253 |
+
data: "action=<?php echo esc_attr($this->plugin_slug) ?>_review_box&days=-1&nonce=<?php echo esc_attr(wp_create_nonce($this->plugin_slug."_review_box")) ?>",
|
254 |
+
type: "post",
|
255 |
+
success: function() {
|
256 |
+
|
257 |
+
}
|
258 |
+
});
|
259 |
});
|
260 |
jQuery(document).on("click", ".<?php echo $this->plugin_slug ?>-review-box-options a", function(){
|
261 |
var dataDays = jQuery(this).attr("data-days");
|
includes/folders.class.php
CHANGED
@@ -99,22 +99,29 @@ class WCP_Folders
|
|
99 |
if (in_array("post", $options)) {
|
100 |
add_filter('manage_posts_columns', array($this, 'wcp_manage_columns_head'));
|
101 |
add_action('manage_posts_custom_column', array($this, 'wcp_manage_columns_content'), 10, 2);
|
|
|
|
|
102 |
}
|
103 |
|
104 |
if (in_array("page", $options)) {
|
105 |
add_filter('manage_page_posts_columns', array($this, 'wcp_manage_columns_head'));
|
106 |
add_action('manage_page_posts_custom_column', array($this, 'wcp_manage_columns_content'), 10, 2);
|
|
|
|
|
107 |
}
|
108 |
|
109 |
if (in_array("attachment", $options)) {
|
110 |
add_filter('manage_media_columns', array($this, 'wcp_manage_columns_head'));
|
111 |
add_action('manage_media_custom_column', array($this, 'wcp_manage_columns_content'), 10, 2);
|
|
|
|
|
112 |
}
|
113 |
|
114 |
foreach ($options as $option) {
|
115 |
if ($option != "post" && $option != "page" && $option != "attachment") {
|
116 |
add_filter('manage_edit-'.$option.'_columns', array($this, 'wcp_manage_columns_head'), 99999);
|
117 |
add_action('manage_'.$option.'_posts_custom_column', array($this, 'wcp_manage_columns_content'), 2, 2);
|
|
|
118 |
}
|
119 |
}
|
120 |
|
@@ -122,6 +129,34 @@ class WCP_Folders
|
|
122 |
|
123 |
/* load language files */
|
124 |
add_action( 'plugins_loaded', array( $this, 'folders_text' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
}
|
126 |
|
127 |
public function folders_text() {
|
@@ -133,7 +168,7 @@ class WCP_Folders
|
|
133 |
$customize_folders = get_option('customize_folders');
|
134 |
if(isset($customize_folders['dropdown_color']) && !empty($customize_folders['dropdown_color'])) {
|
135 |
?>
|
136 |
-
#media-attachment-taxonomy-filter, .post-upload-ui .folder_for_media { border-color: <?php echo esc_attr($customize_folders['dropdown_color']) ?>; color: <?php echo esc_attr($customize_folders['dropdown_color']) ?> }
|
137 |
.folder_for_media option {color:#000000;}
|
138 |
.folder_for_media option:first-child {
|
139 |
font-weight: bold;
|
@@ -527,25 +562,43 @@ class WCP_Folders
|
|
527 |
|
528 |
public function get_total_empty_posts($post_type = "")
|
529 |
{
|
|
|
|
|
|
|
|
|
|
|
530 |
$taxonomy = self::get_custom_post_type($post_type);
|
531 |
-
|
532 |
-
'posts_per_page' => -1,
|
533 |
-
'post_type' => $post_type,
|
534 |
-
'post_status' => 'inherit'
|
535 |
-
);
|
536 |
if ($post_type != "attachment") {
|
537 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
538 |
}
|
539 |
-
$args['tax_query'] = array(
|
540 |
-
array(
|
541 |
-
'taxonomy' => $taxonomy,
|
542 |
-
'operator' => 'NOT EXISTS',
|
543 |
-
),
|
544 |
-
);
|
545 |
-
$result = get_posts($args);
|
546 |
|
547 |
-
|
548 |
-
|
|
|
|
|
|
|
|
|
549 |
} else {
|
550 |
return 0;
|
551 |
}
|
99 |
if (in_array("post", $options)) {
|
100 |
add_filter('manage_posts_columns', array($this, 'wcp_manage_columns_head'));
|
101 |
add_action('manage_posts_custom_column', array($this, 'wcp_manage_columns_content'), 10, 2);
|
102 |
+
|
103 |
+
add_filter( 'bulk_actions-edit-post', array($this, 'custom_bulk_action' ));
|
104 |
}
|
105 |
|
106 |
if (in_array("page", $options)) {
|
107 |
add_filter('manage_page_posts_columns', array($this, 'wcp_manage_columns_head'));
|
108 |
add_action('manage_page_posts_custom_column', array($this, 'wcp_manage_columns_content'), 10, 2);
|
109 |
+
|
110 |
+
add_filter( 'bulk_actions-edit-page', array($this, 'custom_bulk_action' ));
|
111 |
}
|
112 |
|
113 |
if (in_array("attachment", $options)) {
|
114 |
add_filter('manage_media_columns', array($this, 'wcp_manage_columns_head'));
|
115 |
add_action('manage_media_custom_column', array($this, 'wcp_manage_columns_content'), 10, 2);
|
116 |
+
|
117 |
+
add_filter( 'bulk_actions-edit-media', array($this, 'custom_bulk_action' ));
|
118 |
}
|
119 |
|
120 |
foreach ($options as $option) {
|
121 |
if ($option != "post" && $option != "page" && $option != "attachment") {
|
122 |
add_filter('manage_edit-'.$option.'_columns', array($this, 'wcp_manage_columns_head'), 99999);
|
123 |
add_action('manage_'.$option.'_posts_custom_column', array($this, 'wcp_manage_columns_content'), 2, 2);
|
124 |
+
add_filter( 'bulk_actions-edit-'.$option, array($this, 'custom_bulk_action' ));
|
125 |
}
|
126 |
}
|
127 |
|
129 |
|
130 |
/* load language files */
|
131 |
add_action( 'plugins_loaded', array( $this, 'folders_text' ) );
|
132 |
+
|
133 |
+
add_filter('get_terms', array( $this, 'get_terms_filter_without_trash'), 10, 3);
|
134 |
+
}
|
135 |
+
|
136 |
+
public function get_terms_filter_without_trash($terms, $taxonomies, $args) {
|
137 |
+
global $wpdb;
|
138 |
+
if ( ! is_array($terms) && count($terms) < 1 ) {
|
139 |
+
return $terms;
|
140 |
+
}
|
141 |
+
|
142 |
+
$post_table = $wpdb->prefix."posts";
|
143 |
+
$term_table = $wpdb->prefix."term_relationships";
|
144 |
+
foreach ( $terms as $key=>$term ) {
|
145 |
+
if(isset($term->term_id)) {
|
146 |
+
$result = $wpdb->get_var("SELECT COUNT(*) FROM {$post_table} p JOIN {$term_table} rl ON p.ID = rl.object_id WHERE rl.term_taxonomy_id = '{$term->term_id}' AND p.post_status != 'trash' LIMIT 1");
|
147 |
+
if (intval($result) > 0) {
|
148 |
+
$terms[$key]->trash_count = intval($result);
|
149 |
+
} else {
|
150 |
+
$terms[$key]->trash_count = 0;
|
151 |
+
}
|
152 |
+
}
|
153 |
+
}
|
154 |
+
return $terms;
|
155 |
+
}
|
156 |
+
|
157 |
+
public function custom_bulk_action($bulk_actions) {
|
158 |
+
$bulk_actions['move_to_folder'] = __( 'Move to Folder', 'email_to_eric');
|
159 |
+
return $bulk_actions;
|
160 |
}
|
161 |
|
162 |
public function folders_text() {
|
168 |
$customize_folders = get_option('customize_folders');
|
169 |
if(isset($customize_folders['dropdown_color']) && !empty($customize_folders['dropdown_color'])) {
|
170 |
?>
|
171 |
+
#media-attachment-taxonomy-filter, .post-upload-ui .folder_for_media, select.media-select-folder { border-color: <?php echo esc_attr($customize_folders['dropdown_color']) ?>; color: <?php echo esc_attr($customize_folders['dropdown_color']) ?> }
|
172 |
.folder_for_media option {color:#000000;}
|
173 |
.folder_for_media option:first-child {
|
174 |
font-weight: bold;
|
562 |
|
563 |
public function get_total_empty_posts($post_type = "")
|
564 |
{
|
565 |
+
global $wpdb;
|
566 |
+
|
567 |
+
$post_table = $wpdb->prefix."posts";
|
568 |
+
$term_table = $wpdb->prefix."term_relationships";
|
569 |
+
$term_taxonomy_table = $wpdb->prefix."term_taxonomy";
|
570 |
$taxonomy = self::get_custom_post_type($post_type);
|
571 |
+
|
|
|
|
|
|
|
|
|
572 |
if ($post_type != "attachment") {
|
573 |
+
$query = "SELECT COUNT(DISTINCT({$post_table}.ID)) AS total_records FROM {$post_table} WHERE 1=1 AND (
|
574 |
+
NOT EXISTS (
|
575 |
+
SELECT 1
|
576 |
+
FROM {$term_table}
|
577 |
+
INNER JOIN {$term_taxonomy_table}
|
578 |
+
ON {$term_taxonomy_table}.term_taxonomy_id = {$term_table}.term_taxonomy_id
|
579 |
+
WHERE {$term_taxonomy_table}.taxonomy = '%s'
|
580 |
+
AND {$term_table}.object_id = {$post_table}.ID
|
581 |
+
)
|
582 |
+
) AND {$post_table}.post_type = '%s' AND (({$post_table}.post_status = 'publish' OR {$post_table}.post_status = 'future' OR {$post_table}.post_status = 'draft' OR {$post_table}.post_status = 'private'))";
|
583 |
+
} else {
|
584 |
+
$query = "SELECT COUNT(DISTINCT({$post_table}.ID)) AS total_records FROM {$post_table} WHERE 1=1 AND (
|
585 |
+
NOT EXISTS (
|
586 |
+
SELECT 1
|
587 |
+
FROM {$term_table}
|
588 |
+
INNER JOIN {$term_taxonomy_table}
|
589 |
+
ON {$term_taxonomy_table}.term_taxonomy_id = {$term_table}.term_taxonomy_id
|
590 |
+
WHERE {$term_taxonomy_table}.taxonomy = '%s'
|
591 |
+
AND {$term_table}.object_id = {$post_table}.ID
|
592 |
+
)
|
593 |
+
) AND {$post_table}.post_type = '%s' AND {$post_table}.post_status = 'inherit'";
|
594 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
595 |
|
596 |
+
$query = $wpdb->prepare($query, $taxonomy, $post_type);
|
597 |
+
|
598 |
+
$total_records = $wpdb->get_var($query);
|
599 |
+
|
600 |
+
if(!empty($total_records)) {
|
601 |
+
return $total_records;
|
602 |
} else {
|
603 |
return 0;
|
604 |
}
|
includes/tree.class.php
CHANGED
@@ -1,8 +1,9 @@
|
|
1 |
<?php
|
2 |
defined('ABSPATH') or die('Nope, not accessing this');
|
3 |
class WCP_Tree {
|
|
|
4 |
public function __construct() {
|
5 |
-
|
6 |
}
|
7 |
|
8 |
public static function get_full_tree_data($post_type) {
|
@@ -62,7 +63,7 @@ class WCP_Tree {
|
|
62 |
}
|
63 |
$status = get_term_meta($term->term_id, "is_highlighted", true);
|
64 |
$class .= ($status == 1)?" is-high":"";
|
65 |
-
$count = ($term->
|
66 |
$delete_nonce = wp_create_nonce('wcp_folder_delete_term_'.$term->term_id);
|
67 |
$rename_nonce = wp_create_nonce('wcp_folder_rename_term_'.$term->term_id);
|
68 |
$highlight_nonce = wp_create_nonce('wcp_folder_highlight_term_'.$term->term_id);
|
1 |
<?php
|
2 |
defined('ABSPATH') or die('Nope, not accessing this');
|
3 |
class WCP_Tree {
|
4 |
+
|
5 |
public function __construct() {
|
6 |
+
|
7 |
}
|
8 |
|
9 |
public static function get_full_tree_data($post_type) {
|
63 |
}
|
64 |
$status = get_term_meta($term->term_id, "is_highlighted", true);
|
65 |
$class .= ($status == 1)?" is-high":"";
|
66 |
+
$count = ($term->trash_count != 0)?"<span class='total-count'>{$term->trash_count}</span>":"";
|
67 |
$delete_nonce = wp_create_nonce('wcp_folder_delete_term_'.$term->term_id);
|
68 |
$rename_nonce = wp_create_nonce('wcp_folder_rename_term_'.$term->term_id);
|
69 |
$highlight_nonce = wp_create_nonce('wcp_folder_highlight_term_'.$term->term_id);
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: galdub, tomeraharon, premio
|
|
3 |
Tags: folder, folders, organize, pages folders, media library, posts folders, media folders, subfolders, file manager, directories
|
4 |
Requires at least: 3.0.0
|
5 |
Tested up to: 5.3
|
6 |
-
Stable tag: 2.
|
7 |
Plugin URI: https://premio.io/downloads/folders/
|
8 |
|
9 |
Folders is a WordPress plugin that will help you quickly organize and manage all of your Pages, Posts and Media library files in folders.
|
@@ -57,6 +57,7 @@ Digital Agencies: You're creating all sorts of content for your clients daily -
|
|
57 |
* Create new folders
|
58 |
* Create and organize subfolders
|
59 |
* Drag and drop pages, posts, and media library
|
|
|
60 |
* Select specific folders when you add media to your pages, posts or any other post type
|
61 |
* Drag and drop folders, change order, and hierarchy
|
62 |
* Upload directly to a media library folder - you can easily upload images or any other kind of files to a specific folder
|
@@ -141,6 +142,9 @@ A live demo for the Folders plugin is available at <a href="https://demo.premio.
|
|
141 |
|
142 |
== Changelog ==
|
143 |
|
|
|
|
|
|
|
144 |
= 2.3.9 =
|
145 |
Fixed long folders names bug
|
146 |
|
3 |
Tags: folder, folders, organize, pages folders, media library, posts folders, media folders, subfolders, file manager, directories
|
4 |
Requires at least: 3.0.0
|
5 |
Tested up to: 5.3
|
6 |
+
Stable tag: 2.4
|
7 |
Plugin URI: https://premio.io/downloads/folders/
|
8 |
|
9 |
Folders is a WordPress plugin that will help you quickly organize and manage all of your Pages, Posts and Media library files in folders.
|
57 |
* Create new folders
|
58 |
* Create and organize subfolders
|
59 |
* Drag and drop pages, posts, and media library
|
60 |
+
* You can also move media library files, pages, posts, or any custom post to folders without using our drag and drop feature. Whenever you select any element or select some elements in bulk, you can move it to a folder using our dropdown menu
|
61 |
* Select specific folders when you add media to your pages, posts or any other post type
|
62 |
* Drag and drop folders, change order, and hierarchy
|
63 |
* Upload directly to a media library folder - you can easily upload images or any other kind of files to a specific folder
|
142 |
|
143 |
== Changelog ==
|
144 |
|
145 |
+
= 2.4 =
|
146 |
+
Move elements (media library, posts, pages, custom posts) to folders by selecting the element and selecting the relevant folder from our dropdown. Also added some UI improvements :)
|
147 |
+
|
148 |
= 2.3.9 =
|
149 |
Fixed long folders names bug
|
150 |
|
templates/admin/admin-content.php
CHANGED
@@ -45,7 +45,7 @@ defined('ABSPATH') or wp_die('Nope, not accessing this');
|
|
45 |
}
|
46 |
if(isset($customize_folders['dropdown_color']) && !empty($customize_folders['dropdown_color'])) {
|
47 |
?>
|
48 |
-
#media-attachment-taxonomy-filter { border-color: <?php echo esc_attr($customize_folders['dropdown_color']) ?>; color: <?php echo esc_attr($customize_folders['dropdown_color']) ?> }
|
49 |
<?php
|
50 |
}
|
51 |
if(isset($customize_folders['folder_bg_color']) && !empty($customize_folders['folder_bg_color'])) {
|
@@ -219,4 +219,23 @@ if(!empty($post_type)) {
|
|
219 |
<a href="javascript:;" class="form-cancel-btn">Close</a>
|
220 |
</div>
|
221 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
222 |
</div>
|
45 |
}
|
46 |
if(isset($customize_folders['dropdown_color']) && !empty($customize_folders['dropdown_color'])) {
|
47 |
?>
|
48 |
+
#media-attachment-taxonomy-filter, select.media-select-folder { border-color: <?php echo esc_attr($customize_folders['dropdown_color']) ?>; color: <?php echo esc_attr($customize_folders['dropdown_color']) ?> }
|
49 |
<?php
|
50 |
}
|
51 |
if(isset($customize_folders['folder_bg_color']) && !empty($customize_folders['folder_bg_color'])) {
|
219 |
<a href="javascript:;" class="form-cancel-btn">Close</a>
|
220 |
</div>
|
221 |
</div>
|
222 |
+
</div>
|
223 |
+
|
224 |
+
<div class="folder-popup-form" id="bulk-move-folder">
|
225 |
+
<form action="" method="post" id="bulk-folder-form">
|
226 |
+
<div class="popup-form-content">
|
227 |
+
<div class="popup-folder-title">
|
228 |
+
Select Folder
|
229 |
+
</div>
|
230 |
+
<div class="select-box">
|
231 |
+
<select id="bulk-select">
|
232 |
+
<option value="">Select Folder</option>
|
233 |
+
</select>
|
234 |
+
</div>
|
235 |
+
<div class="folder-form-buttons">
|
236 |
+
<a href="javascript:;" class="form-cancel-btn">Cancel</a>
|
237 |
+
<button type="submit" class="form-submit-btn" id="move-to-folder" style="width: 200px">Move to Folder</button>
|
238 |
+
</div>
|
239 |
+
</div>
|
240 |
+
</form>
|
241 |
</div>
|