PluginProbe
Core Framework / 1.10.3
Core Framework v1.10.3
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 1.10.3, at core-framework.php

138 lines 4.1 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 2023 Core Framework
7 * @license EULA + GPLv2
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: 1.10.3
14 * Author: Core Framework
15 * Author URI: https://coreframework.com
16 * Text Domain: core-framework
17 * Domain Path: /languages
18 * License: GPLv2
19 * License URI: https://coreframework.com/eula + https://www.gnu.org/licenses/gpl-2.0.html
20 * Requires PHP: 8.0
21 * Requires WP: 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', '1.10.3' );
44
45 define( 'CORE_FRAMEWORK_EDD_STORE_URL', 'https://edd.coreframework.com' );
46 define( 'CORE_FRAMEWORK_FREE_ITEM_ID', 40 );
47
48 define( 'CORE_FRAMEWORK_ASSETS_PREFIX', 'core-framework/core-framework/' );
49
50 $core_framework_autoloader = require CORE_FRAMEWORK_DIR_ROOT . 'vendor/autoload.php';
51
52 if ( ! wp_installing() ) {
53 register_activation_hook( __FILE__, array( Setup::class, 'activation' ) );
54 register_deactivation_hook( __FILE__, array( Setup::class, 'deactivation' ) );
55 register_uninstall_hook( __FILE__, array( Setup::class, 'uninstall' ) );
56
57 add_action( 'admin_init', array( Setup::class, 'on_plugin_update_completed' ), 10, 2 );
58 }
59
60 if ( ! class_exists( '\\' . Scaffold::class ) ) {
61 wp_die( __( 'Core Framework is unable to find the Scaffold class.', 'core-framework' ) );
62 }
63
64 /**
65 * Declare compatibility with WooCommerce features.
66 * Core Framework doesn't interact with WooCommerce, so it's fully compatible.
67 */
68 add_action( 'before_woocommerce_init', function () {
69 if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) {
70 \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
71 \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'cart_checkout_blocks', __FILE__, true );
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( __( '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 ?>
92 <div class="updated notice is-dismissible">
93 <p>Core Framework has been installed. Please save changes in Core Framework plugin to update your stylesheet.</p>
94 </div>
95 <?php
96 delete_transient( 'core-framework-update-notice' );
97 }
98 }
99
100 /**
101 * Create a main function for external uses
102 *
103 * @return Functions
104 * @since 0.0.0
105 */
106 function CoreFramework(): Functions {
107 return new Functions();
108 }
109
110 /**
111 * Create a Oxygen function for external uses
112 *
113 * @since 0.0.0
114 */
115 function CoreFrameworkOxygen(): \CoreFramework\App\Oxygen\Functions {
116 return new \CoreFramework\App\Oxygen\Functions();
117 }
118
119 /**
120 * Create a Bricks function for external uses
121 *
122 * @since 0.0.1
123 */
124 function CoreFrameworkBricks(): \CoreFramework\App\Bricks\Functions {
125 return new \CoreFramework\App\Bricks\Functions();
126 }
127
128 /**
129 * Create a Gutenberg function for external uses
130 *
131 * @since 1.0.0
132 */
133 function CoreFrameworkGutenberg(): \CoreFramework\App\Gutenberg\Functions {
134 return new \CoreFramework\App\Gutenberg\Functions();
135 }
136
137 CoreFrameworkGutenberg()->init();
138