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