PluginProbe
WowAddons – Product Addons and Product Options With Custom Fields / trunk
WowAddons – Product Addons and Product Options With Custom Fields vtrunk
1.7.2 1.7.1 1.7.0 1.6.21 1.6.20 1.6.19 1.6.18 1.6.17 1.6.16 1.6.15 1.6.14 1.6.13 1.6.12 1.6.11 1.6.10 1.6.9 1.6.8 1.6.7 1.6.6 1.5.10 1.5.11 1.5.2 1.5.3 1.5.4 1.5.5 All 57 releases
product-addons / includes / blocks / class-blocks-bootstrap.php

class-blocks-bootstrap.php in WowAddons – Product Addons and Product Options With Custom Fields trunk, at includes/blocks/class-blocks-bootstrap.php

97 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Blocks Bootstrap Class
4 *
5 * @package PRAD
6 * @since 1.0.0
7 */
8
9 namespace PRAD\Includes\Blocks;
10
11 defined( 'ABSPATH' ) || exit;
12
13 /**
14 * Bootstrap class to initialize the blocks system
15 */
16 class Blocks_Bootstrap {
17
18 /**
19 * Instance of this class
20 *
21 * @var self
22 */
23 private static $instance = null;
24
25 /**
26 * Block system initialized flag
27 *
28 * @var bool
29 */
30 private bool $initialized = false;
31
32 /**
33 * Get singleton instance
34 *
35 * @return self
36 */
37 public static function get_instance(): self {
38 if ( null === self::$instance ) {
39 self::$instance = new self();
40 }
41
42 return self::$instance;
43 }
44
45 /**
46 * Private constructor to prevent direct instantiation
47 */
48 private function __construct() {
49 $this->init();
50 }
51
52 /**
53 * Initialize the blocks system
54 */
55 public function init(): void {
56 if ( $this->initialized ) {
57 return;
58 }
59
60 // Initialize main render blocks class.
61 $this->init_render_blocks();
62
63 $this->initialized = true;
64
65 do_action( 'prad_blocks_bootstrap_initialized' );
66 }
67
68
69 /**
70 * Initialize main render blocks controller
71 */
72 private function init_render_blocks(): void {
73 if ( class_exists( 'PRAD\Includes\Blocks\Render_Product_Fields' ) ) {
74 new Render_Product_Fields();
75 }
76 }
77
78
79 /**
80 * Get initialization status
81 *
82 * @return bool
83 */
84 public function is_initialized(): bool {
85 return $this->initialized;
86 }
87
88
89 /**
90 * Force re-initialization (useful for testing)
91 */
92 public function force_reinit(): void {
93 $this->initialized = false;
94 $this->init();
95 }
96 }
97