PluginProbe
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell / 2.8.16
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell v2.8.16
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 / compatibility / plugin / class-wpfnl-electro-extension.php

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

77 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Electro Extension Compatibility
5 *
6 * @package WPFunnels\Compatibility\Plugin
7 */
8
9 namespace WPFunnels\Compatibility\Plugin;
10
11 use WPFunnels\Wpfnl_functions;
12 use WPFunnels\Traits\SingletonTrait;
13
14 /**
15 * Electro Extension Compatibility
16 *
17 * @package WPFunnels\Compatibility\Plugin
18 */
19 class ElectroExtension extends PluginCompatibility{
20 use SingletonTrait;
21
22 /**
23 * Initiate Filters/Hook
24 *
25 * @since 2.7.7
26 */
27 public function init() {
28 add_filter( 'template_redirect', [ $this, 'set_cookie' ] );
29 }
30
31
32 /**
33 * Set post id in cookie variable
34 *
35 * @return void
36 * @since 2.7.7
37 */
38 public function set_cookie(){
39 if ( Wpfnl_functions::is_funnel_step_page() ) {
40 global $post;
41 if( !$post ){
42 return;
43 }
44 $step_id = isset($post->ID) ? $post->ID : '';
45 if( !$step_id ){
46 return;
47 }
48
49 $cookie_name = 'wpfunnels_current_post_id';
50 ob_start();
51 setcookie( $cookie_name, wp_json_encode( $step_id ), time() + 3600 * 6, '/', COOKIE_DOMAIN );
52 ob_end_flush();
53
54 }
55 }
56
57
58
59 /**
60 * Check if electro extensions is activated
61 *
62 * @return bool
63 * @since 2.7.7
64 */
65 public function maybe_activate()
66 {
67 if (in_array('electro-extension/electro-extensions.php', apply_filters('active_plugins', get_option('active_plugins')))) {
68 return true;
69 }elseif( function_exists('is_plugin_active') ){
70 if( is_plugin_active( 'electro-extensions/electro-extensions.php' )){
71 return true;
72 }
73 }
74 return false;
75 }
76 }
77