-
Notifications
You must be signed in to change notification settings - Fork 5
/
wpsteak.php
60 lines (47 loc) · 1.4 KB
/
wpsteak.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
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php declare(strict_types = 1);
/**
* WP Steak
*
* @package App
*
* Plugin Name: WP Steak
* Description: A fully structured plugin.
* Version: 3.0.1
* Author: Apiki
* Author URI: https://apiki.com/
* Text Domain: app
* Domain Path: /languages
* Requires PHP: 7.4
*/
use Cedaro\WP\Plugin\Plugin;
use Cedaro\WP\Plugin\PluginFactory;
if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) {
require __DIR__ . '/vendor/autoload.php';
}
/**
* Retrieve the main plugin instance.
*/
function wpsteak(): Plugin {
static $instance;
if ( null === $instance ) {
$instance = PluginFactory::create( 'app' );
}
return $instance;
}
$container = new League\Container\Container();
/* register the reflection container as a delegate to enable auto wiring. */
$container->delegate(
( new League\Container\ReflectionContainer() )->cacheResolutions(),
);
// phpcs:ignore WordPress.WP.GlobalVariablesOverride
$plugin = wpsteak();
$plugin->set_container( $container );
$plugin->register_hooks( $container->get( Cedaro\WP\Plugin\Provider\I18n::class ) );
$plugin->register_hooks( $container->get( WPSteak\Providers\I18n::class ) );
$config = ( require __DIR__ . '/config.php' );
foreach ( $config['service_providers'] as $service_provider ) {
$container->addServiceProvider( $service_provider );
}
foreach ( $config['hook_providers'] as $hook_provider ) {
$plugin->register_hooks( $container->get( $hook_provider ) );
}