https://github.com/matomo-org/matomo/blob/4.x-dev/LegacyAutoloader.php - Mouve

Site d'origine

Permalink
4.x-dev
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time
31 lines (27 sloc) 828 Bytes
<?php
class LegacyAutoloader
{
public function __construct()
{
spl_autoload_register(array($this, 'load_class'));
}
public static function register()
{
new LegacyAutoloader();
}
public function load_class($className)
{
if (strpos($className, 'Matomo\\') === 0) {
$newName = 'Piwik' . substr($className, 6);
if (class_exists($newName) && !class_exists($className, false)) {
@class_alias($newName, $className);
}
} elseif (strpos($className, 'Piwik\\') === 0) {
$newName = 'Matomo' . substr($className, 5);
if (class_exists($newName) && !class_exists($className, false)) {
@class_alias($newName, $className);
}
}
}
}
LegacyAutoloader::register();

Raccourcis

Commandes

Fermer