PluginProbe ʕ •ᴥ•ʔ
FrontBlocks for Gutenberg/GeneratePress / 1.5.1
FrontBlocks for Gutenberg/GeneratePress v1.5.1
1.5.2 1.5.1 1.4.0 1.5.0 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 6 days ago Frontend 6 days ago Plugin_Main.php 6 days ago
Plugin_Main.php
203 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 if ( ! class_exists( 'FrontBlocks\Admin\ReviewNotice' ) ) {
79 require_once FRBL_PLUGIN_PATH . 'includes/Admin/ReviewNotice.php';
80 }
81 new Admin\ReviewNotice();
82 }
83
84 // Container Edge Alignment for GenerateBlocks.
85 new Frontend\ContainerEdgeAlignment();
86
87 // Carousel module.
88 new Frontend\Carousel();
89
90 // Animations module.
91 new Frontend\Animations();
92
93 // Sticky Column module.
94 new Frontend\StickyColumn();
95
96 // Gallery module.
97 new Frontend\Gallery();
98
99 // Insert Post Block module.
100 new Frontend\InsertPost();
101
102 // Testimonials module (includes settings).
103 new Frontend\Testimonials();
104
105 // Headline module (GenerateBlocks Headline enhancements).
106 new Frontend\Headline();
107
108 // Product Categories module (WooCommerce) — only when WooCommerce is active.
109 if ( class_exists( 'WooCommerce' ) ) {
110 new Frontend\ProductCategories();
111 }
112
113 // Counter module (GenerateBlocks Headline counter effect).
114 new Frontend\Counter();
115
116 // Reading Time module.
117 new Frontend\ReadingTime();
118
119 // Reading Progress Bar module.
120 new Frontend\ReadingProgress();
121
122 // Back Button module.
123 new Frontend\BackButton();
124
125 // Scroll to Top module.
126 new Frontend\ScrollTop();
127
128 // Events module.
129 new Frontend\Events();
130
131 // Shape Animations module (for GenerateBlocks Shape block).
132 new Frontend\ShapeAnimations();
133
134 // Gravity Forms Inline Layout module.
135 new Frontend\GravityFormsInline();
136
137 // Fluid Typography module (GeneratePress Pro integration).
138 new Frontend\FluidTypography();
139
140 // Stacked Images module.
141 new Frontend\StackedImages();
142
143 // Block Patterns module (WordPress block patterns registration).
144 new Frontend\BlockPatterns();
145
146 // FAQ Schema module (FAQPage JSON-LD for core/details and GB accordion).
147 new Frontend\FaqSchema();
148
149 // Text Animation block.
150 new Frontend\TextAnimation();
151
152 // Before After comparison block.
153 new Frontend\BeforeAfter();
154
155 // SVG Upload module (allows SVG files in the media library).
156 new Frontend\SvgUpload();
157
158 // Columns Same Height module (equal-height columns for native columns block).
159 new Frontend\ColumnsSameHeight();
160
161 // Download Button module (download option for the native button block).
162 new Frontend\DownloadButton();
163
164 // Maintenance Mode module.
165 new Frontend\Maintenance();
166
167 // Cookie Notice module.
168 new Frontend\CookieNotice();
169
170 // User Text block is provided by FrontBlocks Pro when license is active.
171 }
172
173 /**
174 * Register scripts for conditional enqueueing.
175 *
176 * @return void
177 */
178 public function register_scripts() {
179 wp_register_style(
180 'frontblocks-carousel',
181 FRBL_PLUGIN_URL . 'assets/carousel/frontblocks-carousel.css',
182 array(),
183 FRBL_VERSION
184 );
185
186 wp_register_script(
187 'frontblocks-carousel',
188 FRBL_PLUGIN_URL . 'assets/carousel/glide.min.js',
189 array(),
190 FRBL_VERSION,
191 true
192 );
193
194 wp_register_script(
195 'frontblocks-carousel-custom',
196 FRBL_PLUGIN_URL . 'assets/carousel/frontblocks-carousel.js',
197 array( 'frontblocks-carousel' ),
198 FRBL_VERSION,
199 true
200 );
201 }
202 }
203