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