Subversion Repositories Applications.framework

Rev

Rev 467 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 467 Rev 476
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
 * @category	PHP 5.2
8
 *
-
 
9
 * @category  Fichier_De_Fonctions
-
 
10
 * @package   Framework
8
 * @package		Framework
11
 // Auteur principal :
-
 
12
 * @author Aurelien PERONNET <aurelien@tela-botanica.org>
9
 * @author Aurelien PERONNET <aurelien@tela-botanica.org>
13
 // Autres auteurs :
-
 
14
 * @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
10
 * @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
-
 
11
 * @copyright	Copyright (c) 2009, Tela Botanica (accueil@tela-botanica.org)
15
 * @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
12
 * @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
16
 * @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
13
 * @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
 */
14
 */
20
 
15
 
21
// Redéfinition de la constante DIRECTORY_SEPARATOR
16
// Redéfinition de la constante DIRECTORY_SEPARATOR
22
if (!defined('DS')) {
17
if (!defined('DS')) {
23
	define('DS', DIRECTORY_SEPARATOR);
18
	define('DS', DIRECTORY_SEPARATOR);
24
}
19
}
25
// Redéfinition de la constante PATH_SEPARATOR
20
// Redéfinition de la constante PATH_SEPARATOR
26
if (!defined('PS')) {
21
if (!defined('PS')) {
27
	define('PS', PATH_SEPARATOR);
22
	define('PS', PATH_SEPARATOR);
28
}
23
}
29
 
24
 
30
// Autoload pour le Framework
25
// Autoload pour le Framework
31
function autoloadFw($nom_classe_fw) {
26
function autoloadFw($nom_classe_fw) {
32
	$fichier_a_inclure = dirname(__FILE__).DS.$nom_classe_fw.'.php';
27
	$fichier_a_inclure = dirname(__FILE__).DS.$nom_classe_fw.'.php';
33
	if (file_exists($fichier_a_inclure)) {
28
	if (file_exists($fichier_a_inclure)) {
34
		include_once $fichier_a_inclure;
29
		include_once $fichier_a_inclure;
35
		return null;
30
		return null;
36
	}
31
	}
37
}
32
}
38
spl_autoload_register('autoloadFw');
33
spl_autoload_register('autoloadFw');
39
 
34
 
40
// Initialisation du gestionnaire d'erreur avant toute chose
35
// Initialisation du gestionnaire d'erreur avant toute chose
41
GestionnaireException::initialiser();
36
GestionnaireException::initialiser();
42
 
37
 
43
// Autoload par défaut pour l'application
38
// Autoload par défaut pour l'application
44
function autoloadAppliDefaut($nom_classe) {
39
function autoloadAppliDefaut($nom_classe) {
45
	$dossiers_classes = array(	Config::get('chemin_controleurs'),
40
	$dossiers_classes = array(	Config::get('chemin_controleurs'),
46
								Config::get('chemin_modeles'),
41
								Config::get('chemin_modeles'),
47
								Config::get('chemin_bibliotheque'));
42
								Config::get('chemin_bibliotheque'));
48
 
43
 
49
	foreach ($dossiers_classes as $chemin) {
44
	foreach ($dossiers_classes as $chemin) {
50
		$fichier_a_tester = $chemin.$nom_classe.'.php';
45
		$fichier_a_tester = $chemin.$nom_classe.'.php';
51
		if (file_exists($fichier_a_tester)) {
46
		if (file_exists($fichier_a_tester)) {
52
			include_once $fichier_a_tester;
47
			include_once $fichier_a_tester;
53
			return null;
48
			return null;
54
		}
49
		}
55
	}
50
	}
56
}
51
}
57
spl_autoload_register('autoloadAppliDefaut');
52
spl_autoload_register('autoloadAppliDefaut');
58
 
53
 
59
// Autoload défini par l'application
54
// Autoload défini par l'application
60
if (function_exists('__autoload')) {
55
if (function_exists('__autoload')) {
61
	spl_autoload_register('__autoload');
56
	spl_autoload_register('__autoload');
62
}
57
}
63
?>
58
?>