1 | <?php |
||
2 | /** |
||
3 | * WP Steak |
||
4 | * |
||
5 | * @package App |
||
6 | * |
||
7 | * Plugin Name: WP Steak |
||
8 | * Description: A fully structured plugin. |
||
9 | * Version: 2.1.0 |
||
10 | * Author: Apiki |
||
11 | * Author URI: https://apiki.com/ |
||
12 | * Text Domain: app |
||
13 | * Domain Path: /languages |
||
14 | * Requires PHP: 7.1 |
||
15 | */ |
||
16 | |||
17 | use Cedaro\WP\Plugin\PluginFactory; |
||
18 | |||
19 | if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) { |
||
20 | require __DIR__ . '/vendor/autoload.php'; |
||
21 | } |
||
22 | |||
23 | /** |
||
24 | * Retrieve the main plugin instance. |
||
25 | * |
||
26 | * @return \Cedaro\WP\Plugin |
||
27 | */ |
||
28 | function wpsteak() { |
||
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() |
||
43 | ); |
||
44 | |||
45 | $plugin = wpsteak(); |
||
0 ignored issues
–
show
introduced
by
![]() |
|||
46 | |||
47 | $plugin->set_container( $container ); |
||
48 | $plugin->register_hooks( $container->get( Cedaro\WP\Plugin\Provider\I18n::class ) ); |
||
49 | $plugin->register_hooks( $container->get( WPSteak\Providers\I18n::class ) ); |
||
50 | |||
51 | $config = ( require __DIR__ . '/config.php' ); |
||
52 | |||
53 | foreach ( $config['service_providers'] as $service_provider ) { |
||
54 | $container->addServiceProvider( $service_provider ); |
||
55 | } |
||
56 | |||
57 | foreach ( $config['hook_providers'] as $hook_provider ) { |
||
58 | $plugin->register_hooks( $container->get( $hook_provider ) ); |
||
59 | } |
||
60 |