| Line 14... |
Line 14... |
| 14 |
* @licence GPL v3 & CeCILL v2
|
14 |
* @licence GPL v3 & CeCILL v2
|
| 15 |
* @version $Id$
|
15 |
* @version $Id$
|
| 16 |
*/
|
16 |
*/
|
| 17 |
// +-------------------------------------------------------------------------------------------------------------------+
|
17 |
// +-------------------------------------------------------------------------------------------------------------------+
|
| Line -... |
Line 18... |
| - |
|
18 |
|
| - |
|
19 |
// Autoloader pour les namespaces, à base de routes
|
| - |
|
20 |
function __autoload($nom_classe) {
|
| - |
|
21 |
//echo "AUTOLOAD\n";
|
| - |
|
22 |
$dernierAS = strrpos($nom_classe, "\\");
|
| - |
|
23 |
$ns = substr($nom_classe, 0, $dernierAS);
|
| - |
|
24 |
$nom = substr($nom_classe, strrpos($nom_classe, "\\") + 1);
|
| - |
|
25 |
//echo "Recherche : $nom / $ns\n";
|
| - |
|
26 |
// Routes selon les namespaces
|
| - |
|
27 |
$routes = array(
|
| - |
|
28 |
'TelaBotanica\Del\Commun' => '..' . DS . 'commun'
|
| - |
|
29 |
);
|
| - |
|
30 |
if (array_key_exists($ns, $routes)) {
|
| - |
|
31 |
//echo "Route trouvée: " . $routes[$ns] . "\n";
|
| - |
|
32 |
$fichier_a_inclure = dirname(__FILE__) . DS . $routes[$ns] . DS . $nom . '.php';
|
| - |
|
33 |
if (file_exists($fichier_a_inclure)) {
|
| - |
|
34 |
include_once $fichier_a_inclure;
|
| - |
|
35 |
return null;
|
| - |
|
36 |
}
|
| - |
|
37 |
}
|
| - |
|
38 |
}
|
| 18 |
|
39 |
|
| 19 |
// Le fichier autoload.inc.php du Framework de Tela Botanica doit être appelée avant tout autre chose dans l'application.
|
40 |
// Le fichier autoload.inc.php du Framework de Tela Botanica doit être appelée avant tout autre chose dans l'application.
|
| 20 |
// Sinon, rien ne sera chargé.
|
41 |
// Sinon, rien ne sera chargé.
|
| 21 |
// Chemin du fichier chargeant le framework requis
|
42 |
// Chemin du fichier chargeant le framework requis
|
| 22 |
$framework = dirname(__FILE__).DIRECTORY_SEPARATOR.'framework.php';
|
43 |
$framework = dirname(__FILE__).DIRECTORY_SEPARATOR.'framework.php';
|
| Line 27... |
Line 48... |
| 27 |
// Inclusion du Framework
|
48 |
// Inclusion du Framework
|
| 28 |
require_once $framework;
|
49 |
require_once $framework;
|
| 29 |
// Ajout d'information concernant cette application
|
50 |
// Ajout d'information concernant cette application
|
| 30 |
Framework::setCheminAppli(__FILE__);// Obligatoire
|
51 |
Framework::setCheminAppli(__FILE__);// Obligatoire
|
| 31 |
Framework::setInfoAppli(Config::get('info'));
|
52 |
Framework::setInfoAppli(Config::get('info'));
|
| 32 |
|
53 |
|
| 33 |
// Initialisation et lancement du serveur
|
54 |
// Initialisation et lancement du serveur
|
| 34 |
$Serveur = new RestServeur();
|
55 |
$Serveur = new RestServeur();
|
| 35 |
$Serveur->executer();
|
56 |
$Serveur->executer();
|
| Line 36... |
Line 57... |
| 36 |
|
57 |
|