Subversion Repositories Applications.framework

Rev

Rev 180 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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