1 | <?php declare(strict_types = 1); |
||
0 ignored issues
–
show
introduced
by
![]() |
|||
2 | |||
3 | /** |
||
4 | * WP Steak |
||
5 | * |
||
6 | * @package App |
||
7 | * |
||
8 | * Plugin Name: WP Steak |
||
9 | * Description: A fully structured plugin. |
||
10 | * Version: 3.0.1 |
||
11 | * Author: Apiki |
||
12 | * Author URI: https://apiki.com/ |
||
13 | * Text Domain: app |
||
14 | * Domain Path: /languages |
||
15 | * Requires PHP: 7.4 |
||
16 | */ |
||
17 | |||
18 | use Cedaro\WP\Plugin\Plugin; |
||
19 | use Cedaro\WP\Plugin\PluginFactory; |
||
20 | |||
21 | if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) { |
||
22 | require __DIR__ . '/vendor/autoload.php'; |
||
23 | } |
||
24 | |||
25 | /** |
||
26 | * Retrieve the main plugin instance. |
||
27 | */ |
||
28 | function wpsteak(): Plugin { |
||
29 | static $instance; |
||
30 | |||
31 | if ( null === $instance ) { |
||
32 | $instance = PluginFactory::create( 'app' ); |
||
33 | } |
||
34 | |||
35 | return $instance; |
||
36 | } |
||
37 | |||
38 | $container = new League\Container\Container(); |
||
39 | |||
40 | /* register the reflection container as a delegate to enable auto wiring. */ |
||
41 | $container->delegate( |
||
42 | ( new League\Container\ReflectionContainer() )->cacheResolutions(), |
||
0 ignored issues
–
show
|
|||
43 | ); |
||
44 | |||
45 | // phpcs:ignore WordPress.WP.GlobalVariablesOverride |
||
46 | $plugin = wpsteak(); |
||
47 | |||
48 | $plugin->set_container( $container ); |
||
49 | $plugin->register_hooks( $container->get( Cedaro\WP\Plugin\Provider\I18n::class ) ); |
||
50 | $plugin->register_hooks( $container->get( WPSteak\Providers\I18n::class ) ); |
||
51 | |||
52 | $config = ( require __DIR__ . '/config.php' ); |
||
53 | |||
54 | foreach ( $config['service_providers'] as $service_provider ) { |
||
55 | $container->addServiceProvider( $service_provider ); |
||
56 | } |
||
57 | |||
58 | foreach ( $config['hook_providers'] as $hook_provider ) { |
||
59 | $plugin->register_hooks( $container->get( $hook_provider ) ); |
||
60 | } |
||
61 |