1 | <?php |
||
7 | class Autoloader_Handler { |
||
8 | |||
9 | // The name of the autoloader function registered by v1.* autoloaders. |
||
10 | const V1_AUTOLOADER_NAME = 'Automattic\Jetpack\Autoloader\autoloader'; |
||
11 | |||
12 | /* |
||
13 | * The autoloader function for v2.* autoloaders is named __NAMESPACE__ . \autoloader. |
||
14 | * The namespace is defined in AutoloadGenerator as |
||
15 | * 'Automattic\Jetpack\Autoloader\jp' plus a unique suffix. |
||
16 | */ |
||
17 | const V2_AUTOLOADER_BASE = 'Automattic\Jetpack\Autoloader\jp'; |
||
18 | |||
19 | const AUTOLOAD_GENERATOR_CLASS_NAME = 'Automattic\Jetpack\Autoloader\AutoloadGenerator'; |
||
20 | |||
21 | /** |
||
22 | * The Plugins_Handler object. |
||
23 | * |
||
24 | * @var Plugins_Handler |
||
25 | */ |
||
26 | private $plugins_handler = null; |
||
27 | |||
28 | /** |
||
29 | * The Version_Selector object. |
||
30 | * |
||
31 | * @var Version_Selector |
||
32 | */ |
||
33 | private $version_selector = null; |
||
34 | |||
35 | /** |
||
36 | * The constructor. |
||
37 | * |
||
38 | * @param Plugins_Handler $plugins_handler The Plugins_Handler object. |
||
39 | * @param Version_Selector $version_selector The Version_Selector object. |
||
40 | */ |
||
41 | public function __construct( $plugins_handler, $version_selector ) { |
||
45 | |||
46 | /** |
||
47 | * Finds the latest installed autoloader. |
||
48 | */ |
||
49 | public function find_latest_autoloader() { |
||
86 | |||
87 | /** |
||
88 | * Get this autoloader's package version. |
||
89 | * |
||
90 | * @return String The autoloader's package version. |
||
91 | */ |
||
92 | public function get_current_autoloader_version() { |
||
98 | |||
99 | |||
100 | /** |
||
101 | * Updates the spl autoloader chain: |
||
102 | * - Registers this namespace's autoloader function. |
||
103 | * - If a v1 autoloader function is registered, moves it to the end of the chain. |
||
104 | * - Removes any other v2 autoloader functions that have already been registered. This |
||
105 | * can occur when the autoloader is being reset by an activating plugin. |
||
106 | */ |
||
107 | public function update_autoloader_chain() { |
||
135 | } |
||
136 |