Subversion Repositories Applications.framework

Compare Revisions

No changes between revisions

Ignore whitespace Rev 178 → Rev 179

/branches/v0.2-buhl/framework/Application.php
New file
0,0 → 1,82
<?php
// declare(encoding='UTF-8');
/**
* Classe fournissant des informations au Framework sur l'application.
*
* PHP version 5
*
* @category Debogage
* @package Framework
// Auteur principal :
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
// Autres auteurs :
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
* @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
* @version $$Id$$
* @copyright 1999-2009 Tela Botanica (accueil@tela-botanica.org)
*/
class Application {
 
/**
* tableau d'informations sur l'application
*/
private static $info = null;
/**
* chemin de base de l'application
*/
private static $chemin = null;
 
/**
* Modificateur pour le chemin de base
* @param string $chemin_fichier_principal chemin de base
*/
public static function setChemin($chemin_fichier_principal) {
if (self::$chemin === null) {
if (!file_exists($chemin_fichier_principal)) {
trigger_error("Le fichier indiqué n'existe pas. Utilisez __FILE__ dans la méthode set().", E_USER_ERROR);
} else {
self::$chemin = dirname($chemin_fichier_principal).DS;
}
} else {
trigger_error("Le chemin de l'application a déjà été enregistré auprès du Framework", E_USER_WARNING);
}
}
 
/**
* accesseur pour le chemin
* @return string le chemin
*/
public static function getChemin() {
return self::$chemin;
}
 
/** Le tableau des informations sur l'application possède les clés suivantes :
* - nom : nom de l'application
* - abr : abréviation de l'application
* - encodage : encodage de l'application (ISO-8859-15, UTF-8...)
*
* @param array $info tableau fournissant des informations sur l'application
* @return void
*/
public static function setInfo($info) {
if (self::$info === null) {
self::$info = $info;
} else {
trigger_error("Le informations de l'application ont déjà été enregistrées auprès du Framework", E_USER_WARNING);
}
}
 
/**
* accesseur pour le tableau d'infos
* @param string $cle la clé à laquelle on veut accéder
*/
public static function getInfo($cle = null) {
if ($cle !== null) {
if (isset(self::$info[$cle])) {
return self::$info[$cle];
}
} else {
return self::$info;
}
}
}
Property changes:
Added: svn:keywords
+Id Author Date Revision HeadURL
\ No newline at end of property