PluginProbe
Filter Everything — WordPress & WooCommerce Filters / 1.9.7
Filter Everything — WordPress & WooCommerce Filters v1.9.7
1.9.7 1.9.6 1.9.5 1.9.4 1.9.3 1.9.2.2 1.9.2.1 trunk 1.2.1 1.2.3 1.2.4 1.2.5 1.3.0 1.3.1 1.3.2 1.4.1 1.4.4 1.4.5 1.4.8 1.4.9 1.5.0 1.5.1 1.6.0 1.6.1 1.6.2 All 52 releases
filter-everything / src / helpers / cache-keys.php

cache-keys.php in Filter Everything — WordPress & WooCommerce Filters 1.9.7, at src/helpers/cache-keys.php

88 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if (!defined('ABSPATH')) {
4 exit;
5 }
6
7 use \FilterEverything\Filter\Container;
8 use \FilterEverything\Filter\FilterSet;
9 use \FilterEverything\Filter\FilterFields;
10 use \FilterEverything\Filter\PostMetaNumEntity;
11 use \FilterEverything\Filter\PostDateEntity;
12 use \FilterEverything\Filter\PostMetaDateEntity;
13
14 /**
15 * Cache helpers: transient key builders for terms / post IDs / variations and
16 * cache folder cleanup.
17 *
18 * Split out of src/wpc-helpers.php on 2026-09-14; function names and bodies are
19 * unchanged. Loaded from filter-everything.php right after wpc-helpers.php.
20 */
21
22 function flrt_get_terms_transient_key( $salt, $include_lang = true ){
23 $key = 'wpc_terms_' . $salt . FLRT_CACHE_FORMAT_SUFFIX;
24 if ( flrt_wpml_active() && defined( 'ICL_LANGUAGE_CODE' ) && $include_lang ) {
25 $key .= '_'.ICL_LANGUAGE_CODE;
26 }
27
28 if (function_exists('pll_current_language') && $include_lang) {
29 $pll_lang = pll_current_language();
30 if ($pll_lang) {
31 $key .= '_' . $pll_lang;
32 }
33 }
34
35 return $key;
36 }
37
38 function flrt_get_post_ids_transient_key( $salt ){
39 $key = 'wpc_posts_' . $salt . FLRT_CACHE_FORMAT_SUFFIX;
40 if (flrt_wpml_active() && defined('ICL_LANGUAGE_CODE')) {
41 $key .= '_' . ICL_LANGUAGE_CODE;
42 }
43
44 if (function_exists('pll_current_language')) {
45 $pll_lang = pll_current_language();
46 if ($pll_lang) {
47 $key .= '_' . $pll_lang;
48 }
49 }
50
51 return $key;
52 }
53
54 function flrt_get_variations_transient_key( $salt ){
55 $key = 'wpc_variations_' . $salt . FLRT_CACHE_FORMAT_SUFFIX;
56 if (flrt_wpml_active() && defined('ICL_LANGUAGE_CODE')) {
57 $key .= '_' . ICL_LANGUAGE_CODE;
58 }
59
60 if (function_exists('pll_current_language')) {
61 $pll_lang = pll_current_language();
62 if ($pll_lang) {
63 $key .= '_' . $pll_lang;
64 }
65 }
66
67 return $key;
68 }
69
70
71 function wpc_clear_folder($directory)
72 {
73
74 if (!is_dir($directory)) {
75 return false;
76 }
77
78 $files = glob(rtrim($directory, '/\\') . DIRECTORY_SEPARATOR . '*');
79
80 if(!empty($files)){
81 foreach ($files as $file) {
82 if (is_file($file)) {
83 unlink($file);
84 }
85 }
86 }
87 }
88