PluginProbe
Core Framework / 2.0.1
Core Framework v2.0.1
2.0.2 2.0.1 2.0.0 1.10.4 trunk 1.10.0 1.10.1 1.10.2 1.10.3 1.3.10 1.4.0 1.4.1 1.4.2 1.5.0 1.5.1 1.5.1.1 1.5.2 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.7.0 1.7.1 1.8.0 All 32 releases
core-framework / core-framework.php

core-framework.php in Core Framework 2.0.1, at core-framework.php

139 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 /**
4 * @package CoreFramework
5 * @author Core Framework <hello@coreframework.com>
6 * @copyright 2026 David Babinec
7 * @license MIT
8 * @link https://coreframework.com
9 *
10 * Plugin Name: Core Framework
11 * Plugin URI: https://coreframework.com
12 * Description: The CORE of your website
13 * Version: 2.0.1
14 * Author: Core Framework
15 * Author URI: https://coreframework.com
16 * Text Domain: core-framework
17 * Domain Path: /languages
18 * License: MIT
19 * License URI: https://opensource.org/license/mit
20 * Requires PHP: 8.0
21 * Requires at least: 6.0
22 * Namespace: CoreFramework
23 */
24
25 declare(strict_types=1);
26
27 use CoreFramework\Common\Functions;
28 use CoreFramework\Config\Setup;
29 use CoreFramework\Scaffold;
30
31 if ( ! defined( 'ABSPATH' ) ) {
32 exit();
33 }
34
35 define( 'CORE_FRAMEWORK_ABSOLUTE', __FILE__ );
36 define( 'CORE_FRAMEWORK_MAIN_FILE', plugin_basename( __FILE__ ) );
37 define( 'CORE_FRAMEWORK_DIR_ROOT', plugin_dir_path( __FILE__ ) );
38 define( 'CORE_FRAMEWORK_DIR_URL', plugin_dir_url( __FILE__ ) );
39
40 define( 'CORE_FRAMEWORK_NAME', dirname( CORE_FRAMEWORK_MAIN_FILE ) );
41
42 define( 'CORE_FRAMEWORK_DB_VER', '1.3' );
43 define( 'CORE_FRAMEWORK_VERSION', '2.0.1' );
44
45 define( 'CORE_FRAMEWORK_ASSETS_PREFIX', 'core-framework/core-framework/' );
46
47 $core_framework_autoloader = require CORE_FRAMEWORK_DIR_ROOT . 'vendor/autoload.php';
48
49 if ( ! wp_installing() ) {
50 register_activation_hook( __FILE__, array( Setup::class, 'activation' ) );
51 register_deactivation_hook( __FILE__, array( Setup::class, 'deactivation' ) );
52 register_uninstall_hook( __FILE__, array( Setup::class, 'uninstall' ) );
53
54 add_action( 'admin_init', array( Setup::class, 'on_plugin_update_completed' ), 10, 2 );
55 }
56
57 if ( ! class_exists( '\\' . Scaffold::class ) ) {
58 wp_die( esc_html__( 'Core Framework is unable to find the Scaffold class.', 'core-framework' ) );
59 }
60
61 /**
62 * Declare compatibility with WooCommerce features.
63 * Core Framework doesn't interact with WooCommerce, so it's fully compatible.
64 */
65 add_action(
66 'before_woocommerce_init',
67 function () {
68 if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) {
69 \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
70 \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'cart_checkout_blocks', __FILE__, true );
71 }
72 }
73 );
74
75 add_action(
76 'plugins_loaded',
77 function () use ( $core_framework_autoloader ): void {
78 try {
79 new Scaffold( $core_framework_autoloader );
80 } catch ( Exception $e ) {
81 wp_die( esc_html__( 'Core Framework is unable to run the Scaffold class.', 'core-framework' ) );
82 }
83 }
84 );
85
86 add_action( 'wp_initialize_site', array( Setup::class, 'on_new_multi_site_blog' ), 999, 2 );
87 add_action( 'admin_notices', 'core_framework_update_notices' );
88
89 function core_framework_update_notices() {
90 if ( ! get_transient( 'core-framework-update-notice' ) ) {
91 return;
92 }
93 ?>
94 <div class="updated notice is-dismissible">
95 <p><?php esc_html_e( 'Core Framework has been installed. Please save changes in Core Framework to update your stylesheet.', 'core-framework' ); ?></p>
96 </div>
97 <?php
98 delete_transient( 'core-framework-update-notice' );
99 }
100
101 /**
102 * Create a main function for external uses
103 *
104 * @return Functions
105 * @since 0.0.0
106 */
107 function CoreFramework(): Functions {
108 return new Functions();
109 }
110
111 /**
112 * Create a Oxygen function for external uses
113 *
114 * @since 0.0.0
115 */
116 function CoreFrameworkOxygen(): \CoreFramework\App\Oxygen\Functions {
117 return new \CoreFramework\App\Oxygen\Functions();
118 }
119
120 /**
121 * Create a Bricks function for external uses
122 *
123 * @since 0.0.1
124 */
125 function CoreFrameworkBricks(): \CoreFramework\App\Bricks\Functions {
126 return new \CoreFramework\App\Bricks\Functions();
127 }
128
129 /**
130 * Create a Gutenberg function for external uses
131 *
132 * @since 1.0.0
133 */
134 function CoreFrameworkGutenberg(): \CoreFramework\App\Gutenberg\Functions {
135 return new \CoreFramework\App\Gutenberg\Functions();
136 }
137
138 CoreFrameworkGutenberg()->init();
139