Diff: STRATO-apps/wordpress_03/app/wp-content/plugins/wp-rocket/inc/ThirdParty/Themes/ThemeResolver.php
Keine Baseline-Datei – Diff nur gegen leer.
1
-
1
+
<?php
2
+
declare(strict_types=1);
3
+
4
+
namespace WP_Rocket\ThirdParty\Themes;
5
+
6
+
class ThemeResolver {
7
+
/**
8
+
* Array of themes names with compatibility classes
9
+
*
10
+
* @var array
11
+
*/
12
+
private static $compatibilities = [
13
+
'avada',
14
+
'bridge',
15
+
'divi',
16
+
'flatsome',
17
+
'jevelin',
18
+
'minimalist_blogger',
19
+
'polygon',
20
+
'uncode',
21
+
'xstore',
22
+
'themify',
23
+
'shoptimizer',
24
+
];
25
+
26
+
/**
27
+
* Return name of current theme
28
+
*
29
+
* @return string
30
+
*/
31
+
public static function get_current_theme(): string {
32
+
$theme = wp_get_theme();
33
+
$template = $theme->get_template();
34
+
35
+
if ( empty( $template ) ) {
36
+
return '';
37
+
}
38
+
39
+
$template = strtolower( $template );
40
+
41
+
if ( ! in_array( $template, self::$compatibilities, true ) ) {
42
+
return '';
43
+
}
44
+
45
+
return $template;
46
+
}
47
+
}
48
+