PluginProbe
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell / 3.11.1
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell v3.11.1
3.13.3 3.13.2 3.13.1 3.13.0 3.12.13 3.12.12 3.12.11 3.12.10 3.12.9 3.12.8 3.12.7 3.12.6 3.12.5 3.12.4 3.12.3 3.12.1 3.12.2 3.12.0 3.11.1 3.11.0 3.10.9 3.10.8 3.10.7 3.10.6 2.8.16 All 261 releases
wpfunnels / includes / core / classes / class-wpfnl-compatibility.php

class-wpfnl-compatibility.php in WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell 3.11.1, at includes/core/classes/class-wpfnl-compatibility.php

98 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * WPFNL compatibility class
4 *
5 * @package
6 */
7 namespace WPFunnels\Compatibility;
8
9 use WPFunnels\Traits\SingletonTrait;
10
11 /**
12 * Class Wpfnl_Compatibility
13 */
14 class Wpfnl_Theme_Compatibility {
15
16 use SingletonTrait;
17
18
19 /**
20 * Check is compatible theme enabled
21 *
22 * @return mixed|void
23 */
24 public function is_compatible_theme_enabled() {
25 $theme = wp_get_theme();
26 $is_compatible = false;
27 if ( $this->is_storefront_theme_enabled( $theme ) || $this->is_astra_theme_enabled( $theme ) ) {
28 $is_compatible = true;
29 }
30
31 return apply_filters( 'wpfunnels/is_compatible_theme', $is_compatible );
32 }
33
34
35 /**
36 * Storfront theme checking
37 *
38 * @param $theme
39 *
40 * @return bool
41 */
42 private function is_storefront_theme_enabled( $theme ) {
43 if ( ! $theme ) {
44 $theme = wp_get_theme();
45 }
46 if ( 'Storefront' == $theme->name || 'Storefront' == $theme->parent_theme ) {
47 return true;
48 }
49 return false;
50 }
51
52
53 /**
54 * Astra theme checking
55 *
56 * @param $theme
57 *
58 * @return bool
59 */
60 private function is_astra_theme_enabled( $theme ) {
61 if ( ! $theme ) {
62 $theme = wp_get_theme();
63 }
64 if ( 'Astra' == $theme->name || 'Astra' == $theme->parent_theme ) {
65 return true;
66 }
67 return false;
68 }
69
70 /**
71 * Check if the view is builder preview or not
72 *
73 * @return bool
74 */
75 public function is_builder_preview() {
76 if( $this->is_elementor_preview() ) {
77 return true;
78 }
79 return false;
80 }
81
82
83 /**
84 * Check if this is elementor preview
85 *
86 * @return bool
87 */
88 public function is_elementor_preview() {
89 if ( class_exists( '\Elementor\Plugin' ) ) {
90 $preview = \Elementor\Plugin::$instance->preview;
91 if ( $preview && $preview->is_preview_mode() ) {
92 return true;
93 }
94 }
95 return false;
96 }
97 }
98