Subversion Repositories Applications.framework

Rev

Rev 392 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 392 Rev 393
Line 14... Line 14...
14
 * @package	Framework
14
 * @package	Framework
15
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
15
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
16
 * @copyright	Copyright (c) 2010, Tela Botanica (accueil@tela-botanica.org)
16
 * @copyright	Copyright (c) 2010, Tela Botanica (accueil@tela-botanica.org)
17
 * @license	http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3
17
 * @license	http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3
18
 * @license	http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2
18
 * @license	http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2
19
 * @version	$Id: Framework.php 392 2011-11-09 16:56:34Z jpm $
19
 * @version	$Id: Framework.php 393 2011-11-10 13:36:48Z jpm $
20
 * @since		0.3
20
 * @since		0.3
21
 * @link		/doc/framework/
21
 * @link		/doc/framework/
22
 */
22
 */
23
class Framework {
23
class Framework {
Line 69... Line 69...
69
			/** Redéfinition de la constante PATH_SEPARATOR en version abrégée PS */
69
			/** Redéfinition de la constante PATH_SEPARATOR en version abrégée PS */
70
			define('PS', PATH_SEPARATOR);
70
			define('PS', PATH_SEPARATOR);
71
		}
71
		}
72
	}
72
	}
Line -... Line 73...
-
 
73
 
-
 
74
	private static function definirCheminAppli($chemin) {
-
 
75
		if (is_file($chemin)) {
-
 
76
			self::$chemin = dirname($chemin).DS;
-
 
77
		} else if (is_dir($chemin)) {
-
 
78
			self::$chemin = $chemin;
-
 
79
		} else {
-
 
80
			throw new Exception("Le chemin indiqué '$chemin' n'est ni un fichier ni un dossier.");
-
 
81
		}
-
 
82
	}
73
 
83
 
74
	private static function enregistrerMethodesAutoload() {
84
	private static function enregistrerMethodesAutoload() {
Line 75... Line 85...
75
		spl_autoload_register(array(get_class(), 'autoloadFw'));
85
		spl_autoload_register(array(get_class(), 'autoloadFw'));
76
 
86
 
Line 139... Line 149...
139
		if (self::$chemin === null) {
149
		if (self::$chemin === null) {
140
			if (!file_exists($chemin_fichier_principal)) {
150
			if (!file_exists($chemin_fichier_principal)) {
141
				trigger_error("Le fichier indiqué n'existe pas. Utilisez __FILE__ dans la méthode setCheminAppli().", E_USER_ERROR);
151
				trigger_error("Le fichier indiqué n'existe pas. Utilisez __FILE__ dans la méthode setCheminAppli().", E_USER_ERROR);
142
			} else {
152
			} else {
143
				self::definirConstantesGlobales();
153
				self::definirConstantesGlobales();
144
				self::$chemin = dirname($chemin_fichier_principal).DS;
154
				self::definirCheminAppli($chemin_fichier_principal);
145
				self::initialiserEnvironnement();
155
				self::initialiserEnvironnement();
146
				self::initialiserFramework();
156
				self::initialiserFramework();
147
			}
157
			}
148
		} else {
158
		} else {
149
			trigger_error("Le chemin de l'application a déjà été enregistré auprès du Framework", E_USER_WARNING);
159
			trigger_error("Le chemin de l'application a déjà été enregistré auprès du Framework", E_USER_WARNING);