Diff: STRATO-apps/wordpress_03/app/wp-content/plugins/wp-rocket/inc/Engine/Plugin/ServiceProvider.php
Keine Baseline-Datei – Diff nur gegen leer.
1
-
1
+
<?php
2
+
declare(strict_types=1);
3
+
4
+
namespace WP_Rocket\Engine\Plugin;
5
+
6
+
use WP_Rocket\Dependencies\League\Container\Argument\Literal\ArrayArgument;
7
+
use WP_Rocket\Dependencies\League\Container\Argument\Literal\StringArgument;
8
+
use WP_Rocket\Dependencies\League\Container\ServiceProvider\AbstractServiceProvider;
9
+
10
+
/**
11
+
* Service provider for the WP Rocket updates.
12
+
*/
13
+
class ServiceProvider extends AbstractServiceProvider {
14
+
/**
15
+
* Array of services provided by this service provider
16
+
*
17
+
* @var array
18
+
*/
19
+
protected $provides = [
20
+
'plugin_renewal_notice',
21
+
'plugin_updater_common_subscriber',
22
+
'plugin_information_subscriber',
23
+
'plugin_updater_subscriber',
24
+
];
25
+
26
+
/**
27
+
* Check if the service provider provides a specific service.
28
+
*
29
+
* @param string $id The id of the service.
30
+
*
31
+
* @return bool
32
+
*/
33
+
public function provides( string $id ): bool {
34
+
return in_array( $id, $this->provides, true );
35
+
}
36
+
37
+
/**
38
+
* Registers items with the container
39
+
*
40
+
* @return void
41
+
*/
42
+
public function register(): void {
43
+
$this->getContainer()->add( 'plugin_renewal_notice', RenewalNotice::class )
44
+
->addArguments(
45
+
[
46
+
'user',
47
+
new StringArgument( $this->getContainer()->get( 'template_path' ) . '/plugins/' ),
48
+
]
49
+
);
50
+
$this->getContainer()->addShared( 'plugin_updater_common_subscriber', UpdaterApiCommonSubscriber::class )
51
+
->addArgument(
52
+
new ArrayArgument(
53
+
[
54
+
'site_url' => home_url(),
55
+
'plugin_version' => WP_ROCKET_VERSION,
56
+
'settings_slug' => WP_ROCKET_SLUG,
57
+
'settings_nonce_key' => WP_ROCKET_PLUGIN_SLUG,
58
+
'plugin_options' => $this->getContainer()->get( 'options' ),
59
+
]
60
+
)
61
+
);
62
+
$this->getContainer()->addShared( 'plugin_information_subscriber', InformationSubscriber::class )
63
+
->addArgument(
64
+
new ArrayArgument(
65
+
[
66
+
'plugin_file' => WP_ROCKET_FILE,
67
+
]
68
+
)
69
+
);
70
+
$this->getContainer()->addShared( 'plugin_updater_subscriber', UpdaterSubscriber::class )
71
+
->addArguments(
72
+
[
73
+
'plugin_renewal_notice',
74
+
new ArrayArgument(
75
+
[
76
+
'plugin_file' => WP_ROCKET_FILE,
77
+
'plugin_version' => WP_ROCKET_VERSION,
78
+
'vendor_url' => WP_ROCKET_WEB_MAIN,
79
+
'icons' => [
80
+
'2x' => WP_ROCKET_ASSETS_IMG_URL . 'icon-256x256.png',
81
+
'1x' => WP_ROCKET_ASSETS_IMG_URL . 'icon-128x128.png',
82
+
],
83
+
]
84
+
),
85
+
]
86
+
);
87
+
}
88
+
}
89
+