PluginProbe
SureCart – Ecommerce Made Easy For Selling Physical Products, Digital Downloads, Subscriptions, Donations, & Payments / 4.3.3
SureCart – Ecommerce Made Easy For Selling Physical Products, Digital Downloads, Subscriptions, Donations, & Payments v4.3.3
4.7.2 4.7.1 4.7.0 4.6.6 4.6.5 4.6.4 4.6.3 4.6.2 4.6.1 4.6.0 4.5.1 4.5.0 4.4.2 4.4.1 4.4.0 4.3.3 4.3.2 4.3.1 4.3.0 4.2.3 4.2.2 4.2.1 1.0.3 1.0.4 1.0.5 All 281 releases
surecart / app / src / WordPress / PluginServiceProvider.php
PluginServiceProvider.php
90 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace SureCart\WordPress;
4
5 use SureCart\WordPress\PluginService;
6 use SureCart\WordPress\UpgradeNoticeService;
7 use SureCart\WordPress\PluginActionLinksService;
8 use SureCartCore\ServiceProviders\ServiceProviderInterface;
9
10 /**
11 * Register plugin options.
12 */
13 class PluginServiceProvider implements ServiceProviderInterface {
14 /**
15 * Register all dependencies in the IoC container.
16 *
17 * @param \Pimple\Container $container Service container.
18 * @return void
19 */
20 public function register( $container ) {
21 $container['surecart.plugin'] = function ( $c ) {
22 return new PluginService( $c[ SURECART_APPLICATION_KEY ] );
23 };
24
25 $container['surecart.upgrade.notice'] = function ( $c ) {
26 return new UpgradeNoticeService( $c[ SURECART_APPLICATION_KEY ] );
27 };
28
29 $container['surecart.plugin.action.links'] = function ( $c ) {
30 return new PluginActionLinksService( $c[ SURECART_APPLICATION_KEY ] );
31 };
32
33 $container['surecart.actions'] = function () {
34 return new ActionsService();
35 };
36
37 $container['surecart.config.setting'] = function ( $c ) {
38 return json_decode( json_encode( $c[ SURECART_CONFIG_KEY ] ) );
39 };
40
41 $container['surecart.health'] = function () {
42 return new HealthService();
43 };
44
45 $container['surecart.compatibility'] = function () {
46 return new CompatibilityService();
47 };
48
49 // singleton.
50 $currency_service = new CurrencyService();
51 $container['surecart.currency'] = function () use ( $currency_service ) {
52 return $currency_service;
53 };
54
55 $singleton = new StateService( [] );
56 $container['surecart.initialstate'] = function () use ( $singleton ) {
57 return $singleton;
58 };
59
60 $app = $container[ SURECART_APPLICATION_KEY ];
61 $app->alias( 'plugin', 'surecart.plugin' );
62 $app->alias( 'actions', 'surecart.actions' );
63 $app->alias( 'config', 'surecart.config.setting' );
64 $app->alias( 'healthCheck', 'surecart.health' );
65 $app->alias( 'state', 'surecart.initialstate' );
66 $app->alias( 'currency', 'surecart.currency' );
67 }
68
69 /**
70 * {@inheritDoc}
71 */
72 public function bootstrap( $container ) {
73 $container['surecart.health']->bootstrap();
74 $container['surecart.compatibility']->bootstrap();
75 $container['surecart.initialstate']->bootstrap();
76 $container['surecart.upgrade.notice']->bootstrap();
77 $container['surecart.plugin.action.links']->bootstrap();
78 $container['surecart.currency']->bootstrap();
79 }
80
81 /**
82 * Load textdomain.
83 *
84 * @return void
85 */
86 public function loadTextdomain() {
87 load_plugin_textdomain( 'surecart', false, basename( dirname( SURECART_PLUGIN_FILE ) ) . DIRECTORY_SEPARATOR . 'languages' );
88 }
89 }
90