mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-11-21 23:42:21 +03:00
The custom autoload file is not needed any more (autoloading via composer).
This commit is contained in:
parent
d37da32ffa
commit
2e3b1ac9f7
1 changed files with 0 additions and 43 deletions
43
autoload.php
43
autoload.php
|
@ -1,43 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.2.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
function register($namespace, $path) {
|
||||
spl_autoload_register(function ($class) use ($namespace, $path) {
|
||||
// project-specific namespace prefix
|
||||
$prefix = 'EA\\' . $namespace . '\\';
|
||||
|
||||
// does the class use the namespace prefix?
|
||||
$len = strlen($prefix);
|
||||
if (strncmp($prefix, $class, $len) !== 0) {
|
||||
// no, move to the next registered autoloader
|
||||
return;
|
||||
}
|
||||
|
||||
// get the relative class name
|
||||
$relative_class = substr($class, $len);
|
||||
|
||||
// replace the namespace prefix with the base directory, replace namespace
|
||||
// separators with directory separators in the relative class name, append
|
||||
// with .php
|
||||
$file = $path . '/' . str_replace('\\', '/', $relative_class) . '.php';
|
||||
|
||||
// if the file exists, require it
|
||||
if (file_exists($file)) {
|
||||
require $file;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
register('Engine', __DIR__ . '/engine');
|
||||
register('Themes', __DIR__ . '/themes');
|
||||
register('Plugins', __DIR__ . '/plugins');
|
Loading…
Reference in a new issue