1 | <?php |
||
15 | class Autoloader_Handler { |
||
16 | |||
17 | // The name of the autoloader function registered by v1.* autoloaders. |
||
18 | const V1_AUTOLOADER_NAME = 'Automattic\Jetpack\Autoloader\autoloader'; |
||
19 | |||
20 | /* |
||
21 | * The autoloader function for v2.* autoloaders is named __NAMESPACE__ . \autoloader. |
||
22 | * The namespace is defined in AutoloadGenerator as |
||
23 | * 'Automattic\Jetpack\Autoloader\jp' plus a unique suffix. |
||
24 | */ |
||
25 | const V2_AUTOLOADER_BASE = 'Automattic\Jetpack\Autoloader\jp'; |
||
26 | |||
27 | const AUTOLOAD_GENERATOR_CLASS_NAME = 'Automattic\Jetpack\Autoloader\AutoloadGenerator'; |
||
28 | |||
29 | /** |
||
30 | * The Plugins_Handler object. |
||
31 | * |
||
32 | * @var Plugins_Handler |
||
33 | */ |
||
34 | private $plugins_handler = null; |
||
35 | |||
36 | /** |
||
37 | * The Version_Selector object. |
||
38 | * |
||
39 | * @var Version_Selector |
||
40 | */ |
||
41 | private $version_selector = null; |
||
42 | |||
43 | /** |
||
44 | * The constructor. |
||
45 | * |
||
46 | * @param Plugins_Handler $plugins_handler The Plugins_Handler object. |
||
47 | * @param Version_Selector $version_selector The Version_Selector object. |
||
48 | */ |
||
49 | public function __construct( $plugins_handler, $version_selector ) { |
||
53 | |||
54 | /** |
||
55 | * Finds the latest installed autoloader. |
||
56 | */ |
||
57 | public function find_latest_autoloader() { |
||
91 | |||
92 | /** |
||
93 | * Get this autoloader's package version. |
||
94 | * |
||
95 | * @return String The autoloader's package version. |
||
96 | */ |
||
97 | public function get_current_autoloader_version() { |
||
103 | |||
104 | |||
105 | /** |
||
106 | * Updates the spl autoloader chain: |
||
107 | * - Registers this namespace's autoloader function. |
||
108 | * - If a v1 autoloader function is registered, moves it to the end of the chain. |
||
109 | * - Removes any other v2 autoloader functions that have already been registered. This |
||
110 | * can occur when the autoloader is being reset by an activating plugin. |
||
111 | */ |
||
112 | public function update_autoloader_chain() { |
||
140 | } |
||
141 |