Subversion Repositories Applications.framework

Rev

Rev 299 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 299 Rev 477
Line 9... Line 9...
9
 * @author		Delphine CAUQUIL <delphine@tela-botanica.org>
9
 * @author		Delphine CAUQUIL <delphine@tela-botanica.org>
10
 * @copyright	Copyright (c) 2010, Tela Botanica (accueil@tela-botanica.org)
10
 * @copyright	Copyright (c) 2010, Tela Botanica (accueil@tela-botanica.org)
11
 * @license	http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3
11
 * @license	http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3
12
 * @license	http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2
12
 * @license	http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2
13
 * @since 		0.3 
13
 * @since 		0.3
14
 * @version	$Id: Script.php 299 2011-01-18 14:03:46Z jpm $
14
 * @version	$Id: Script.php 477 2014-03-25 10:39:28Z jpm $
15
 * @link		/doc/framework/
15
 * @link		/doc/framework/
16
 */
16
 */
Line 17... Line 17...
17
 
17
 
18
abstract class Script {
18
abstract class Script {
Line 112... Line 112...
112
	
112
 
113
	protected function getScriptNom() {
113
	protected function getScriptNom() {
114
		return $this->script_nom;
114
		return $this->script_nom;
Line -... Line 115...
-
 
115
	}
-
 
116
 
-
 
117
	/**
-
 
118
	 * Retour le chemin vers le dossier principal du script exécuter.
-
 
119
	 * Si le nom du script est au format : script/sous_script
-
 
120
	 * le chemin contiendra seulement "script" dans le chemin renvoyé.
-
 
121
	 * Si le nom du script est au format : script/sous-script-1/sous_script-2
-
 
122
	 * le chemin contiendra seulement "script/sous-script-1" dans le chemin renvoyé.
-
 
123
	 *
-
 
124
	 * @param type $doit_exister
115
	}
125
	 * @return string
-
 
126
	 */
-
 
127
	protected function getScriptChemin($doit_exister = true) {
-
 
128
		$script_nom = $this->getScriptNom();
-
 
129
		if (strpos($script_nom, DS)) {
-
 
130
			$decompoScriptNom = explode(DS, $script_nom);
-
 
131
			$script_nom = array_pop($decompoScriptNom);
-
 
132
			$dossier_nom = implode(DS, $decompoScriptNom);
-
 
133
		} else {
116
	
134
			$dossier_nom = strtolower($script_nom);
117
	protected function getScriptChemin($doit_exister = true) {
135
		}
118
		$chemin = Config::get('chemin_modules').$this->getScriptNom().DS;
136
		$chemin = Config::get('chemin_modules').$dossier_nom.DS;
119
		if (!file_exists($chemin) && $doit_exister) {
137
		if (!file_exists($chemin) && $doit_exister) {
120
			trigger_error("Erreur: le module '".$this->getScriptNom()."' n'existe pas ($chemin)\n", E_USER_ERROR);
138
			trigger_error("Erreur: le module '$script_nom' n'existe pas ($chemin)\n", E_USER_ERROR);
121
		}
139
		}
Line 122... Line 140...
122
		return $chemin;
140
		return $chemin;