folders
Last commit date
assets
5 years ago
includes
5 years ago
languages
6 years ago
templates
5 years ago
folders.php
5 years ago
readme.txt
5 years ago
folders.php
117 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Plugin Name: Folders |
| 4 | * Description: Arrange media, pages, custom post types and posts into folders |
| 5 | * Version: 2.6.4 |
| 6 | * Author: Premio |
| 7 | * Author URI: https://premio.io/downloads/folders/ |
| 8 | * Text Domain: folders |
| 9 | * Domain Path: /languages |
| 10 | */ |
| 11 | |
| 12 | if ( ! defined( 'ABSPATH' ) ) exit; |
| 13 | |
| 14 | if(!defined("WCP_FOLDERS_PLUGIN_FILE")) { |
| 15 | define('WCP_FOLDERS_PLUGIN_FILE', __FILE__); |
| 16 | } |
| 17 | if(!defined("WCP_FOLDERS_PLUGIN_BASE")) { |
| 18 | define('WCP_FOLDERS_PLUGIN_BASE', plugin_basename(WCP_FOLDERS_PLUGIN_FILE)); |
| 19 | } |
| 20 | if(!defined("WCP_FOLDER")) { |
| 21 | define('WCP_FOLDER', 'folders'); |
| 22 | } |
| 23 | if(!defined("WCP_FOLDER_VAR")) { |
| 24 | define('WCP_FOLDER_VAR', 'folders_settings'); |
| 25 | } |
| 26 | if(!defined("WCP_DS")) { |
| 27 | define("WCP_DS", DIRECTORY_SEPARATOR); |
| 28 | } |
| 29 | 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.6.4"); |
| 34 | } |
| 35 | |
| 36 | |
| 37 | if(!function_exists("folders_clear_all_caches")) { |
| 38 | function folders_clear_all_caches() |
| 39 | { |
| 40 | /* Clear cookies from browser */ |
| 41 | try { |
| 42 | global $wp_fastest_cache; |
| 43 | // if W3 Total Cache is being used, clear the cache |
| 44 | if (function_exists('w3tc_flush_all')) { |
| 45 | w3tc_flush_all(); |
| 46 | /* if WP Super Cache is being used, clear the cache */ |
| 47 | } else if (function_exists('wp_cache_clean_cache')) { |
| 48 | global $file_prefix, $supercachedir; |
| 49 | if (empty($supercachedir) && function_exists('get_supercache_dir')) { |
| 50 | $supercachedir = get_supercache_dir(); |
| 51 | } |
| 52 | wp_cache_clean_cache($file_prefix); |
| 53 | } else if (class_exists('WpeCommon')) { |
| 54 | //be extra careful, just in case 3rd party changes things on us |
| 55 | if (method_exists('WpeCommon', 'purge_memcached')) { |
| 56 | //WpeCommon::purge_memcached(); |
| 57 | } |
| 58 | if (method_exists('WpeCommon', 'clear_maxcdn_cache')) { |
| 59 | //WpeCommon::clear_maxcdn_cache(); |
| 60 | } |
| 61 | if (method_exists('WpeCommon', 'purge_varnish_cache')) { |
| 62 | //WpeCommon::purge_varnish_cache(); |
| 63 | } |
| 64 | } else if (method_exists('WpFastestCache', 'deleteCache') && !empty($wp_fastest_cache)) { |
| 65 | $wp_fastest_cache->deleteCache(); |
| 66 | } else if (function_exists('rocket_clean_domain')) { |
| 67 | rocket_clean_domain(); |
| 68 | // Preload cache. |
| 69 | if (function_exists('run_rocket_sitemap_preload')) { |
| 70 | run_rocket_sitemap_preload(); |
| 71 | } |
| 72 | } else if (class_exists("autoptimizeCache") && method_exists("autoptimizeCache", "clearall")) { |
| 73 | autoptimizeCache::clearall(); |
| 74 | } else if (class_exists("LiteSpeed_Cache_API") && method_exists("autoptimizeCache", "purge_all")) { |
| 75 | LiteSpeed_Cache_API::purge_all(); |
| 76 | } |
| 77 | |
| 78 | if (class_exists("Breeze_PurgeCache") && method_exists("Breeze_PurgeCache", "breeze_cache_flush")) { |
| 79 | Breeze_PurgeCache::breeze_cache_flush(); |
| 80 | } |
| 81 | |
| 82 | |
| 83 | if (class_exists( '\Hummingbird\Core\Utils' ) ) { |
| 84 | $modules = \Hummingbird\Core\Utils::get_active_cache_modules(); |
| 85 | foreach ( $modules as $module => $name ) { |
| 86 | $mod = \Hummingbird\Core\Utils::get_module( $module ); |
| 87 | if ( $mod->is_active() ) { |
| 88 | if ( 'minify' === $module ) { |
| 89 | $mod->clear_files(); |
| 90 | } else { |
| 91 | $mod->clear_cache(); |
| 92 | } |
| 93 | } |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | if ( function_exists( 'wp_cache_clean_cache' ) ) { |
| 98 | global $file_prefix; |
| 99 | wp_cache_clean_cache( $file_prefix, true ); |
| 100 | } |
| 101 | } catch (Exception $e) { |
| 102 | return 1; |
| 103 | } |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | include_once plugin_dir_path(__FILE__)."includes/plugins.class.php"; |
| 108 | include_once plugin_dir_path(__FILE__)."includes/media.replace.php"; |
| 109 | include_once plugin_dir_path(__FILE__)."includes/folders.class.php"; |
| 110 | register_activation_hook( __FILE__, array( 'WCP_Folders', 'activate' ) ); |
| 111 | WCP_Folders::get_instance(); |
| 112 | |
| 113 | /* Affiliate Class*/ |
| 114 | if(is_admin()) { |
| 115 | include_once plugin_dir_path(__FILE__)."includes/class-affiliate.php"; |
| 116 | include_once plugin_dir_path(__FILE__) . "includes/class-review-box.php"; |
| 117 | } |