Admin
2 years ago
Assets
2 years ago
Pages
3 years ago
PostTypes
2 years ago
Shortcodes
2 years ago
Sitemap
2 years ago
Templates
2 years ago
Users
3 years ago
ActionsService.php
3 years ago
CompatibilityService.php
2 years ago
HealthService.php
2 years ago
LineItemStateService.php
2 years ago
PluginService.php
3 years ago
PluginServiceProvider.php
2 years ago
RecaptchaValidationService.php
2 years ago
StateService.php
2 years ago
ThemeService.php
2 years ago
ThemeServiceProvider.php
3 years ago
TranslationsServiceProvider.php
3 years ago
PluginServiceProvider.php
76 lines
| 1 | <?php |
| 2 | |
| 3 | namespace SureCart\WordPress; |
| 4 | |
| 5 | use SureCart\WordPress\PluginService; |
| 6 | use SureCart\WordPress\Sitemap\SitemapsService; |
| 7 | use SureCartCore\ServiceProviders\ServiceProviderInterface; |
| 8 | |
| 9 | /** |
| 10 | * Register plugin options. |
| 11 | */ |
| 12 | class PluginServiceProvider implements ServiceProviderInterface { |
| 13 | /** |
| 14 | * Register all dependencies in the IoC container. |
| 15 | * |
| 16 | * @param \Pimple\Container $container Service container. |
| 17 | * @return void |
| 18 | */ |
| 19 | public function register( $container ) { |
| 20 | $container['surecart.plugin'] = function( $c ) { |
| 21 | return new PluginService( $c[ SURECART_APPLICATION_KEY ] ); |
| 22 | }; |
| 23 | |
| 24 | $container['surecart.actions'] = function() { |
| 25 | return new ActionsService(); |
| 26 | }; |
| 27 | |
| 28 | $container['surecart.config.setting'] = function( $c ) { |
| 29 | return json_decode( json_encode( $c[ SURECART_CONFIG_KEY ] ) ); |
| 30 | }; |
| 31 | |
| 32 | $container['surecart.health'] = function() { |
| 33 | return new HealthService(); |
| 34 | }; |
| 35 | |
| 36 | $container['surecart.sitemaps'] = function() { |
| 37 | return new SitemapsService(); |
| 38 | }; |
| 39 | |
| 40 | $container['surecart.compatibility'] = function() { |
| 41 | return new CompatibilityService(); |
| 42 | }; |
| 43 | |
| 44 | $singleton = new StateService( [] ); |
| 45 | $container['surecart.initialstate'] = function() use ( $singleton ) { |
| 46 | return $singleton; |
| 47 | }; |
| 48 | |
| 49 | $app = $container[ SURECART_APPLICATION_KEY ]; |
| 50 | $app->alias( 'plugin', 'surecart.plugin' ); |
| 51 | $app->alias( 'actions', 'surecart.actions' ); |
| 52 | $app->alias( 'config', 'surecart.config.setting' ); |
| 53 | $app->alias( 'healthCheck', 'surecart.health' ); |
| 54 | $app->alias( 'state', 'surecart.initialstate' ); |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * {@inheritDoc} |
| 59 | */ |
| 60 | public function bootstrap( $container ) { |
| 61 | $container['surecart.sitemaps']->bootstrap(); |
| 62 | $container['surecart.health']->bootstrap(); |
| 63 | $container['surecart.compatibility']->bootstrap(); |
| 64 | $container['surecart.initialstate']->bootstrap(); |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * Load textdomain. |
| 69 | * |
| 70 | * @return void |
| 71 | */ |
| 72 | public function loadTextdomain() { |
| 73 | load_plugin_textdomain( 'surecart', false, basename( dirname( SURECART_PLUGIN_FILE ) ) . DIRECTORY_SEPARATOR . 'languages' ); |
| 74 | } |
| 75 | } |
| 76 |