Folders – Unlimited Folders to Organize Media Library Folder, Pages, Posts, File Manager - Version 2.1.6

Version Description

  • Now you can drag and drop single media library files without clicking on the "Organize" button. We've also fixed a WooCommerce products page bug, Safari issue and some other media library issues
Download this release

Release Info

Developer galdub
Plugin Icon wp plugin Folders – Unlimited Folders to Organize Media Library Folder, Pages, Posts, File Manager
Version 2.1.6
Comparing to
See all releases

Code changes from version 2.1.5 to 2.1.6

assets/css/design.css CHANGED
@@ -599,6 +599,7 @@ span.wcp-item {
599
  display: inline-block;
600
  font-size: 16px;
601
  line-height: 30px;
 
602
  }
603
  .ui-resizable-handle.ui-resizable-e {
604
  position: absolute;
599
  display: inline-block;
600
  font-size: 16px;
601
  line-height: 30px;
602
+ height: 30px;
603
  }
604
  .ui-resizable-handle.ui-resizable-e {
605
  position: absolute;
assets/css/media.css CHANGED
@@ -4,7 +4,7 @@
4
  }
5
  .media-modal-content .media-frame select.attachment-filters {
6
  width: auto;
7
- max-width: 150px;
8
  }
9
  #media-attachment-taxonomy-filter {
10
  border: solid 1px #FF5983;
4
  }
5
  .media-modal-content .media-frame select.attachment-filters {
6
  width: auto;
7
+ width: 120px !important;
8
  }
9
  #media-attachment-taxonomy-filter {
10
  border: solid 1px #FF5983;
assets/js/custom.js CHANGED
@@ -38,6 +38,58 @@ function addFolder() {
38
  }
39
  folderOrder = jQuery("#space_"+fileFolderID+" > li").length+1;
40
  ajaxURL = wcp_settings.ajax_url+"?parent_id=" + fileFolderID + "&type=" + wcp_settings.post_type + "&action=wcp_add_new_folder&nonce=" + wcp_settings.nonce + "&term_id=" + fileFolderID + "&order=" + folderOrder+"&name=";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  Swal({
42
  title: 'Add Folder',
43
  input: 'text',
@@ -50,44 +102,53 @@ function addFolder() {
50
  showLoaderOnConfirm: true,
51
  reverseButtons: true,
52
  preConfirm: (folderName) => {
53
- if(folderName == "") {
54
- swal.showValidationError(
55
- 'Please enter folder name'
56
- )
57
- return false;
58
- }
59
- return fetch(ajaxURL+folderName)
60
- .then(response => {
61
- if (!response.ok) {
62
- throw new Error(response.statusText);
63
- }
64
- return response.json();
65
- }).catch(error => {
66
- Swal.showValidationMessage(
67
- "Request failed: "+error
68
  )
69
- });
70
- },
71
- allowOutsideClick: () => !Swal.isLoading()
 
 
72
  }).then((result) => {
73
- if(result.value.error == 1) {
 
74
  Swal({
75
- type: 'error',
76
- title: 'Oops...',
77
- text: result.value.message
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  });
79
- } else if(result.value.status == 1) {
80
- jQuery("#space_"+result.value.parent_id).append(result.value.term_data);
81
- jQuery("#wcp_folder_"+result.value.parent_id).addClass("active has-sub-tree");
82
- isKeyActive = parseInt(result.value.is_key_active);
83
- totalFolders = parseInt(result.value.folders);
84
- jQuery("#current-folder").text(totalFolders);
85
- if(totalFolders > folderLimitation) {
86
- folderLimitation = totalFolders;
87
- }
88
- jQuery("#total-folder").text(folderLimitation);
89
- checkForExpandCollapse();
90
- add_menu_to_list();
91
  }
92
  });
93
  }
@@ -99,8 +160,8 @@ function updateFolder() {
99
  if(parentID == undefined) {
100
  parentID = 0;
101
  }
102
- nonce = jQuery.trim(jQuery("#wcp_folder_"+fileFolderID).data("rename"));
103
- ajaxURL = wcp_settings.ajax_url+"?parent_id=" + parentID + "&nonce=" + nonce + "&type=" + wcp_settings.post_type + "&action=wcp_update_folder&term_id=" + fileFolderID + "&name=";
104
  Swal({
105
  title: 'Update Folder',
106
  input: 'text',
@@ -115,38 +176,99 @@ function updateFolder() {
115
  showLoaderOnConfirm: true,
116
  reverseButtons: true,
117
  preConfirm: (folderName) => {
118
- if(folderName == "") {
119
- swal.showValidationError(
120
- 'Please enter folder name'
121
- )
122
- return false;
123
- }
124
- return fetch(ajaxURL+folderName)
125
- .then(response => {
126
- if (!response.ok) {
127
- throw new Error(response.statusText);
128
- }
129
- return response.json();
130
- }).catch(error => {
131
- Swal.showValidationMessage(
132
- "Request failed: "+error
133
- )
134
- });
135
- },
136
- allowOutsideClick: () => !Swal.isLoading()
137
- }).then((result) => {
138
- if(result.value.error == 1) {
139
  Swal({
140
- type: 'error',
141
- title: 'Oops...',
142
- text: result.value.message
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
143
  });
144
- } else if(result.value.status == 1) {
145
- jQuery("#wcp_folder_"+result.value.id+" > h3 > .title-text").text(result.value.term_title);
146
- jQuery("#wcp_folder_"+result.value.id+" > h3").attr("title",result.value.term_title);
147
- add_menu_to_list();
148
  }
149
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150
  }
151
 
152
  function add_menu_to_list() {
@@ -304,15 +426,15 @@ jQuery(document).ready(function(){
304
  jQuery("body").removeClass("no-hover-css");
305
  }
306
  });
307
- jQuery(this).draggable("disable");
308
  });
309
 
310
  jQuery(".media-button").livequery(function () {
311
  jQuery(this).click(function () {
312
  if (jQuery(".delete-selected-button").hasClass("hidden")) {
313
- jQuery(".attachments-browser li.attachment").draggable("disable");
314
  } else {
315
- jQuery(".attachments-browser li.attachment").draggable("enable");
316
  }
317
  });
318
  });
@@ -561,7 +683,6 @@ jQuery(document).ready(function(){
561
 
562
  jQuery(".wcp-move-file").livequery(function(){
563
  jQuery(this).draggable({
564
- /*cancel: "a.ui-icon",*/
565
  revert: "invalid",
566
  containment: "document",
567
  helper: "clone",
@@ -1060,7 +1181,7 @@ function calcWidth(obj){
1060
 
1061
  if(wcp_settings.post_type == "attachment") {
1062
  jQuery(window).load(function() {
1063
- jQuery("button.button.media-button.select-mode-toggle-button").after("<button class='button organize-button'>Organize</button>");
1064
  jQuery(".media-toolbar-secondary").append("<span class='media-info-message'>Drag and drop your media files to the relevant folders</span>");
1065
  if(jQuery(".wcp-custom-form").length) {
1066
  if (wp.Uploader !== undefined) {
38
  }
39
  folderOrder = jQuery("#space_"+fileFolderID+" > li").length+1;
40
  ajaxURL = wcp_settings.ajax_url+"?parent_id=" + fileFolderID + "&type=" + wcp_settings.post_type + "&action=wcp_add_new_folder&nonce=" + wcp_settings.nonce + "&term_id=" + fileFolderID + "&order=" + folderOrder+"&name=";
41
+ // Swal.fire({
42
+ // url: wcp_settings.ajax_url,
43
+ // input: 'text',
44
+ // inputAttributes: {
45
+ // autocapitalize: 'off',
46
+ // placeholder: "Folder name"
47
+ // },
48
+ // showCancelButton: true,
49
+ // confirmButtonText: 'Submit',
50
+ // showLoaderOnConfirm: true,
51
+ // reverseButtons: true,
52
+ // }).then((result) => {
53
+ // if (result.value) {
54
+ // Swal({
55
+ // title: 'Please wait..',
56
+ // imageUrl: wcp_settings.ajax_image,
57
+ // imageAlt: 'The uploaded picture',
58
+ // showConfirmButton: false
59
+ // });
60
+ // // jQuery.ajax({
61
+ // // url: wcp_settings.ajax_url,
62
+ // // data: "type=" + wcp_settings.post_type + "&action=wcp_remove_folder&term_id=" + fileFolderID+"&nonce="+nonce,
63
+ // // method: 'post',
64
+ // // success: function (res) {
65
+ // // res = jQuery.parseJSON(res);
66
+ // // if (res.status == '1') {
67
+ // // Swal.fire(
68
+ // // 'Deleted!',
69
+ // // 'Your folder has been deleted.',
70
+ // // 'success'
71
+ // // );
72
+ // // jQuery("#wcp_folder_"+fileFolderID).remove();
73
+ // // jQuery("#folder_"+fileFolderID).remove();
74
+ // // isKeyActive = parseInt(res.is_key_active);
75
+ // // totalFolders = parseInt(res.folders);
76
+ // // jQuery("#current-folder").text(totalFolders);
77
+ // // if(totalFolders > folderLimitation) {
78
+ // // folderLimitation = totalFolders;
79
+ // // }
80
+ // // jQuery("#total-folder").text(folderLimitation);
81
+ // // add_menu_to_list();
82
+ // // } else {
83
+ // // Swal.fire(
84
+ // // '',
85
+ // // res.message,
86
+ // // 'error'
87
+ // // );
88
+ // // }
89
+ // // }
90
+ // // });
91
+ // }
92
+ // });
93
  Swal({
94
  title: 'Add Folder',
95
  input: 'text',
102
  showLoaderOnConfirm: true,
103
  reverseButtons: true,
104
  preConfirm: (folderName) => {
105
+ if(folderName == "")
106
+ {
107
+ swal.showValidationError(
108
+ 'Please enter folder name'
 
 
 
 
 
 
 
 
 
 
 
109
  )
110
+ return false;
111
+ } else {
112
+ folderNameDynamic = folderName;
113
+ }
114
+ }
115
  }).then((result) => {
116
+ if(typeof(result.value) != "undefined")
117
+ {
118
  Swal({
119
+ title: 'Please wait..',
120
+ imageUrl: wcp_settings.ajax_image,
121
+ imageAlt: 'The uploaded picture',
122
+ showConfirmButton: false
123
+ });
124
+ jQuery.ajax({
125
+ url: wcp_settings.ajax_url,
126
+ data: "parent_id=" + fileFolderID + "&type=" + wcp_settings.post_type + "&action=wcp_add_new_folder&nonce=" + wcp_settings.nonce + "&term_id=" + fileFolderID + "&order=" + folderOrder + "&name=" + folderNameDynamic,
127
+ method: 'post',
128
+ success: function (res) {
129
+ result = jQuery.parseJSON(res);
130
+ if (result.status == '1') {
131
+ jQuery("#space_" + result.parent_id).append(result.term_data);
132
+ jQuery("#wcp_folder_" + result.parent_id).addClass("active has-sub-tree");
133
+ isKeyActive = parseInt(result.is_key_active);
134
+ totalFolders = parseInt(result.folders);
135
+ jQuery("#current-folder").text(totalFolders);
136
+ if (totalFolders > folderLimitation) {
137
+ folderLimitation = totalFolders;
138
+ }
139
+ jQuery("#total-folder").text(folderLimitation);
140
+ checkForExpandCollapse();
141
+ add_menu_to_list();
142
+ Swal.close();
143
+ } else {
144
+ Swal.fire(
145
+ '',
146
+ result.message,
147
+ 'error'
148
+ );
149
+ }
150
+ }
151
  });
 
 
 
 
 
 
 
 
 
 
 
 
152
  }
153
  });
154
  }
160
  if(parentID == undefined) {
161
  parentID = 0;
162
  }
163
+ console.log("folderName");
164
+
165
  Swal({
166
  title: 'Update Folder',
167
  input: 'text',
176
  showLoaderOnConfirm: true,
177
  reverseButtons: true,
178
  preConfirm: (folderName) => {
179
+ if(folderName == "")
180
+ {
181
+ swal.showValidationError(
182
+ 'Please enter folder name'
183
+ )
184
+ return false;
185
+ } else {
186
+ folderNameDynamic = folderName;
187
+ }
188
+ }
189
+ }).then((result) => {
190
+ if(typeof(result.value) != "undefined" )
191
+ {
 
 
 
 
 
 
 
 
192
  Swal({
193
+ title: 'Please wait..',
194
+ imageUrl: wcp_settings.ajax_image,
195
+ imageAlt: 'The uploaded picture',
196
+ showConfirmButton: false
197
+ });
198
+ nonce = jQuery.trim(jQuery("#wcp_folder_" + fileFolderID).data("rename"));
199
+ parentID = jQuery("#wcp_folder_" + fileFolderID).closest("li.route").data("folder-id");
200
+ if (parentID == undefined) {
201
+ parentID = 0;
202
+ }
203
+ jQuery.ajax({
204
+ url: wcp_settings.ajax_url,
205
+ data: "parent_id=" + parentID + "&nonce=" + nonce + "&type=" + wcp_settings.post_type + "&action=wcp_update_folder&term_id=" + fileFolderID + "&name=" + folderNameDynamic,
206
+ method: 'post',
207
+ success: function (res) {
208
+ result = jQuery.parseJSON(res);
209
+ if (result.status == '1') {
210
+ jQuery("#wcp_folder_" + result.id + " > h3 > .title-text").text(result.term_title);
211
+ jQuery("#wcp_folder_" + result.id + " > h3").attr("title", result.term_title);
212
+ add_menu_to_list();
213
+ Swal.close();
214
+ } else {
215
+ Swal.fire(
216
+ '',
217
+ result.message,
218
+ 'error'
219
+ );
220
+ }
221
+ }
222
  });
 
 
 
 
223
  }
224
+ });
225
+
226
+ // Swal({
227
+ // title: 'Update Folder',
228
+ // input: 'text',
229
+ // inputValue: folderName,
230
+ // inputAttributes: {
231
+ // autocapitalize: 'off',
232
+ // placeholder: "Folder name",
233
+ // value: folderName
234
+ // },
235
+ // showCancelButton: true,
236
+ // confirmButtonText: 'Submit',
237
+ // showLoaderOnConfirm: true,
238
+ // reverseButtons: true,
239
+ // preConfirm: (folderName) => {
240
+ // if(folderName == "") {
241
+ // swal.showValidationError(
242
+ // 'Please enter folder name'
243
+ // )
244
+ // return false;
245
+ // }
246
+ // return fetch(ajaxURL+folderName)
247
+ // .then(response => {
248
+ // if (!response.ok) {
249
+ // throw new Error(response.statusText);
250
+ // }
251
+ // return response.json();
252
+ // }).catch(error => {
253
+ // Swal.showValidationMessage(
254
+ // "Request failed: "+error
255
+ // )
256
+ // });
257
+ // },
258
+ // allowOutsideClick: () => !Swal.isLoading()
259
+ // }).then((result) => {
260
+ // if(result.value.error == 1) {
261
+ // Swal({
262
+ // type: 'error',
263
+ // title: 'Oops...',
264
+ // text: result.value.message
265
+ // });
266
+ // } else if(result.value.status == 1) {
267
+ // jQuery("#wcp_folder_"+result.value.id+" > h3 > .title-text").text(result.value.term_title);
268
+ // jQuery("#wcp_folder_"+result.value.id+" > h3").attr("title",result.value.term_title);
269
+ // add_menu_to_list();
270
+ // }
271
+ // });
272
  }
273
 
274
  function add_menu_to_list() {
426
  jQuery("body").removeClass("no-hover-css");
427
  }
428
  });
429
+ // jQuery(this).draggable("disable");
430
  });
431
 
432
  jQuery(".media-button").livequery(function () {
433
  jQuery(this).click(function () {
434
  if (jQuery(".delete-selected-button").hasClass("hidden")) {
435
+ //jQuery(".attachments-browser li.attachment").draggable("disable");
436
  } else {
437
+ // jQuery(".attachments-browser li.attachment").draggable("enable");
438
  }
439
  });
440
  });
683
 
684
  jQuery(".wcp-move-file").livequery(function(){
685
  jQuery(this).draggable({
 
686
  revert: "invalid",
687
  containment: "document",
688
  helper: "clone",
1181
 
1182
  if(wcp_settings.post_type == "attachment") {
1183
  jQuery(window).load(function() {
1184
+ jQuery("button.button.media-button.select-mode-toggle-button").after("<button class='button organize-button'>Bulk Organize</button>");
1185
  jQuery(".media-toolbar-secondary").append("<span class='media-info-message'>Drag and drop your media files to the relevant folders</span>");
1186
  if(jQuery(".wcp-custom-form").length) {
1187
  if (wp.Uploader !== undefined) {
assets/js/media.js CHANGED
@@ -120,6 +120,16 @@ if (typeof wp !== 'undefined' && typeof wp.Uploader === 'function') {
120
  this.uploader.bind('UploadComplete', function (up, files) {
121
  selectedFolderMediaId = -1;
122
  });
 
 
 
 
 
 
 
 
 
 
123
  }
124
  }
125
  });
120
  this.uploader.bind('UploadComplete', function (up, files) {
121
  selectedFolderMediaId = -1;
122
  });
123
+ this.uploader.bind('UploadComplete', function (up, files) {
124
+ var wp_media = window.wp;
125
+
126
+ if( wp_media.media.frame.content.get() !== null) {
127
+ wp_media.media.frame.content.get().collection.props.set({ignore: (+ new Date())});
128
+ wp_media.media.frame.content.get().options.selection.reset();
129
+ } else {
130
+ wp_media.media.frame.library.props.set ({ignore: (+ new Date())});
131
+ }
132
+ });
133
  }
134
  }
135
  });
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.1.5
6
  * Author: Premio
7
  * Author URI: https://premio.io/downloads/folders/
8
  */
@@ -15,7 +15,7 @@ define('WCP_FOLDER', 'folders');
15
  define('WCP_FOLDER_VAR', 'folders_settings');
16
  define("WCP_DS", DIRECTORY_SEPARATOR);
17
  define('WCP_FOLDER_URL',plugin_dir_url(__FILE__));
18
- define('WCP_FOLDER_VERSION',"2.1.5");
19
 
20
  include_once plugin_dir_path(__FILE__)."includes/folders.class.php";
21
  register_activation_hook( __FILE__, array( 'WCP_Folders', 'activate' ) );
2
  /**
3
  * Plugin Name: Folders
4
  * Description: Arrange media, pages, custom post types and posts into folders
5
+ * Version: 2.1.6
6
  * Author: Premio
7
  * Author URI: https://premio.io/downloads/folders/
8
  */
15
  define('WCP_FOLDER_VAR', 'folders_settings');
16
  define("WCP_DS", DIRECTORY_SEPARATOR);
17
  define('WCP_FOLDER_URL',plugin_dir_url(__FILE__));
18
+ define('WCP_FOLDER_VERSION',"2.1.6");
19
 
20
  include_once plugin_dir_path(__FILE__)."includes/folders.class.php";
21
  register_activation_hook( __FILE__, array( 'WCP_Folders', 'activate' ) );
includes/folders.class.php CHANGED
@@ -1380,7 +1380,7 @@ class WCP_Folders
1380
  }
1381
  } else {
1382
  $response['error'] = 1;
1383
- $response['message'] = __("Folder name already exists", WCP_FOLDER);
1384
  }
1385
  } else {
1386
  $response['error'] = 1;
@@ -1977,8 +1977,8 @@ class WCP_Folders
1977
 
1978
  foreach ($options as $option) {
1979
  if ($option != "post" && $option != "page" && $option != "attachment") {
1980
- add_filter('manage_media_columns', array($this, 'wcp_manage_columns_head'));
1981
- add_action('manage_media_custom_column', array($this, 'wcp_manage_columns_content'), 10, 2);
1982
  }
1983
  }
1984
 
1380
  }
1381
  } else {
1382
  $response['error'] = 1;
1383
+ $response['message'] = __("Folder name is already exists", WCP_FOLDER);
1384
  }
1385
  } else {
1386
  $response['error'] = 1;
1977
 
1978
  foreach ($options as $option) {
1979
  if ($option != "post" && $option != "page" && $option != "attachment") {
1980
+ add_filter('manage_'.$option.'_posts_columns', array($this, 'wcp_manage_columns_head'), 99999);
1981
+ add_action('manage_media'.$option.'_posts_custom_column', array($this, 'wcp_manage_columns_content'), 10, 2, 99999);
1982
  }
1983
  }
1984
 
readme.txt CHANGED
@@ -3,10 +3,10 @@ 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.2
6
- Stable tag: 2.1.5
7
  Plugin URI: https://premio.io/downloads/folders/
8
 
9
- Folders is a FREE WordPress plugin that will help you quickly organize and manage all of your Pages, Posts and Media library files in folders.
10
 
11
  == Description ==
12
 
@@ -56,7 +56,7 @@ Digital Agencies: You're creating all sorts of content for your clients daily -
56
  * Drag and drop pages, posts, and media library
57
  * Select specific folders when you add media to your pages, posts or any other post type.
58
  * Drag and drop folders, change order, and hierarchy
59
- * Bulk select images and media files and drag them to any folder
60
  * Rename folders
61
  * Monitor all the unassigned media library files, posts, pages, and custom posts so you can organize them easily to your folders
62
  * Sticky toolbar for the media library so you can navigate and organize your folders with ease
@@ -127,6 +127,9 @@ A live demo for the Folders plugin is available at <a href="https://demo.premio.
127
 
128
  == Changelog ==
129
 
 
 
 
130
  = 2.1.5 =
131
  * You don't need to hit the "Organize" button each time you drag media files now, once you click on it you get into "Organize mode" until you click on the "Cancel" button + when you upload new media files you can select the folder in advance + fixed the hidden div thanks @nubess
132
 
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.2
6
+ Stable tag: 2.1.6
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.
10
 
11
  == Description ==
12
 
56
  * Drag and drop pages, posts, and media library
57
  * Select specific folders when you add media to your pages, posts or any other post type.
58
  * Drag and drop folders, change order, and hierarchy
59
+ * Bulk select images and media files and drag them to any folder. No worries, you can also drag and drop media library files one-by-one if you want :)
60
  * Rename folders
61
  * Monitor all the unassigned media library files, posts, pages, and custom posts so you can organize them easily to your folders
62
  * Sticky toolbar for the media library so you can navigate and organize your folders with ease
127
 
128
  == Changelog ==
129
 
130
+ = 2.1.6 =
131
+ * Now you can drag and drop single media library files without clicking on the "Organize" button. We've also fixed a WooCommerce products page bug, Safari issue and some other media library issues
132
+
133
  = 2.1.5 =
134
  * You don't need to hit the "Organize" button each time you drag media files now, once you click on it you get into "Organize mode" until you click on the "Cancel" button + when you upload new media files you can select the folder in advance + fixed the hidden div thanks @nubess
135