PluginProbe ʕ •ᴥ•ʔ
FrontBlocks for Gutenberg/GeneratePress / trunk
FrontBlocks for Gutenberg/GeneratePress vtrunk
trunk 0.2.0 0.2.1 0.2.2 0.2.3 0.2.4 0.2.5 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.1.0 1.2.0 1.2.1 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 ci-artifacts
frontblocks / includes / Plugin_Main.php
frontblocks / includes Last commit date
Admin 1 week ago Frontend 1 week ago Plugin_Main.php 1 week ago
Plugin_Main.php
189 lines
1 <?php
2 /**
3 * Plugin Main
4 *
5 * @package FrontBlocks
6 * @author Closemarketing
7 * @copyright 2025 Closemarketing
8 * @version 1.0.3
9 */
10
11 namespace FrontBlocks;
12
13 defined( 'ABSPATH' ) || exit;
14
15 /**
16 * Main FrontBlocks class.
17 *
18 * @since 1.0.0
19 */
20 class Plugin_Main {
21 /**
22 * Plugin instance.
23 *
24 * @var FrontBlocks
25 */
26 private static $instance = null;
27
28 /**
29 * Get plugin instance.
30 *
31 * @return FrontBlocks
32 */
33 public static function get_instance() {
34 if ( null === self::$instance ) {
35 self::$instance = new self();
36 }
37
38 return self::$instance;
39 }
40
41 /**
42 * Constructor.
43 */
44 private function __construct() {
45 $this->init();
46 }
47
48 /**
49 * Initialize the plugin.
50 *
51 * @return void
52 */
53 private function init() {
54 // Load modules.
55 $this->load_modules();
56
57 // Register scripts for conditional enqueueing.
58 add_action( 'init', array( $this, 'register_scripts' ) );
59 }
60
61 /**
62 * Load plugin modules.
63 *
64 * @return void
65 */
66 private function load_modules() {
67 // Admin settings page.
68 if ( is_admin() ) {
69 // Load Admin classes if autoloader is not available.
70 if ( ! class_exists( 'FrontBlocks\Admin\UI' ) ) {
71 require_once FRBL_PLUGIN_PATH . 'includes/Admin/UI.php';
72 }
73 if ( ! class_exists( 'FrontBlocks\Admin\Settings' ) ) {
74 require_once FRBL_PLUGIN_PATH . 'includes/Admin/Settings.php';
75 }
76 new Admin\Settings();
77 }
78
79 // Container Edge Alignment for GenerateBlocks.
80 new Frontend\ContainerEdgeAlignment();
81
82 // Carousel module.
83 new Frontend\Carousel();
84
85 // Animations module.
86 new Frontend\Animations();
87
88 // Sticky Column module.
89 new Frontend\StickyColumn();
90
91 // Gallery module.
92 new Frontend\Gallery();
93
94 // Insert Post Block module.
95 new Frontend\InsertPost();
96
97 // Testimonials module (includes settings).
98 new Frontend\Testimonials();
99
100 // Headline module (GenerateBlocks Headline enhancements).
101 new Frontend\Headline();
102
103 // Product Categories module (WooCommerce) — only when WooCommerce is active.
104 if ( class_exists( 'WooCommerce' ) ) {
105 new Frontend\ProductCategories();
106 }
107
108 // Counter module (GenerateBlocks Headline counter effect).
109 new Frontend\Counter();
110
111 // Reading Time module.
112 new Frontend\ReadingTime();
113
114 // Reading Progress Bar module.
115 new Frontend\ReadingProgress();
116
117 // Back Button module.
118 new Frontend\BackButton();
119
120 // Events module.
121 new Frontend\Events();
122
123 // Shape Animations module (for GenerateBlocks Shape block).
124 new Frontend\ShapeAnimations();
125
126 // Gravity Forms Inline Layout module.
127 new Frontend\GravityFormsInline();
128
129 // Fluid Typography module (GeneratePress Pro integration).
130 new Frontend\FluidTypography();
131
132 // Stacked Images module.
133 new Frontend\StackedImages();
134
135 // Block Patterns module (WordPress block patterns registration).
136 new Frontend\BlockPatterns();
137
138 // FAQ Schema module (FAQPage JSON-LD for core/details and GB accordion).
139 new Frontend\FaqSchema();
140
141 // Text Animation block.
142 new Frontend\TextAnimation();
143
144 // Before After comparison block.
145 new Frontend\BeforeAfter();
146
147 // SVG Upload module (allows SVG files in the media library).
148 new Frontend\SvgUpload();
149
150 // Columns Same Height module (equal-height columns for native columns block).
151 new Frontend\ColumnsSameHeight();
152
153 // Download Button module (download option for the native button block).
154 new Frontend\DownloadButton();
155
156 // User Text block is provided by FrontBlocks Pro when license is active.
157 }
158
159 /**
160 * Register scripts for conditional enqueueing.
161 *
162 * @return void
163 */
164 public function register_scripts() {
165 wp_register_style(
166 'frontblocks-carousel',
167 FRBL_PLUGIN_URL . 'assets/carousel/frontblocks-carousel.css',
168 array(),
169 FRBL_VERSION
170 );
171
172 wp_register_script(
173 'frontblocks-carousel',
174 FRBL_PLUGIN_URL . 'assets/carousel/glide.min.js',
175 array(),
176 FRBL_VERSION,
177 true
178 );
179
180 wp_register_script(
181 'frontblocks-carousel-custom',
182 FRBL_PLUGIN_URL . 'assets/carousel/frontblocks-carousel.js',
183 array( 'frontblocks-carousel' ),
184 FRBL_VERSION,
185 true
186 );
187 }
188 }
189