PluginProbe ʕ •ᴥ•ʔ
Hostinger Reach – AI-Powered Email Marketing for WordPress / 1.7.1
Hostinger Reach – AI-Powered Email Marketing for WordPress v1.7.1
1.7.2 1.7.1 1.7.0 1.6.0 1.5.9 1.5.8 1.5.7 1.5.6 1.5.5 1.5.4 1.5.3 1.5.2 1.5.1 1.5.0 1.4.12 1.4.11 1.4.10 1.4.9 1.4.8 1.4.7 trunk 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6
hostinger-reach / vendor / automattic / jetpack-autoloader / src / class-container.php
hostinger-reach / vendor / automattic / jetpack-autoloader / src Last commit date
AutoloadFileWriter.php 7 months ago AutoloadGenerator.php 1 month ago AutoloadProcessor.php 1 year ago CustomAutoloaderPlugin.php 1 month ago ManifestGenerator.php 1 year ago autoload.php 1 year ago class-autoloader-handler.php 1 year ago class-autoloader-locator.php 1 year ago class-autoloader.php 1 year ago class-container.php 1 year ago class-hook-manager.php 1 year ago class-latest-autoloader-guard.php 1 year ago class-manifest-reader.php 1 year ago class-path-processor.php 1 year ago class-php-autoloader.php 1 year ago class-plugin-locator.php 1 year ago class-plugins-handler.php 1 year ago class-shutdown-handler.php 1 year ago class-version-loader.php 1 year ago class-version-selector.php 1 year ago
class-container.php
143 lines
1 <?php
2 /* HEADER */ // phpcs:ignore
3
4 /**
5 * This class manages the files and dependencies of the autoloader.
6 */
7 class Container {
8
9 /**
10 * Since each autoloader's class files exist within their own namespace we need a map to
11 * convert between the local class and a shared key. Note that no version checking is
12 * performed on these dependencies and the first autoloader to register will be the
13 * one that is utilized.
14 */
15 const SHARED_DEPENDENCY_KEYS = array(
16 Hook_Manager::class => 'Hook_Manager',
17 );
18
19 /**
20 * A map of all the dependencies we've registered with the container and created.
21 *
22 * @var array
23 */
24 protected $dependencies;
25
26 /**
27 * The constructor.
28 */
29 public function __construct() {
30 $this->dependencies = array();
31
32 $this->register_shared_dependencies();
33 $this->register_dependencies();
34 $this->initialize_globals();
35 }
36
37 /**
38 * Gets a dependency out of the container.
39 *
40 * @param string $class The class to fetch.
41 *
42 * @return mixed
43 * @throws \InvalidArgumentException When a class that isn't registered with the container is fetched.
44 */
45 public function get( $class ) {
46 if ( ! isset( $this->dependencies[ $class ] ) ) {
47 throw new \InvalidArgumentException( "Class '$class' is not registered with the container." );
48 }
49
50 return $this->dependencies[ $class ];
51 }
52
53 /**
54 * Registers all of the dependencies that are shared between all instances of the autoloader.
55 */
56 private function register_shared_dependencies() {
57 global $jetpack_autoloader_container_shared;
58 if ( ! isset( $jetpack_autoloader_container_shared ) ) {
59 $jetpack_autoloader_container_shared = array();
60 }
61
62 $key = self::SHARED_DEPENDENCY_KEYS[ Hook_Manager::class ];
63 if ( ! isset( $jetpack_autoloader_container_shared[ $key ] ) ) {
64 require_once __DIR__ . '/class-hook-manager.php';
65 $jetpack_autoloader_container_shared[ $key ] = new Hook_Manager();
66 }
67 $this->dependencies[ Hook_Manager::class ] = &$jetpack_autoloader_container_shared[ $key ];
68 }
69
70 /**
71 * Registers all of the dependencies with the container.
72 */
73 private function register_dependencies() {
74 require_once __DIR__ . '/class-path-processor.php';
75 $this->dependencies[ Path_Processor::class ] = new Path_Processor();
76
77 require_once __DIR__ . '/class-plugin-locator.php';
78 $this->dependencies[ Plugin_Locator::class ] = new Plugin_Locator(
79 $this->get( Path_Processor::class )
80 );
81
82 require_once __DIR__ . '/class-version-selector.php';
83 $this->dependencies[ Version_Selector::class ] = new Version_Selector();
84
85 require_once __DIR__ . '/class-autoloader-locator.php';
86 $this->dependencies[ Autoloader_Locator::class ] = new Autoloader_Locator(
87 $this->get( Version_Selector::class )
88 );
89
90 require_once __DIR__ . '/class-php-autoloader.php';
91 $this->dependencies[ PHP_Autoloader::class ] = new PHP_Autoloader();
92
93 require_once __DIR__ . '/class-manifest-reader.php';
94 $this->dependencies[ Manifest_Reader::class ] = new Manifest_Reader(
95 $this->get( Version_Selector::class )
96 );
97
98 require_once __DIR__ . '/class-plugins-handler.php';
99 $this->dependencies[ Plugins_Handler::class ] = new Plugins_Handler(
100 $this->get( Plugin_Locator::class ),
101 $this->get( Path_Processor::class )
102 );
103
104 require_once __DIR__ . '/class-autoloader-handler.php';
105 $this->dependencies[ Autoloader_Handler::class ] = new Autoloader_Handler(
106 $this->get( PHP_Autoloader::class ),
107 $this->get( Hook_Manager::class ),
108 $this->get( Manifest_Reader::class ),
109 $this->get( Version_Selector::class )
110 );
111
112 require_once __DIR__ . '/class-latest-autoloader-guard.php';
113 $this->dependencies[ Latest_Autoloader_Guard::class ] = new Latest_Autoloader_Guard(
114 $this->get( Plugins_Handler::class ),
115 $this->get( Autoloader_Handler::class ),
116 $this->get( Autoloader_Locator::class )
117 );
118
119 // Register any classes that we will use elsewhere.
120 require_once __DIR__ . '/class-version-loader.php';
121 require_once __DIR__ . '/class-shutdown-handler.php';
122 }
123
124 /**
125 * Initializes any of the globals needed by the autoloader.
126 */
127 private function initialize_globals() {
128 /*
129 * This global was retired in version 2.9. The value is set to 'false' to maintain
130 * compatibility with older versions of the autoloader.
131 */
132 global $jetpack_autoloader_including_latest;
133 $jetpack_autoloader_including_latest = false;
134
135 // Not all plugins can be found using the locator. In cases where a plugin loads the autoloader
136 // but was not discoverable, we will record them in this array to track them as "active".
137 global $jetpack_autoloader_activating_plugins_paths;
138 if ( ! isset( $jetpack_autoloader_activating_plugins_paths ) ) {
139 $jetpack_autoloader_activating_plugins_paths = array();
140 }
141 }
142 }
143