Add an autoload function for autoloading class

This commit is contained in:
Victor LABORIE 2017-12-11 18:52:52 +01:00
parent 577f982627
commit 2b79e7449b
8 changed files with 31 additions and 0 deletions

View file

@ -13,6 +13,9 @@
// Force authentication on this page
require_once("lib/auth.php");
// Autoload class from lib/class.*.php
require_once("lib/autoload.php");
/**
* Path
*/

View file

@ -13,6 +13,9 @@
// Force authentication on this page
require_once("lib/auth.php");
// Autoload class from lib/class.*.php
require_once("lib/autoload.php");
/**
* Path
*/

View file

@ -10,6 +10,9 @@
* @version 1.0
*/
// Autoload class from lib/class.*.php
require_once("lib/autoload.php");
/**
* Path
*/

View file

@ -13,6 +13,9 @@
// Force authentication on this page
require_once("lib/auth.php");
// Autoload class from lib/class.*.php
require_once("lib/autoload.php");
/**
* Path
*/

View file

@ -13,6 +13,9 @@
// Force authentication on this page
require_once("lib/auth.php");
// Autoload class from lib/class.*.php
require_once("lib/autoload.php");
/**
* Path
*/

View file

@ -13,6 +13,9 @@
// Force authentication on this page
require_once("lib/auth.php");
// Autoload class from lib/class.*.php
require_once("lib/autoload.php");
/**
* Path
*/

10
htdocs/lib/autoload.php Normal file
View file

@ -0,0 +1,10 @@
<?php
spl_autoload_register(function ($class) {
if (file_exists("vendor/evolibs/$class.php")) {
include_once("vendor/evolibs/$class.php");
} else {
$class = strtolower($class);
include_once("lib/class.$class.php");
}
});

View file

@ -13,6 +13,9 @@
// Force authentication on this page
require_once("lib/auth.php");
// Autoload class from lib/class.*.php
require_once("lib/autoload.php");
/**
* Path
*/