PluginProbe
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell / 3.13.1
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell v3.13.1
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 2.8.17 2.8.18 All 259 releases
wpfunnels / includes / core / widgets / bricks / class-manager.php

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

124 lines 3.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Namespace declaration for the WPFunnels\Widgets\Bricks class.
4 */
5 namespace WPFunnels\Widgets\Bricks;
6 use WPFunnels\Wpfnl_functions;
7 require_once get_template_directory() . '/includes/helpers.php';
8
9 /**
10 * Class Manager
11 *
12 * This class represents the manager for the bricks widget in the WP Funnels plugin.
13 * It handles the creation and management of bricks.
14 *
15 * @package WPFunnels\Widgets\Bricks
16 */
17 class Manager {
18
19
20 /**
21 * Instance
22 *
23 * @since 3.1.0
24 *
25 * @access private
26 * @static
27 *
28 * @var Manager The single instance of the class.
29 */
30 private static $instance = null;
31
32 /**
33 * Instance
34 *
35 * Ensures only one instance of the class is loaded or can be loaded.
36 *
37 * @return Manager An instance of the class.
38 * @since 1.0.0
39 *
40 * @access public
41 * @static
42 */
43 public static function instance() {
44 if (is_null(self::$instance)) {
45 self::$instance = new self();
46 }
47 return self::$instance;
48 }
49
50 /**
51 * Constructor
52 *
53 * @since 3.1.0
54 *
55 * @access public
56 */
57 public function __construct() {
58
59 add_action('init', array($this, 'init'),11);
60 add_filter('wpfunnels/allow_to_change_page_template',[$this,'allow_to_change_page_template'],10);
61 }
62
63
64 /**
65 * Allows or disallows changing the page template for bricks.
66 *
67 * @param bool $is_allow Whether to allow changing the page template.
68 */
69 public function allow_to_change_page_template( $is_allow ){
70 if( Wpfnl_functions::maybe_bricks_theme()){
71 $is_allow = false;
72 }
73 return $is_allow;
74 }
75
76
77 /**
78 * Register checkout elements for bricks
79 *
80 * @since 3.1.0
81 *
82 * @access public
83 */
84 public function init() {
85 $elements = [
86 [
87 'file' => __DIR__. '/NextStep.php',
88 'class' => '\WPFunnels\Widgets\Bricks\NextStep',
89 ],
90 [
91 'file' => __DIR__. '/OrderDetailsWidget.php',
92 'class' => '\WPFunnels\Widgets\Bricks\OrderDetailsWidget',
93 ],
94
95 [
96 'file' => __DIR__. '/Optin.php',
97 'class' => '\WPFunnels\Widgets\Bricks\Optin',
98 ],
99 [
100 'file' => __DIR__. '/Checkout.php',
101 'class' => '\WPFunnels\Widgets\Bricks\Checkout',
102 ]
103 ];
104
105 // Add OfferButton only if Pro is not active
106 if ( ! Wpfnl_functions::is_wpfnl_pro_activated() ) {
107 $elements[] = [
108 'file' => __DIR__. '/class-offer-button.php',
109 'class' => '\WPFunnels\Widgets\Bricks\OfferButton',
110 ];
111 }
112
113 $elements = apply_filters('wpfunels/bricks_elements', $elements );
114 if ( class_exists( '\Bricks\Elements' ) ) {
115 foreach ( $elements as $element ) {
116 \Bricks\Elements::register_element( $element['file'] );
117 }
118 }
119
120 }
121
122 }
123
124 Manager::instance();