PluginProbe
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell / 3.12.10
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell v3.12.10
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 / widgets / oxygen / class-manager.php

class-manager.php in WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell 3.12.10, at includes/core/widgets/oxygen/class-manager.php

130 lines 2.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Oxygen manager
4 *
5 * @package
6 */
7 namespace WPFunnels\Widgets\Oxygen;
8
9
10 use CT_Toolbar;
11 use WPFunnels\Wpfnl_functions;
12 use function cli\err;
13
14 if (!defined('ABSPATH')) {
15 exit; // Exit if accessed directly.
16 }
17
18
19 final class Manager {
20
21 private static $_instance = null;
22
23 /**
24 * Section slug
25 *
26 * @var string $section_slug
27 */
28 public $section_slug = "wpf_section_slug";
29
30
31 /**
32 * Tab slug
33 *
34 * @var string $tab_slug
35 */
36 public $tab_slug = "wpf_tab" ;
37
38
39 public static function instance()
40 {
41 if (is_null(self::$_instance)) {
42 self::$_instance = new self();
43 }
44 return self::$_instance;
45 }
46
47
48 public function __construct()
49 {
50
51 if ( !class_exists('OxygenElement') ) {
52 return;
53 }
54 add_action('init', array($this, 'init_elements'));
55 add_action('oxygen_add_plus_sections', [$this, 'add_plus_sections']);
56
57 /* global_settings_tab */
58 add_action('oxygen_vsb_global_styles_tabs', [$this, 'global_settings_tab']);
59
60 /* oxygen_add_plus_{$id}_section_content */
61 add_action("oxygen_add_plus_" . $this->section_slug . "_section_content", [$this, 'add_plus_subsections_content']);
62 }
63
64 /**
65 * Check Post type and step Type
66 * Display elements for indivisual step type
67 */
68 public function wpfnl_oxygen_check_post_type() {
69 global $wp_query;
70 $step_id = $wp_query->post->ID;
71 $post_type = get_post_type($step_id);
72
73 if ( 'wpfunnel_steps' == $post_type){
74 if (Wpfnl_functions::check_if_this_is_step_type('landing') || Wpfnl_functions::check_if_this_is_step_type('custom')){
75 new NextStepButton();
76 new Optin();
77 }
78
79 if (Wpfnl_functions::check_if_this_is_step_type('checkout')){
80 new Checkout();
81 }
82 if (Wpfnl_functions::check_if_this_is_step_type('thankyou')){
83 new OrderDetails();
84 }
85 add_action('oxygen_add_plus_sections', [$this, 'add_plus_sections']);
86 }
87 }
88
89
90 public function init_elements() {
91
92 new NextStepButton();
93 new Checkout();
94 new OrderDetails();
95 new Optin();
96
97 // Add OfferButton only if Pro is not active
98 if ( ! Wpfnl_functions::is_wpfnl_pro_activated() ) {
99 require_once __DIR__ . '/elements/class-offer-button.php';
100 }
101 }
102
103
104 /**
105 * Add plus section
106 */
107 public function add_plus_sections() {
108 /* show a section in +Add dropdown menu and name it "My Custom Elements" */
109 CT_Toolbar::oxygen_add_plus_accordion_section($this->section_slug, __("WPFunnels","wpfnl"));
110 }
111
112
113 /**
114 * Add settings tab
115 */
116 public function global_settings_tab(){
117 global $oxygen_toolbar;
118 $oxygen_toolbar->settings_tab(__("Tab Label", 'wpfnl'), $this->tab_slug, "panelsection-icons/styles.svg");
119 }
120
121
122 /**
123 * Add plus subsections content
124 */
125 public function add_plus_subsections_content() {
126 do_action("oxygen_add_plus_" . $this->tab_slug . "_dynamic");
127 do_action("oxygen_add_plus_" . $this->tab_slug . "_other");
128 }
129 }
130