PluginProbe
Depicter — Popup & Slider Builder / 1.6.2
Depicter — Popup & Slider Builder v1.6.2
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 1.6.2, at app/src/Services/ServiceProvider.php

99 lines 2.8 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.remote.api' ] = function () {
59 return new RemoteAPIService();
60 };
61 $app->alias( 'remote', 'depicter.services.remote.api' );
62
63 $container[ 'depicter.services.storage.disk' ] = function () {
64 return new StorageService();
65 };
66 $app->alias( 'storage', 'depicter.services.storage.disk' );
67
68 $container[ 'depicter.export.service' ] = function () {
69 return new ExportService();
70 };
71 $app->alias( 'exportService', 'depicter.export.service' );
72
73 $container[ 'depicter.import.service' ] = function () {
74 return new ImportService();
75 };
76 $app->alias( 'importService', 'depicter.import.service' );
77
78 $container[ 'depicter.security.authorization' ] = function () {
79 return new AuthorizationService();
80 };
81 $app->alias( 'authorization', 'depicter.security.authorization' );
82
83 $container[ 'depicter.security.authentication' ] = function () {
84 return new AuthenticationService();
85 };
86 $app->alias( 'auth', 'depicter.security.authentication' );
87 }
88
89 /**
90 * {@inheritDoc}
91 */
92 public function bootstrap( $container ) {
93 if ( is_admin() ) {
94 \Depicter::resolve('depicter.services.deactivation.feedback');
95 }
96 }
97
98 }
99