Subversion Repositories Applications.framework

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
467 jpm 1
<?php
2
// declare(encoding='UTF-8');
3
/**
4
 * Fichier contenant la fonction de chargement automatique de classes, il doit toujours rester à la racine
5
 * du framework car il initialise le chemin de l'application en se basant sur son propre emplacement.
6
 *
7
 * PHP Version 5.1.2
8
 *
9
 * @category  Fichier_De_Fonctions
10
 * @package   Framework
11
 // Auteur principal :
12
 * @author Aurelien PERONNET <aurelien@tela-botanica.org>
13
 // Autres auteurs :
14
 * @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
15
 * @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
16
 * @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
17
 * @version $$Id: autoload.inc.php 188 2010-04-29 12:09:17Z jpm $$
18
 * @copyright 1999-2009 Tela Botanica (accueil@tela-botanica.org)
19
 */
20
 
21
// Redéfinition de la constante DIRECTORY_SEPARATOR
22
if (!defined('DS')) {
23
	define('DS', DIRECTORY_SEPARATOR);
24
}
25
// Redéfinition de la constante PATH_SEPARATOR
26
if (!defined('PS')) {
27
	define('PS', PATH_SEPARATOR);
28
}
29
 
30
// Autoload pour le Framework
31
function autoloadFw($nom_classe_fw) {
32
	$fichier_a_inclure = dirname(__FILE__).DS.$nom_classe_fw.'.php';
33
	if (file_exists($fichier_a_inclure)) {
34
		include_once $fichier_a_inclure;
35
		return null;
36
	}
37
}
38
spl_autoload_register('autoloadFw');
39
 
40
// Initialisation du gestionnaire d'erreur avant toute chose
41
GestionnaireException::initialiser();
42
 
43
// Autoload par défaut pour l'application
44
function autoloadAppliDefaut($nom_classe) {
45
	$dossiers_classes = array(	Config::get('chemin_controleurs'),
46
								Config::get('chemin_modeles'),
47
								Config::get('chemin_bibliotheque'));
48
 
49
	foreach ($dossiers_classes as $chemin) {
50
		$fichier_a_tester = $chemin.$nom_classe.'.php';
51
		if (file_exists($fichier_a_tester)) {
52
			include_once $fichier_a_tester;
53
			return null;
54
		}
55
	}
56
}
57
spl_autoload_register('autoloadAppliDefaut');
58
 
59
// Autoload défini par l'application
60
if (function_exists('__autoload')) {
61
	spl_autoload_register('__autoload');
62
}
63
?>