PluginProbe
Gutenify – Visual Site Builder Blocks & Starter Templates / trunk
Gutenify – Visual Site Builder Blocks & Starter Templates vtrunk
1.7.0 1.6.6 1.6.5 1.6.4 trunk 0.0.1 0.0.2 0.0.3 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 All 72 releases
gutenify / core / inc / bootstrap.php

bootstrap.php in Gutenify – Visual Site Builder Blocks & Starter Templates trunk, at core/inc/bootstrap.php

128 lines 3.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Bootstrap file to initialize and load all required dependencies and core functionality.
4 *
5 * This file serves as the entry point to include necessary files and set up the environment for the LIGER Lite plugin/theme.
6 *
7 * @package gutenify
8 */
9
10 /**
11 * Prevent direct access to the file.
12 *
13 * Ensures this file is being loaded within the WordPress environment.
14 */
15 defined( 'ABSPATH' ) || exit;
16
17 /**
18 * Load the Helpers class file containing utility methods.
19 */
20 require_once __DIR__ . '/helpers/class-helpers.php';
21
22 /**
23 * List of PHP files to be required for initializing core functionality.
24 *
25 * @var string[] Array of relative file paths.
26 */
27 $required_files = array(
28
29 // Core helpers and utilities.
30 'inc/helpers/helpers.php',
31 'inc/helpers/class-style-helpers.php',
32 'inc/helpers/class-dynamic-styles.php',
33 'inc/helpers/class-typography-helpers.php',
34 'inc/depricated/styles.php', // [TODO: Depricated].
35 'inc/class-assets.php',
36 'inc/helpers/class-post-list.php',
37 'inc/depricated/helpers/typography-helpers.php', // [TODO: Depricated].
38
39 // WooCommerce support.
40 'inc/helpers/woocommerce-template-functions.php',
41
42 // Gutenberg block handling.
43 'inc/blocks/class-blocks-categories.php',
44 'inc/blocks/class-block-inline-styles.php',
45 'inc/blocks/class-block-assets.php',
46 'inc/blocks/class-block-editor-assets.php',
47 'inc/blocks/class-extend-attributes.php',
48 'inc/blocks/class-fix-third-party-block-issues.php',
49 'inc/blocks/class-dynamic-block-classname.php',
50 'inc/blocks/class-slider-blocks.php',
51 'inc/blocks/class-editor-control.php',
52
53 // Template and site structure management.
54 'inc/frontend/class-global-code.php',
55
56 // REST API endpoints.
57 'inc/rest-api/class-rest.php',
58 'inc/rest-api/class-rest-demo-importer-v2.php',
59
60 // Demo importing tools.
61 // 'inc/depricated/demo-importer.php', // [TODO: Depricated].
62
63 // Admin interface and backend logic.
64 'inc/admin/class-menu.php',
65 'inc/admin/class-demo-importer-v2.php',
66 'inc/admin/class-register-templates-post-type.php',
67
68 // Interface definitions and wrappers.
69 'inc/depricated/interfaces/class-main-class-wrapper.php', // [TODO: depricated]
70
71 // React-based non-block components and admin pages.
72 'dist/non-blocks/components/index.php',
73
74
75 // Block editor extensions.
76 'dist/non-blocks/extend/toolbar-templates-button/index.php',
77 'dist/non-blocks/extend/custom-list/index.php',
78 'dist/non-blocks/extend/block-custom-css/index.php',
79 'dist/non-blocks/extend/sliders/index.php',
80 'dist/non-blocks/extend/aos/index.php',
81
82 // Admin page interfaces.
83 'dist/non-blocks/admin/pages/getting-started/index.php',
84 'dist/non-blocks/admin/pages/settings/index.php',
85 'dist/non-blocks/admin/rating-notice/index.php',
86
87 // Optionally excluded files for future use.
88 /**
89 * 'dist/non-blocks/extend/save-template/index.php',
90 * 'dist/non-blocks/extend/responsive-display-control/index.php',
91 * 'dist/non-blocks/extend/masonry/index.php',
92 */
93 );
94
95 // Import the Helpers class to simplify references.
96 use gutenify\Helpers;
97
98 // Get the base directory path where block files are located.
99 $base_dir = GUTENIFY_BASE_DIR . 'core/';
100
101 // Loop through the list of required file paths.
102 foreach ( $required_files as $file ) {
103 // Build the full path to the file by prepending the base directory.
104 $full_path = wp_normalize_path( $base_dir . $file );
105
106 // Check if the file exists and is a regular file before including it.
107 if ( is_file( $full_path ) ) {
108 // Include the file only once to prevent redeclaration errors.
109 require_once $full_path;
110 }
111 }
112
113 // Retrieve the list of active blocks that need to be loaded.
114 $active_blocks = Helpers::active_blocks();
115
116 if ( ! empty( $active_blocks ) ) {
117 // Loop through each active block and include its index.php file if it exists.
118 foreach ( $active_blocks as $block ) {
119 // Build the full path to the block's index.php file.
120 $file = wp_normalize_path( "{$base_dir}dist/blocks/{$block}/index.php" );
121
122 // Include the file only if it exists and is a regular file.
123 if ( is_file( $file ) ) {
124 require_once $file;
125 }
126 }
127 }
128