-
Notifications
You must be signed in to change notification settings - Fork 2
/
yourplugin.php
47 lines (41 loc) · 1.11 KB
/
yourplugin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
/**
* Plugin Name: Your Plugin
* Author: Your Company
* Author URI: https://www.yourcompany.com
* Description: This is a description of your plugin.
* Version: 1.0.0
* Requires PHP: 8.1
*/
use Dotenv\Dotenv;
use Roots\Acorn\Bootloader;
use Roots\WPConfig\Config;
/**
* Require dependencies
*/
require_once plugin_dir_path(__FILE__).'vendor/autoload.php';
/**
* Load env vars
*/
$dotenv = Dotenv::createUnsafeImmutable(__DIR__.'/src', '.env', false);
if (file_exists(__DIR__ . '/src/.env')) {
$dotenv->load();
}
/**
* Set up configuration
*/
Config::define('ACORN_BASEPATH', rtrim(plugin_dir_path(__FILE__).'src', '/'));
Config::define('WP_ENV', env('APP_ENV', 'production'));
Config::define('YOUR_PLUGIN_FILE', __FILE__);
Config::define('YOUR_PLUGIN_URL', plugin_dir_url(__FILE__));
Config::apply();
/**
* Acorn config
*/
//putenv('APP_RUNNING_IN_CONSOLE=false'); // Uncomment to disable console mode in production. When console mode is enabled, the WP-Cron will not work.
putenv('ACORN_ENABLE_EXPIRIMENTAL_ROUTER=true');
/**
* Boot Acorns
*/
$instance = Bootloader::getInstance();
$instance->boot();