PluginProbe ʕ •ᴥ•ʔ
Folders – Unlimited Folders to Organize Media Library Folder, Pages, Posts, File Manager / 2.5
Folders – Unlimited Folders to Organize Media Library Folder, Pages, Posts, File Manager v2.5
3.1.9 3.1.8 3.1.7 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 2.9.8 3.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 trunk 1.3.7 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 2.3 2.3.1 2.3.2 2.3.3 2.3.4 2.3.5 2.3.6 2.3.7 2.3.8 2.3.9 2.4 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.4.7 2.4.8 2.4.9 2.5 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.7 2.5.8 2.5.9 2.6 2.6.1 2.6.2 2.6.3 2.6.4 2.6.5 2.6.6 2.6.7 2.6.8 2.6.9 2.7 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.8 2.8.9 2.9 2.9.1 2.9.2
folders / includes / tree.class.php
folders / includes Last commit date
class-affiliate.php 6 years ago class-review-box.php 6 years ago folders.class.php 6 years ago form.class.php 6 years ago plugin.updates.php 6 years ago tree.class.php 6 years ago
tree.class.php
131 lines
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) {
10 $isAjax = (defined('DOING_AJAX') && DOING_AJAX)?1:0;
11 $type = filter_input(INPUT_GET, $post_type, FILTER_SANITIZE_STRING);
12 if((isset($type) && !empty($type)) || ! $isAjax) {
13 update_option("selected_" . $post_type . "_folder", "");
14 }
15 return self::get_folder_category_data($post_type, 0, 0);
16 }
17
18 public static function get_folder_category_data($post_type, $parent = 0, $parentStatus = 0) {
19 $terms = get_terms( $post_type, array(
20 'hide_empty' => false,
21 'parent' => $parent,
22 'orderby' => 'meta_value_num',
23 'order' => 'ASC',
24 'hierarchical' => false,
25 'update_count_callback' => '_update_generic_term_count',
26 'meta_query' => [[
27 'key' => 'wcp_custom_order',
28 'type' => 'NUMERIC',
29 ]]
30 ));
31 $string = "";
32 $sticky_string = "";
33 $child = 0;
34 $isAjax = (defined('DOING_AJAX') && DOING_AJAX)?1:0;
35 if(!empty($terms)) {
36 $child = count($terms);
37 foreach($terms as $term) {
38
39
40 $is_sticky = get_term_meta($term->term_id, "is_folder_sticky", true);
41
42 $status = get_term_meta($term->term_id, "is_active", true);
43 $return = self::get_folder_category_data($post_type, $term->term_id, $status);
44 $class = ($status == 1 && $return['child']>0)?"active":"";
45 $class .= ($return['child'])>0?" has-sub-tree":"";
46 $term_var = filter_input(INPUT_GET, "term", FILTER_SANITIZE_STRING);
47 $type = filter_input(INPUT_GET, $post_type, FILTER_SANITIZE_STRING);
48 if($post_type == "attachment") {
49 $class .= (isset($term_var) && $term_var == $term->slug)?" active-item active-term":"";
50 if(isset($type) && $type == $term->slug) {
51 update_option("selected_".$post_type."_folder", $term->term_id);
52 }
53 if(!isset($type) && $isAjax) {
54 $termId = get_option("selected_".$post_type."_folder");
55 $class .= ($termId == $term->term_id)?" active-item active-term":"";
56 }
57 } else {
58 $class .= (isset($type) && $type == $term->slug)?" active-item active-term":"";
59 if(isset($type) && $type == $term->slug) {
60 update_option("selected_" . $post_type . "_folder", $term->term_id);
61 }
62 if(!isset($type) && $isAjax) {
63 $termId = get_option("selected_".$post_type."_folder");
64 $class .= ($termId == $term->term_id)?" active-item active-term":"";
65 }
66 }
67 $status = get_term_meta($term->term_id, "is_highlighted", true);
68 $class .= ($status == 1)?" is-high":"";
69 $sticky_class = ($status == 1)?"is-high":"";
70 $count = ($term->trash_count != 0)?"<span class='total-count'>{$term->trash_count}</span>":"";
71 if($is_sticky == 1) {
72 $class .= " is-sticky";
73 }
74
75 $count_sticky = ($term->trash_count != 0)?"<span class='folder-count'>{$term->trash_count}</span>":"";
76
77 if($is_sticky == 1) {
78 $sticky_string .= "<li data-folder-id='{$term->term_id}' class='sticky-fldr {$sticky_class} sticky-folder-{$term->term_id}'><a href='javascript:;'><span class='sticky-icon'><img src='".WCP_FOLDER_URL."assets/images/pin.png' /></span><span class='folder-title'>{$term->name}</span><span class='update-inline-record'></span>{$count_sticky}<span class='star-icon'></span></a></li>";
79 }
80
81 $delete_nonce = wp_create_nonce('wcp_folder_delete_term_'.$term->term_id);
82 $rename_nonce = wp_create_nonce('wcp_folder_rename_term_'.$term->term_id);
83 $highlight_nonce = wp_create_nonce('wcp_folder_highlight_term_'.$term->term_id);
84 $term_nonce = wp_create_nonce('wcp_folder_term_'.$term->term_id);
85 /* Free/Pro URL Change*/
86 $string .= "<li data-nonce='{$term_nonce}' data-star='{$highlight_nonce}' data-rename='{$rename_nonce}' data-delete='{$delete_nonce}' data-slug='{$term->slug}' class='ui-state-default route wcp_folder_{$term->term_id} {$class}' id='wcp_folder_{$term->term_id}' data-folder-id='{$term->term_id}'><h3 class='title' title='{$term->name}' id='title_{$term->term_id}'><span class='ui-icon'><i class='wcp-icon folder-icon-folder'></i><img src='".esc_url(WCP_FOLDER_URL."assets/images/pin.png")."' class='folder-sticky-icon' /><img src='".esc_url(WCP_FOLDER_URL."assets/images/move-option.png")."' class='move-folder-icon' ><input type='checkbox' class='checkbox' value='{$term->term_id}' /> </span><span class='title-text'>{$term->name}</span> <span class='update-inline-record'></span> {$count} <span class='star-icon'></span></h3><span class='nav-icon'><i class='wcp-icon folder-icon-arrow_right'></i></span> <ul class='space' id='space_{$term->term_id}'>";
87 $string .= $return['string'];
88 $string .= "</ul></li>";
89
90 $sticky_string .= $return['sticky_string'];
91 }
92 }
93 return array(
94 'string' =>$string,
95 'sticky_string' =>$sticky_string,
96 'child' => $child
97 );
98 }
99
100 public static function get_option_data_for_select($post_type) {
101 $string = "<option value='0'>Parent Folder</option>";
102 $string .= self::get_folder_option_data($post_type, 0, '&nbsp;&nbsp;');
103 return $string;
104 }
105
106 public static function get_folder_option_data($post_type, $parent = 0, $space = "") {
107 $terms = get_terms( $post_type, array(
108 'hide_empty' => false,
109 'parent' => $parent,
110 'orderby' => 'meta_value_num',
111 'order' => 'ASC',
112 'hierarchical' => false,
113 'meta_query' => [[
114 'key' => 'wcp_custom_order',
115 'type' => 'NUMERIC',
116 ]]
117 ) );
118
119 $selected_term = get_option("selected_" . $post_type . "_folder");
120
121 $string = "";
122 if(!empty($terms)) {
123 foreach($terms as $term) {
124 $selected = ($selected_term == $term->term_id)?"selected":"";
125 $string .= "<option {$selected} value='{$term->term_id}'>{$space}{$term->name}</option>";
126 $string .= self::get_folder_option_data($post_type, $term->term_id, trim($space)."- ");
127 }
128 }
129 return $string;
130 }
131 }