Automattic\Jetpack\Autoloader\jpcd4dc500be73992154ab94f06c9d1b27
Autoloader_Handler::update_autoloader_chain() public WC 1.0
Updates the spl autoloader chain:
- Registers this namespace's autoloader function.
- If a v1 autoloader function is registered, moves it to the end of the chain.
- Removes any other v2 autoloader functions that have already been registered. This
can occur when the autoloader is being reset by an activating plugin.
{} It's a method of the class: Autoloader_Handler{}
No Hooks.
Return
Null. Nothing.
Usage
$Autoloader_Handler = new Autoloader_Handler(); $Autoloader_Handler->update_autoloader_chain();
Code of Autoloader_Handler::update_autoloader_chain() Autoloader Handler::update autoloader chain WC 5.0.0
public function update_autoloader_chain() {
spl_autoload_register( __NAMESPACE__ . '\autoloader' );
$autoload_chain = spl_autoload_functions();
foreach ( $autoload_chain as $autoloader ) {
if ( ! is_string( $autoloader ) ) {
/*
* The Jetpack Autoloader functions are registered as strings, so
* just continue if $autoloader isn't a string.
*/
continue;
}
if ( self::V1_AUTOLOADER_NAME === $autoloader ) {
// Move the v1.* autoloader function to the end of the spl autoloader chain.
spl_autoload_unregister( $autoloader );
spl_autoload_register( $autoloader );
} elseif (
self::V2_AUTOLOADER_BASE === substr( $autoloader, 0, strlen( self::V2_AUTOLOADER_BASE ) )
&& __NAMESPACE__ !== substr( $autoloader, 0, strlen( __NAMESPACE__ ) )
) {
// Unregister any other v2.* autoloader functions if they're in the chain.
spl_autoload_unregister( $autoloader );
}
}
}