PluginProbe ʕ •ᴥ•ʔ
Really Simple Security – Simple and Performant Security (formerly Really Simple SSL) / 9.5.10.1
Really Simple Security – Simple and Performant Security (formerly Really Simple SSL) v9.5.10.1
9.5.11 9.5.10.1 9.5.10 trunk 9.4.0 9.4.1 9.4.2 9.4.3 9.5.0 9.5.0.1 9.5.0.2 9.5.1 9.5.2 9.5.2.2 9.5.2.3 9.5.3 9.5.3.1 9.5.3.2 9.5.4 9.5.5 9.5.6 9.5.7 9.5.8 9.5.9
really-simple-ssl / core / vendor / jetpack-autoloader / class-autoloader-handler.php
really-simple-ssl / core / vendor / jetpack-autoloader Last commit date
class-autoloader-handler.php 1 month ago class-autoloader-locator.php 1 month ago class-autoloader.php 1 month ago class-container.php 1 month ago class-hook-manager.php 1 month ago class-latest-autoloader-guard.php 1 month ago class-manifest-reader.php 1 month ago class-path-processor.php 1 month ago class-php-autoloader.php 1 month ago class-plugin-locator.php 1 month ago class-plugins-handler.php 1 month ago class-shutdown-handler.php 1 month ago class-version-loader.php 1 month ago class-version-selector.php 1 month ago
class-autoloader-handler.php
148 lines
1 <?php
2 /**
3 * This file was automatically generated by automattic/jetpack-autoloader.
4 *
5 * @package automattic/jetpack-autoloader
6 */
7
8 namespace Automattic\Jetpack\Autoloader\jpb362f03b12b29b02131a59d9d1231943\al5_0_15;
9
10 // phpcs:ignore
11
12 use Automattic\Jetpack\Autoloader\AutoloadGenerator;
13
14 /**
15 * This class selects the package version for the autoloader.
16 */
17 class Autoloader_Handler {
18
19 /**
20 * The PHP_Autoloader instance.
21 *
22 * @var PHP_Autoloader
23 */
24 private $php_autoloader;
25
26 /**
27 * The Hook_Manager instance.
28 *
29 * @var Hook_Manager
30 */
31 private $hook_manager;
32
33 /**
34 * The Manifest_Reader instance.
35 *
36 * @var Manifest_Reader
37 */
38 private $manifest_reader;
39
40 /**
41 * The Version_Selector instance.
42 *
43 * @var Version_Selector
44 */
45 private $version_selector;
46
47 /**
48 * The constructor.
49 *
50 * @param PHP_Autoloader $php_autoloader The PHP_Autoloader instance.
51 * @param Hook_Manager $hook_manager The Hook_Manager instance.
52 * @param Manifest_Reader $manifest_reader The Manifest_Reader instance.
53 * @param Version_Selector $version_selector The Version_Selector instance.
54 */
55 public function __construct( $php_autoloader, $hook_manager, $manifest_reader, $version_selector ) {
56 $this->php_autoloader = $php_autoloader;
57 $this->hook_manager = $hook_manager;
58 $this->manifest_reader = $manifest_reader;
59 $this->version_selector = $version_selector;
60 }
61
62 /**
63 * Checks to see whether or not an autoloader is currently in the process of initializing.
64 *
65 * @return bool
66 */
67 public function is_initializing() {
68 // If no version has been set it means that no autoloader has started initializing yet.
69 global $jetpack_autoloader_latest_version;
70 if ( ! isset( $jetpack_autoloader_latest_version ) ) {
71 return false;
72 }
73
74 // When the version is set but the classmap is not it ALWAYS means that this is the
75 // latest autoloader and is being included by an older one.
76 global $jetpack_packages_classmap;
77 if ( empty( $jetpack_packages_classmap ) ) {
78 return true;
79 }
80
81 // Version 2.4.0 added a new global and altered the reset semantics. We need to check
82 // the other global as well since it may also point at initialization.
83 // Note: We don't need to check for the class first because every autoloader that
84 // will set the latest version global requires this class in the classmap.
85 $replacing_version = $jetpack_packages_classmap[ AutoloadGenerator::class ]['version'];
86 if ( $this->version_selector->is_dev_version( $replacing_version ) || version_compare( $replacing_version, '2.4.0.0', '>=' ) ) {
87 global $jetpack_autoloader_loader;
88 if ( ! isset( $jetpack_autoloader_loader ) ) {
89 return true;
90 }
91 }
92
93 return false;
94 }
95
96 /**
97 * Activates an autoloader using the given plugins and activates it.
98 *
99 * @param string[] $plugins The plugins to initialize the autoloader for.
100 */
101 public function activate_autoloader( $plugins ) {
102 global $jetpack_packages_psr4;
103 $jetpack_packages_psr4 = array();
104 $this->manifest_reader->read_manifests( $plugins, 'vendor/composer/jetpack_autoload_psr4.php', $jetpack_packages_psr4 );
105
106 global $jetpack_packages_classmap;
107 $jetpack_packages_classmap = array();
108 $this->manifest_reader->read_manifests( $plugins, 'vendor/composer/jetpack_autoload_classmap.php', $jetpack_packages_classmap );
109
110 global $jetpack_packages_filemap;
111 $jetpack_packages_filemap = array();
112 $this->manifest_reader->read_manifests( $plugins, 'vendor/composer/jetpack_autoload_filemap.php', $jetpack_packages_filemap );
113
114 $loader = new Version_Loader(
115 $this->version_selector,
116 $jetpack_packages_classmap,
117 $jetpack_packages_psr4,
118 $jetpack_packages_filemap
119 );
120
121 $this->php_autoloader->register_autoloader( $loader );
122
123 // Now that the autoloader is active we can load the filemap.
124 $loader->load_filemap();
125 }
126
127 /**
128 * Resets the active autoloader and all related global state.
129 */
130 public function reset_autoloader() {
131 $this->php_autoloader->unregister_autoloader();
132 $this->hook_manager->reset();
133
134 // Clear all of the autoloader globals so that older autoloaders don't do anything strange.
135 global $jetpack_autoloader_latest_version;
136 $jetpack_autoloader_latest_version = null;
137
138 global $jetpack_packages_classmap;
139 $jetpack_packages_classmap = array(); // Must be array to avoid exceptions in old autoloaders!
140
141 global $jetpack_packages_psr4;
142 $jetpack_packages_psr4 = array(); // Must be array to avoid exceptions in old autoloaders!
143
144 global $jetpack_packages_filemap;
145 $jetpack_packages_filemap = array(); // Must be array to avoid exceptions in old autoloaders!
146 }
147 }
148