PluginProbe
Depicter — Popup & Slider Builder / trunk
Depicter — Popup & Slider Builder vtrunk
4.8.1 trunk 1.0.0 1.1.0 1.1.2 1.1.4 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.5 1.3.8 1.5.0 1.5.1 1.5.2 1.5.5 1.6.0 1.6.1 1.6.2 1.7.0 All 76 releases
depicter / app / src / Services / ServiceProvider.php

ServiceProvider.php in Depicter — Popup & Slider Builder trunk, at app/src/Services/ServiceProvider.php

151 lines 4.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Depicter\Services;
3
4 use Averta\WordPress\Cache\DatabaseCache;
5 use Averta\WordPress\Cache\WPCache;
6 use WPEmerge\ServiceProviders\ServiceProviderInterface;
7
8 /**
9 * initialize common services
10 */
11 class ServiceProvider implements ServiceProviderInterface
12 {
13
14 /**
15 * {@inheritDoc}
16 */
17 public function register( $container ) {
18 $app = $container[ WPEMERGE_APPLICATION_KEY ];
19
20 // register Cache modules
21 $container[ 'depicter.services.cache.base' ] = function () {
22 return new WPCache('depicter__');
23 };
24
25 $container[ 'depicter.services.cache.api' ] = function () {
26 return new WPCache('depicter_api_');
27 };
28
29 $container[ 'depicter.services.cache.document' ] = function () {
30 return new DatabaseCache('depicter_doc_id_');
31 };
32 // persistent database cache module
33 $container[ 'depicter.services.cache.database' ] = function () {
34 return new DatabaseCache('depicter_d_');
35 };
36
37 // register cache alias for retrieving a cache module
38 $app->alias( 'cache', function () use ( $app ) {
39 $module = !empty( func_get_args()['0'] ) ? strtolower( func_get_args()['0'] ) : 'api';
40 return $app->resolve( 'depicter.services.cache.' . $module );
41 });
42
43 $container[ 'depicter.media.library' ] = function () {
44 return new MediaLibraryService();
45 };
46 $app->alias( 'mediaLibrary', 'depicter.media.library' );
47
48 $container[ 'depicter.media.bridge' ] = function () {
49 return new MediaBridge();
50 };
51 $app->alias( 'media', 'depicter.media.bridge' );
52
53 $container[ 'depicter.services.document.fonts' ] = function () {
54 return new DocumentFontsV1Service();
55 };
56 $app->alias( 'documentFonts', 'depicter.services.document.fonts' );
57
58 $container[ 'depicter.services.google.fonts' ] = function () {
59 return new GoogleFontsService();
60 };
61 $app->alias( 'googleFontsService', 'depicter.services.google.fonts' );
62
63 $container[ 'depicter.services.remote.api' ] = function () {
64 return new RemoteAPIService();
65 };
66 $app->alias( 'remote', 'depicter.services.remote.api' );
67
68 $container[ 'depicter.services.storage.disk' ] = function () {
69 return new StorageService();
70 };
71 $app->alias( 'storage', 'depicter.services.storage.disk' );
72
73 $container[ 'depicter.export.service' ] = function () {
74 return new ExportService();
75 };
76 $app->alias( 'exportService', 'depicter.export.service' );
77
78 $container[ 'depicter.import.service' ] = function () {
79 return new ImportService();
80 };
81 $app->alias( 'importService', 'depicter.import.service' );
82
83 $container[ 'depicter.security.authorization' ] = function () {
84 return new AuthorizationService();
85 };
86 $app->alias( 'authorization', 'depicter.security.authorization' );
87
88 $container[ 'depicter.security.authentication' ] = function () {
89 return new AuthenticationService();
90 };
91 $app->alias( 'auth', 'depicter.security.authentication' );
92
93 $container[ 'depicter.ai.wizard.service' ] = function () {
94 return new AIWizardService();
95 };
96 $app->alias( 'AIWizard', 'depicter.ai.wizard.service' );
97
98 $container[ 'depicter.geo.locate.service' ] = function () {
99 return new GeoLocateService();
100 };
101 $app->alias( 'geoLocate', 'depicter.geo.locate.service' );
102
103 $container[ 'depicter.lead.service' ] = function () {
104 return new LeadService();
105 };
106 $app->alias( 'lead', 'depicter.lead.service' );
107
108 $container[ 'depicter.google.recaptcha' ] = function () {
109 return new GoogleRecaptchaV3();
110 };
111 $app->alias( 'recaptcha', 'depicter.google.recaptcha' );
112
113 $container[ 'depicter.usage.service' ] = function () {
114 return new UsageService();
115 };
116 $app->alias( 'usageService', 'depicter.usage.service' );
117
118 $container[ 'depicter.background.removal' ] = function () {
119 return new BackgroundRemovalService();
120 };
121 $app->alias( 'backgroundRemoval', 'depicter.background.removal' );
122
123 $container[ 'depicter.settings.manager' ] = function () {
124 return new SettingsManagerService();
125 };
126 $app->alias( 'settings', 'depicter.settings.manager' );
127
128 $container['depicter.queue.service' ] = function () {
129 return new QueueService();
130 };
131 $app->alias( 'queue', 'depicter.queue.service' );
132
133 $container['depicter.analytics.service' ] = function () {
134 return new AnalyticsService();
135 };
136 $app->alias( 'analytics', 'depicter.analytics.service' );
137 }
138
139 /**
140 * {@inheritDoc}
141 */
142 public function bootstrap( $container ) {
143 if ( is_admin() ) {
144 \Depicter::resolve('depicter.services.deactivation.feedback');
145 }
146
147 \Depicter::queue();
148 }
149
150 }
151