PluginProbe ʕ •ᴥ•ʔ
Folders – Unlimited Folders to Organize Media Library Folder, Pages, Posts, File Manager / 3.0.6
Folders – Unlimited Folders to Organize Media Library Folder, Pages, Posts, File Manager v3.0.6
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 / folders.php
folders Last commit date
assets 1 year ago includes 1 year ago languages 6 years ago libraries 1 year ago templates 1 year ago folders.php 1 year ago readme.txt 1 year ago
folders.php
191 lines
1 <?php
2 /**
3 * Plugin Name: Folders
4 * Description: Organize your Media library, Pages, and Posts into folders. You can easily drag and drop items into directories and change the folders tree view.
5 * Version: 3.0.6
6 * Author: Premio
7 * Author URI: https://premio.io/downloads/folders/
8 * Text Domain: folders
9 * Domain Path: /languages
10 * License: GPLv3
11 */
12
13 if ( ! defined( 'ABSPATH' ) ) exit;
14
15 if(!defined("WCP_FOLDERS_PLUGIN_FILE")) {
16 define('WCP_FOLDERS_PLUGIN_FILE', __FILE__);
17 }
18 if(!defined("WCP_FOLDERS_PLUGIN_PATH")) {
19 define('WCP_FOLDERS_PLUGIN_PATH', plugin_dir_path(__FILE__) );
20 }
21 if(!defined("WCP_FOLDERS_PLUGIN_BASE")) {
22 define('WCP_FOLDERS_PLUGIN_BASE', plugin_basename(WCP_FOLDERS_PLUGIN_FILE));
23 }
24 if(!defined("WCP_DS")) {
25 define("WCP_DS", DIRECTORY_SEPARATOR);
26 }
27 if(!defined("WCP_FOLDER_URL")) {
28 define('WCP_FOLDER_URL', plugin_dir_url(__FILE__));
29 }
30 if(!defined("WCP_FOLDER_VERSION")) {
31 define('WCP_FOLDER_VERSION', "3.0.6");
32 }
33
34
35 if(!function_exists("folders_clear_all_caches")) {
36 function folders_clear_all_caches()
37 {
38 /* Clear cookies from browser */
39 try {
40 global $wp_fastest_cache;
41 // if W3 Total Cache is being used, clear the cache
42 if (function_exists('w3tc_flush_all')) {
43 w3tc_flush_all();
44 /* if WP Super Cache is being used, clear the cache */
45 } else if (function_exists('wp_cache_clean_cache')) {
46 global $file_prefix, $supercachedir;
47 if (empty($supercachedir) && function_exists('get_supercache_dir')) {
48 $supercachedir = get_supercache_dir();
49 }
50 wp_cache_clean_cache($file_prefix);
51 } else if (class_exists('WpeCommon')) {
52 //be extra careful, just in case 3rd party changes things on us
53 if (method_exists('WpeCommon', 'purge_memcached')) {
54 //WpeCommon::purge_memcached();
55 }
56 if (method_exists('WpeCommon', 'clear_maxcdn_cache')) {
57 //WpeCommon::clear_maxcdn_cache();
58 }
59 if (method_exists('WpeCommon', 'purge_varnish_cache')) {
60 //WpeCommon::purge_varnish_cache();
61 }
62 } else if (method_exists('WpFastestCache', 'deleteCache') && !empty($wp_fastest_cache)) {
63 $wp_fastest_cache->deleteCache();
64 } else if (function_exists('rocket_clean_domain')) {
65 rocket_clean_domain();
66 // Preload cache.
67 if (function_exists('run_rocket_sitemap_preload')) {
68 run_rocket_sitemap_preload();
69 }
70 } else if (class_exists("autoptimizeCache") && method_exists("autoptimizeCache", "clearall")) {
71 autoptimizeCache::clearall();
72 } else if (class_exists("LiteSpeed_Cache_API") && method_exists("autoptimizeCache", "purge_all")) {
73 LiteSpeed_Cache_API::purge_all();
74 }
75
76 if (class_exists("Breeze_PurgeCache") && method_exists("Breeze_PurgeCache", "breeze_cache_flush")) {
77 Breeze_PurgeCache::breeze_cache_flush();
78 }
79
80
81 if (class_exists( '\Hummingbird\Core\Utils' ) ) {
82 $modules = \Hummingbird\Core\Utils::get_active_cache_modules();
83 foreach ( $modules as $module => $name ) {
84 $mod = \Hummingbird\Core\Utils::get_module( $module );
85 if ( $mod->is_active() ) {
86 if ( 'minify' === $module ) {
87 $mod->clear_files();
88 } else {
89 $mod->clear_cache();
90 }
91 }
92 }
93 }
94
95 if ( function_exists( 'wp_cache_clean_cache' ) ) {
96 global $file_prefix;
97 wp_cache_clean_cache( $file_prefix, true );
98 }
99 } catch (Exception $e) {
100 return 1;
101 }
102 }
103 }
104
105 include_once plugin_dir_path(__FILE__) . "includes/plugins.class.php";
106 include_once plugin_dir_path(__FILE__) . "includes/media.replace.php";
107 include_once plugin_dir_path(__FILE__) . "includes/folders.class.php";
108 include_once plugin_dir_path(__FILE__) . "includes/svg.class.php";
109 register_activation_hook( __FILE__, array( 'WCP_Folders', 'activate' ) );
110 register_deactivation_hook( __FILE__, array( 'WCP_Folders', 'deactivate' ) );
111
112 WCP_Folders::get_instance();
113
114
115 /* Affiliate Class*/
116 if(is_admin()) {
117 include_once plugin_dir_path(__FILE__)."includes/class-affiliate.php";
118 include_once plugin_dir_path(__FILE__) . "includes/class-review-box.php";
119 }
120
121 if(!function_exists('premio_folders_plugin_check_for_setting')) {
122 function premio_folders_plugin_check_for_setting() {
123 $status = get_option("folders_settings_updated");
124 if($status === false) {
125 add_option("folders_settings_updated", "1");
126 $customize_folders = get_option("customize_folders");
127 $customize_folders = !is_array($customize_folders)?array():$customize_folders;
128
129 $default_folders = get_option("default_folders");
130 $default_folders = !is_array($default_folders)?array():$default_folders;
131
132 $folders_settings = get_option("folders_settings");
133 $folders_settings = !is_array($folders_settings)?array():$folders_settings;
134
135 $general = array(
136 'has_stars' => 0,
137 'has_child' => 0
138 );
139
140 global $wpdb;
141
142 $total_stars = $wpdb->get_var("SELECT COUNT($wpdb->termmeta.term_id) AS total_records FROM {$wpdb->termmeta} WHERE meta_key = 'is_highlighted'");
143 if(!empty($total_stars)) {
144 $general['has_stars'] = 1;
145 }
146
147 $eCondition = "($wpdb->term_taxonomy.taxonomy = 'folder'
148 OR $wpdb->term_taxonomy.taxonomy = 'media_folder'
149 OR $wpdb->term_taxonomy.taxonomy = 'post_folder'";
150 $post_types = get_post_types( array( ), 'objects' );
151 $post_array = array("page", "post", "attachment");
152 foreach ( $post_types as $post_type ) {
153 if(!in_array($post_type->name, $post_array)) {
154 $eCondition .= "OR $wpdb->term_taxonomy.taxonomy = '".esc_attr($post_type->name)."_folder'";
155 }
156 }
157 $eCondition .= ")";
158 $total_records = $wpdb->get_var("SELECT COUNT($wpdb->terms.term_id) AS total_records
159 FROM $wpdb->terms
160 INNER JOIN $wpdb->term_taxonomy
161 ON $wpdb->terms.term_id = $wpdb->term_taxonomy.term_id
162 WHERE $wpdb->terms.term_id NOT IN(
163 SELECT $wpdb->term_taxonomy.parent
164 FROM $wpdb->term_taxonomy
165 )
166 AND {$eCondition}");
167
168 $total_parents = $wpdb->get_var("SELECT COUNT($wpdb->terms.term_id) AS total_records
169 FROM $wpdb->terms
170 INNER JOIN $wpdb->term_taxonomy
171 ON $wpdb->terms.term_id = $wpdb->term_taxonomy.term_id
172 WHERE {$eCondition}");
173
174 if(!empty($total_parents) && $total_parents != $total_records) {
175 $general['has_child'] = 1;
176 }
177
178 $folder_options = array(
179 'customize_folders' => $customize_folders,
180 'default_folders' => $default_folders,
181 'folders_settings' => $folders_settings,
182 'general' => $general
183 );
184
185 add_option("premio_folder_options", $folder_options);
186 }
187 }
188
189 add_action( 'plugins_loaded', 'premio_folders_plugin_check_for_setting' );
190 }
191