@@ -17,52 +17,32 @@ class DetectVendorFiles {
17
17
public static function detect ( string $ wp_site_url ) : array {
18
18
$ vendor_files = [];
19
19
20
- // cache dir used by Autoptimize and other themes/plugins
21
- $ vendor_cache_dir =
22
- SiteInfo::getPath ( 'content ' ) . 'cache/ ' ;
23
-
24
- // cache dir used by Elegant Themes
25
- $ et_cache_dir =
26
- SiteInfo::getPath ( 'content ' ) . 'et-cache/ ' ;
27
-
28
- if ( is_dir ( $ vendor_cache_dir ) ) {
29
- $ site_url = SiteInfo::getUrl ( 'site ' );
30
- $ content_url = SiteInfo::getUrl ( 'content ' );
31
-
32
- // get difference between home and wp-contents URL
33
- $ prefix = str_replace (
34
- $ site_url ,
35
- '/ ' ,
36
- $ content_url
37
- );
38
-
39
- $ vendor_cache_urls = DetectVendorCache::detect (
40
- $ vendor_cache_dir ,
41
- SiteInfo::getPath ( 'content ' ),
42
- $ prefix
43
- );
44
-
45
- $ vendor_files = array_merge ( $ vendor_files , $ vendor_cache_urls );
46
- }
47
-
48
- if ( is_dir ( $ et_cache_dir ) ) {
49
- $ site_url = SiteInfo::getUrl ( 'site ' );
50
- $ content_url = SiteInfo::getUrl ( 'content ' );
51
-
52
- // get difference between home and wp-contents URL
53
- $ prefix = str_replace (
54
- $ site_url ,
55
- '/ ' ,
56
- $ content_url
57
- );
20
+ $ content_path = SiteInfo::getPath ( 'content ' );
21
+ $ site_url = SiteInfo::getUrl ( 'site ' );
22
+ $ content_url = SiteInfo::getUrl ( 'content ' );
23
+
24
+ $ vendor_cache_dirs = [
25
+ $ content_path . 'cache/ ' , // cache dir used by Autoptimize and other themes/plugins
26
+ $ content_path . 'et-cache/ ' , // cache dir used by Elegant Themes
27
+ ];
28
+
29
+ foreach ( $ vendor_cache_dirs as $ vendor_cache_dir ) {
30
+ if ( is_dir ( $ vendor_cache_dir ) ) {
31
+ // get difference between home and wp-contents URL
32
+ $ prefix = str_replace (
33
+ $ site_url ,
34
+ '/ ' ,
35
+ $ content_url
36
+ );
58
37
59
- $ et_cache_urls = DetectVendorCache::detect (
60
- $ et_cache_dir ,
61
- SiteInfo:: getPath ( ' content ' ) ,
62
- $ prefix
63
- );
38
+ $ vendor_cache_urls = DetectVendorCache::detect (
39
+ $ vendor_cache_dir ,
40
+ $ content_path ,
41
+ $ prefix
42
+ );
64
43
65
- $ vendor_files = array_merge ( $ vendor_files , $ et_cache_urls );
44
+ $ vendor_files = array_merge ( $ vendor_files , $ vendor_cache_urls );
45
+ }
66
46
}
67
47
68
48
if ( class_exists ( 'Custom_Permalinks ' ) ) {
0 commit comments