-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinertia-wordpress.php
41 lines (33 loc) · 1.03 KB
/
inertia-wordpress.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
<?php
/*
* Plugin Name: Inertia Wordpress
* Description: Connect an Inertia frontend theme to your Wordpress application, based on Inertia Laravel 2.0.0
* Version: 0.7.0
* Requires at least: 6.0
* Requires PHP: 8.2
* Tested up to: 6.7
* Author: Evo Mark Ltd
* License: apache2
* License URI: https://directory.fsf.org/wiki/License:Apache2.0
* Text Domain: inertia-wordpress
*/
use EvoMark\InertiaWordpress\Container;
use EvoMark\InertiaWordpress\Plugin;
$dir = get_option('inertia-wordpress__autoload-path', __DIR__);
$autoloaded = false;
while ($dir !== '/') {
$autoloadPath = $dir . '/vendor/autoload.php';
if (file_exists($autoloadPath)) {
require_once $autoloadPath;
update_option('inertia-wordpress__autoload-path', $dir);
$autoloaded = true;
break;
}
$dir = dirname($dir);
}
if ($autoloaded === false) {
throw new RuntimeException('No autoload.php file was found');
}
$container = Container::getInstance();
$plugin = $container->get(Plugin::class);
$plugin->setup(__FILE__);