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

Version Description

  • Move one media file/post/page/custom post to more than one folder + quick edit bug fix :)
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.4
Comparing to
See all releases

Code changes from version 2.1.3 to 2.1.4

Files changed (4) hide show
  1. assets/js/custom.js +24 -22
  2. folders.php +1 -1
  3. includes/folders.class.php +50 -6
  4. readme.txt +18 -5
assets/js/custom.js CHANGED
@@ -223,11 +223,11 @@ jQuery(document).ready(function(){
223
  nonce = jQuery.trim(jQuery("#wcp_folder_" + folderID).data("nonce"));
224
  jQuery.ajax({
225
  url: wcp_settings.ajax_url,
226
- data: "post_ids=" + chkStr + "&type=" + wcp_settings.post_type + "&action=wcp_change_multiple_post_folder&folder_id=" + folderID + "&nonce=" + nonce,
227
  method: 'post',
228
  success: function (res) {
229
  res = jQuery.parseJSON(res);
230
- if (res.status == "1") {
231
  window.location.reload();
232
  } else {
233
  Swal.fire(
@@ -239,16 +239,16 @@ jQuery(document).ready(function(){
239
  }
240
  });
241
  }
242
- } else if (ui.draggable.hasClass('wcp-move-file')) {
243
  postID = ui.draggable[0].attributes['data-id'].nodeValue;
244
- nonce = jQuery.trim(jQuery("#wcp_folder_" + folderID).data("nonce"));
245
  jQuery.ajax({
246
  url: wcp_settings.ajax_url,
247
- data: "post_id=" + postID + "&type=" + wcp_settings.post_type + "&action=wcp_change_post_folder&folder_id=" + folderID + "&nonce=" + nonce,
248
  method: 'post',
249
  success: function (res) {
250
  res = jQuery.parseJSON(res);
251
- if (res.status == "1") {
252
  window.location.reload();
253
  } else {
254
  Swal.fire(
@@ -270,7 +270,7 @@ jQuery(document).ready(function(){
270
  }
271
  jQuery.ajax({
272
  url: wcp_settings.ajax_url,
273
- data: "post_ids=" + chkStr + "&type=" + wcp_settings.post_type + "&action=wcp_change_multiple_post_folder&folder_id=" + folderID + "&nonce=" + nonce,
274
  method: 'post',
275
  success: function (res) {
276
  window.location.reload();
@@ -342,7 +342,7 @@ jQuery(document).ready(function(){
342
  });
343
  jQuery.ajax({
344
  url: wcp_settings.ajax_url,
345
- data: "post_id=" + chkStr + "&type=" + wcp_settings.post_type + "&action=wcp_remove_post_folder&folder_id=" + folderID + "&nonce=" + nonce,
346
  method: 'post',
347
  success: function (res) {
348
  window.location.reload();
@@ -353,7 +353,7 @@ jQuery(document).ready(function(){
353
  postID = ui.draggable[0].attributes['data-id'].nodeValue;
354
  jQuery.ajax({
355
  url: wcp_settings.ajax_url,
356
- data: "post_id=" + postID + "&type=" + wcp_settings.post_type + "&action=wcp_remove_post_folder&folder_id=" + folderID + "&nonce=" + nonce,
357
  method: 'post',
358
  success: function (res) {
359
  window.location.reload();
@@ -369,7 +369,7 @@ jQuery(document).ready(function(){
369
  }
370
  jQuery.ajax({
371
  url: wcp_settings.ajax_url,
372
- data: "post_id=" + chkStr + "&type=" + wcp_settings.post_type + "&action=wcp_remove_post_folder&folder_id=" + folderID + "&nonce=" + nonce,
373
  method: 'post',
374
  success: function (res) {
375
  window.location.reload();
@@ -558,18 +558,20 @@ jQuery(document).ready(function(){
558
  }
559
  });
560
 
561
- jQuery(".wcp-move-file").draggable({
562
- /*cancel: "a.ui-icon",*/
563
- revert: "invalid",
564
- containment: "document",
565
- helper: "clone",
566
- cursor: "move",
567
- start: function( event, ui){
568
- jQuery(this).closest("td").addClass("wcp-draggable");
569
- },
570
- stop: function( event, ui ) {
571
- jQuery(this).closest("td").removeClass("wcp-draggable");
572
- }
 
 
573
  });
574
 
575
  jQuery(".wcp-move-multiple").draggable({
223
  nonce = jQuery.trim(jQuery("#wcp_folder_" + folderID).data("nonce"));
224
  jQuery.ajax({
225
  url: wcp_settings.ajax_url,
226
+ 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="+wcp_settings.selected_taxonomy,
227
  method: 'post',
228
  success: function (res) {
229
  res = jQuery.parseJSON(res);
230
+ if(res.status == "1") {
231
  window.location.reload();
232
  } else {
233
  Swal.fire(
239
  }
240
  });
241
  }
242
+ } else if( ui.draggable.hasClass( 'wcp-move-file' ) ){
243
  postID = ui.draggable[0].attributes['data-id'].nodeValue;
244
+ nonce = jQuery.trim(jQuery("#wcp_folder_"+folderID).data("nonce"));
245
  jQuery.ajax({
246
  url: wcp_settings.ajax_url,
247
+ data: "post_id=" + postID + "&type=" + wcp_settings.post_type + "&action=wcp_change_post_folder&folder_id=" + folderID+"&nonce="+nonce+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+wcp_settings.selected_taxonomy,
248
  method: 'post',
249
  success: function (res) {
250
  res = jQuery.parseJSON(res);
251
+ if(res.status == "1") {
252
  window.location.reload();
253
  } else {
254
  Swal.fire(
270
  }
271
  jQuery.ajax({
272
  url: wcp_settings.ajax_url,
273
+ 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="+wcp_settings.selected_taxonomy,
274
  method: 'post',
275
  success: function (res) {
276
  window.location.reload();
342
  });
343
  jQuery.ajax({
344
  url: wcp_settings.ajax_url,
345
+ 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="+wcp_settings.selected_taxonomy,
346
  method: 'post',
347
  success: function (res) {
348
  window.location.reload();
353
  postID = ui.draggable[0].attributes['data-id'].nodeValue;
354
  jQuery.ajax({
355
  url: wcp_settings.ajax_url,
356
+ data: "post_id=" + postID + "&type=" + wcp_settings.post_type + "&action=wcp_remove_post_folder&folder_id=" + folderID + "&nonce=" + nonce+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+wcp_settings.selected_taxonomy,
357
  method: 'post',
358
  success: function (res) {
359
  window.location.reload();
369
  }
370
  jQuery.ajax({
371
  url: wcp_settings.ajax_url,
372
+ 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="+wcp_settings.selected_taxonomy,
373
  method: 'post',
374
  success: function (res) {
375
  window.location.reload();
558
  }
559
  });
560
 
561
+ jQuery(".wcp-move-file").livequery(function(){
562
+ jQuery(this).draggable({
563
+ /*cancel: "a.ui-icon",*/
564
+ revert: "invalid",
565
+ containment: "document",
566
+ helper: "clone",
567
+ cursor: "move",
568
+ start: function( event, ui){
569
+ jQuery(this).closest("td").addClass("wcp-draggable");
570
+ },
571
+ stop: function( event, ui ) {
572
+ jQuery(this).closest("td").removeClass("wcp-draggable");
573
+ }
574
+ });
575
  });
576
 
577
  jQuery(".wcp-move-multiple").draggable({
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.3
6
  * Author: Premio
7
  * Author URI: https://premio.io/downloads/folders/
8
  */
2
  /**
3
  * Plugin Name: Folders
4
  * Description: Arrange media, pages, custom post types and posts into folders
5
+ * Version: 2.1.4
6
  * Author: Premio
7
  * Author URI: https://premio.io/downloads/folders/
8
  */
includes/folders.class.php CHANGED
@@ -765,10 +765,23 @@ class WCP_Folders
765
  $folderID = self::sanitize_options($postData['folder_id']);
766
  $type = self::sanitize_options($postData['type']);
767
  $postArray = explode(",", $postID);
 
 
 
 
 
 
 
 
 
 
768
  if (is_array($postArray)) {
769
  foreach ($postArray as $post) {
770
  $post_type = self::get_custom_post_type($type);
771
- wp_set_post_terms($post, $folderID, $post_type, false);
 
 
 
772
  }
773
  }
774
  $response['status'] = 1;
@@ -816,13 +829,24 @@ class WCP_Folders
816
  $folderID = self::sanitize_options($postData['folder_id']);
817
  $type = self::sanitize_options($postData['type']);
818
  $folder_post_type = self::get_custom_post_type($type);
 
 
 
 
 
 
 
 
 
819
  $terms = get_the_terms($postID, $folder_post_type);
820
  if (!empty($terms)) {
821
  foreach ($terms as $term) {
822
- wp_remove_object_terms($postID, $term->term_id, $folder_post_type);
 
 
823
  }
824
  }
825
- wp_set_post_terms($postID, $folderID, $folder_post_type);
826
  $response['status'] = 1;
827
  }
828
  echo json_encode($response);
@@ -1748,6 +1772,14 @@ class WCP_Folders
1748
  $can_manage_folder = current_user_can("manage_categories")?1:0;
1749
  $width = get_option("wcp_dynamic_width_for_" . $typenow);
1750
  $width = empty($width)||!is_numeric($width)?310:$width;
 
 
 
 
 
 
 
 
1751
  wp_localize_script('wcp-folders-custom', 'wcp_settings', array(
1752
  'ajax_url' => admin_url('admin-ajax.php'),
1753
  'post_type' => $typenow,
@@ -1759,7 +1791,9 @@ class WCP_Folders
1759
  'isRTL' => $is_rtl,
1760
  'nonce' => wp_create_nonce('wcp_folder_nonce_'.$typenow),
1761
  'can_manage_folder' => $can_manage_folder,
1762
- 'folder_width' => $width
 
 
1763
  ));
1764
 
1765
  wp_enqueue_script('wcp-folders-alert');
@@ -1869,8 +1903,13 @@ class WCP_Folders
1869
  function wcp_manage_columns_head($defaults, $d = "")
1870
  {
1871
  global $typenow;
 
 
 
 
 
1872
  $options = get_option("folders_settings");
1873
- if (is_array($options) && in_array($typenow, $options)) {
1874
  $columns = array(
1875
  'wcp_move' => '<div class="wcp-move-multiple wcp-col" title="' . __('Move selected items', WCP_FOLDER) . '"><span class="dashicons dashicons-move"></span><div class="wcp-items"></div></div>',
1876
  ) + $defaults;
@@ -1882,8 +1921,13 @@ class WCP_Folders
1882
  function wcp_manage_columns_content($column_name, $post_ID)
1883
  {
1884
  global $typenow;
 
 
 
 
 
1885
  $options = get_option("folders_settings");
1886
- if (is_array($options) && in_array($typenow, $options)) {
1887
  if ($column_name == 'wcp_move') {
1888
  $title = get_the_title();
1889
  if (strlen($title) > 20) {
765
  $folderID = self::sanitize_options($postData['folder_id']);
766
  $type = self::sanitize_options($postData['type']);
767
  $postArray = explode(",", $postID);
768
+ $status = 0;
769
+ if(isset($postData['status'])) {
770
+ $status = self::sanitize_options($postData['status']);
771
+ }
772
+ $status = true;
773
+
774
+ $taxonomy = "";
775
+ if(isset($postData['taxonomy'])) {
776
+ $taxonomy = self::sanitize_options($postData['taxonomy']);
777
+ }
778
  if (is_array($postArray)) {
779
  foreach ($postArray as $post) {
780
  $post_type = self::get_custom_post_type($type);
781
+ if(!empty($taxonomy)) {
782
+ wp_remove_object_terms($post, $taxonomy, $post_type);
783
+ }
784
+ wp_set_post_terms($post, $folderID, $post_type, $status);
785
  }
786
  }
787
  $response['status'] = 1;
829
  $folderID = self::sanitize_options($postData['folder_id']);
830
  $type = self::sanitize_options($postData['type']);
831
  $folder_post_type = self::get_custom_post_type($type);
832
+ $status = 0;
833
+ if(isset($postData['status'])) {
834
+ $status = self::sanitize_options($postData['status']);
835
+ }
836
+ $status = ($status == 1)?true:false;
837
+ $taxonomy = "";
838
+ if(isset($postData['taxonomy'])) {
839
+ $taxonomy = self::sanitize_options($postData['taxonomy']);
840
+ }
841
  $terms = get_the_terms($postID, $folder_post_type);
842
  if (!empty($terms)) {
843
  foreach ($terms as $term) {
844
+ if(!empty($taxonomy) && ($term->term_id == $taxonomy || $term->slug == $taxonomy)) {
845
+ wp_remove_object_terms($postID, $term->term_id, $folder_post_type);
846
+ }
847
  }
848
  }
849
+ wp_set_post_terms($postID, $folderID, $folder_post_type, true);
850
  $response['status'] = 1;
851
  }
852
  echo json_encode($response);
1772
  $can_manage_folder = current_user_can("manage_categories")?1:0;
1773
  $width = get_option("wcp_dynamic_width_for_" . $typenow);
1774
  $width = empty($width)||!is_numeric($width)?310:$width;
1775
+ $post_type = self::get_custom_post_type($typenow);
1776
+ $taxonomy_status = 0;
1777
+ $selected_taxonomy = "";
1778
+ if(!isset($_GET[$post_type]) || empty($_GET[$post_type])) {
1779
+ $taxonomy_status = 1;
1780
+ } else if(isset($_GET[$post_type]) && !empty($_GET[$post_type])) {
1781
+ $selected_taxonomy = $_GET[$post_type];
1782
+ }
1783
  wp_localize_script('wcp-folders-custom', 'wcp_settings', array(
1784
  'ajax_url' => admin_url('admin-ajax.php'),
1785
  'post_type' => $typenow,
1791
  'isRTL' => $is_rtl,
1792
  'nonce' => wp_create_nonce('wcp_folder_nonce_'.$typenow),
1793
  'can_manage_folder' => $can_manage_folder,
1794
+ 'folder_width' => $width,
1795
+ 'taxonomy_status' => $taxonomy_status,
1796
+ 'selected_taxonomy' => $selected_taxonomy
1797
  ));
1798
 
1799
  wp_enqueue_script('wcp-folders-alert');
1903
  function wcp_manage_columns_head($defaults, $d = "")
1904
  {
1905
  global $typenow;
1906
+ $type = $typenow;
1907
+ if(isset($_REQUEST['action']) && $_REQUEST['action'] == 'inline-save') {
1908
+ $type = self::sanitize_options($_REQUEST['post_type']);
1909
+ }
1910
+
1911
  $options = get_option("folders_settings");
1912
+ if (is_array($options) && in_array($type, $options)) {
1913
  $columns = array(
1914
  'wcp_move' => '<div class="wcp-move-multiple wcp-col" title="' . __('Move selected items', WCP_FOLDER) . '"><span class="dashicons dashicons-move"></span><div class="wcp-items"></div></div>',
1915
  ) + $defaults;
1921
  function wcp_manage_columns_content($column_name, $post_ID)
1922
  {
1923
  global $typenow;
1924
+ $type = $typenow;
1925
+ if(isset($_REQUEST['action']) && $_REQUEST['action'] == 'inline-save') {
1926
+ $type = self::sanitize_options($_REQUEST['post_type']);
1927
+ }
1928
+
1929
  $options = get_option("folders_settings");
1930
+ if (is_array($options) && in_array($type, $options)) {
1931
  if ($column_name == 'wcp_move') {
1932
  $title = get_the_title();
1933
  if (strlen($title) > 20) {
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
- === Folders - Organize Pages, Posts and Media Library Folders with Drag and Drop ===
2
  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.3
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.
@@ -12,6 +12,8 @@ Folders is a FREE WordPress plugin that will help you quickly organize and manag
12
 
13
  Folders is a WordPress plugin that enables users to quickly organize all of their Pages, Posts and Media files in folders. You can easily drag and drop items into directories and change the folders tree view (hierarchy) as you wish. Need more than 10 folders? Check out <a href="https://premio.io/downloads/folders" target="_blank" title="Folders pro plans"><strong>Folders Pro Plans</strong></a>.
14
 
 
 
15
  = How Folders Plugin Can Help You =
16
 
17
  There are several ways professionals are using the Folders file manager plugin to organize their WordPress content:
@@ -41,6 +43,12 @@ Web developers: Design websites in an organized fashion by uploading graphics, a
41
 
42
  E-Commerce businesses: Quickly upload new products and descriptions and then place them in folders organized by categories. For example, shoes, dresses, suits, and under garments.
43
 
 
 
 
 
 
 
44
  = FOLDERS PLUGIN FEATURES: =
45
 
46
  * Create new folders
@@ -76,9 +84,11 @@ Download this plugin today for free and get 10 folders to organize your WP conte
76
 
77
  == Screenshots ==
78
 
79
- 1. WordPress Media Folders
80
- 2. WordPress Pages Folders
81
- 3. WordPress Posts Folders
 
 
82
 
83
  == Installation ==
84
 
@@ -117,6 +127,9 @@ A live demo for the Folders plugin is available at <a href="https://demo.premio.
117
 
118
  == Changelog ==
119
 
 
 
 
120
  = 2.1.3 =
121
  * You can now minimize the folders section if you need that extra space :)
122
 
1
+ === Folders - Organize Media Library Folders, Pages, Posts And Media Categories with Drag & Drop ===
2
  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.4
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.
12
 
13
  Folders is a WordPress plugin that enables users to quickly organize all of their Pages, Posts and Media files in folders. You can easily drag and drop items into directories and change the folders tree view (hierarchy) as you wish. Need more than 10 folders? Check out <a href="https://premio.io/downloads/folders" target="_blank" title="Folders pro plans"><strong>Folders Pro Plans</strong></a>.
14
 
15
+ [youtube https://www.youtube.com/watch?v=FNtjAGQyB8U]
16
+
17
  = How Folders Plugin Can Help You =
18
 
19
  There are several ways professionals are using the Folders file manager plugin to organize their WordPress content:
43
 
44
  E-Commerce businesses: Quickly upload new products and descriptions and then place them in folders organized by categories. For example, shoes, dresses, suits, and under garments.
45
 
46
+ Photographers: As a photographer, you may take hundreds of photos per month and many media categories. If you're uploading them to your website, then things can get pretty hectic. Use folders to organize your photographs into media library folders by type, such as people, animals, nature, environment, real estate, weddings, and so on.
47
+
48
+ Publishers: You have a lot of content to manage, edit, and publish. Wouldn't it be nice to have a way to organize it all? With Folders, you can organize every piece of content and media used in each piece into neat posts folders, pages folders, and media categories based on the media type, date, topic, and so on.
49
+
50
+ Digital Agencies: You're creating all sorts of content for your clients daily - ads, blog posts, social media content, videos, media categories, and all kind of wordpress media library files. Now, you can easily organize it all by file type, topic, campaign, or other categories using the Folders plugin.
51
+
52
  = FOLDERS PLUGIN FEATURES: =
53
 
54
  * Create new folders
84
 
85
  == Screenshots ==
86
 
87
+ 1. Organize WordPress media library folders
88
+ 2. Organize WordPress pages folders
89
+ 3. Organize WordPress posts folders
90
+ 4. Check out the Folders plugin in action with the media library
91
+ 5. Organize posts, pages, and custom posts with ease
92
 
93
  == Installation ==
94
 
127
 
128
  == Changelog ==
129
 
130
+ = 2.1.4 =
131
+ * Move one media file/post/page/custom post to more than one folder + quick edit bug fix :)
132
+
133
  = 2.1.3 =
134
  * You can now minimize the folders section if you need that extra space :)
135