Subversion Repositories eFlore/Applications.cel

Rev

Rev 542 | Rev 577 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 542 Rev 576
Line 50... Line 50...
50
		
50
		
51
		if (isset($_SERVER['REQUEST_URI']) && isset($_SERVER['QUERY_STRING'])) {
51
		if (isset($_SERVER['REQUEST_URI']) && isset($_SERVER['QUERY_STRING'])) {
52
			$url_morceaux = $this->parserUrl();
52
			$url_morceaux = $this->parserUrl();
53
			if (isset($url_morceaux[0])) {
53
			if (isset($url_morceaux[0])) {
-
 
54
				$this->widget = $url_morceaux[0];
54
				$this->widget = $url_morceaux[0];
55
				self::$config['chemins']['widgetCourantDossier'] = self::$config['chemins']['widgetsDossier'].strtolower($this->widget).DIRECTORY_SEPARATOR;
Line 55... Line 56...
55
			}
56
			}
56
			
57
			
57
			// Nettoyage du $_GET (sécurité)
58
			// Nettoyage du $_GET (sécurité)
Line 96... Line 97...
96
	*/
97
	*/
97
	public static function chargerClasse($classe) {
98
	public static function chargerClasse($classe) {
98
		if (class_exists($classe)) {
99
		if (class_exists($classe)) {
99
			return null;
100
			return null;
100
		}
101
		}
101
		
-
 
102
		$chemins = array('', self::$config['chemins']['bibliothequeDossier']);
102
		$chemins = explode(';', self::$config['chemins']['autoload']);
-
 
103
		$chemins = array_map('trim', $chemins);
-
 
104
		array_unshift($chemins, self::$config['chemins']['widgetCourantDossier'].'bibliotheque');
-
 
105
		array_unshift($chemins, '');
103
		foreach ($chemins as $chemin) {
106
		foreach ($chemins as $chemin) {
104
			$chemin = $chemin.$classe.'.php';
107
			$chemin = $chemin.$classe.'.php';
105
			if (file_exists($chemin)) {
108
			if (file_exists($chemin)) {
106
				require_once $chemin;
109
				require_once $chemin;
107
			}
110
			}
Line 113... Line 116...
113
	 * Execute le widget.
116
	 * Execute le widget.
114
	 */
117
	 */
115
	function executer() {
118
	function executer() {
116
		if (!is_null($this->widget)) {
119
		if (!is_null($this->widget)) {
117
			$classe_widget = ucfirst($this->widget);
120
			$classe_widget = ucfirst($this->widget);
118
			self::$config['chemins']['widgetCourantDossier'] = self::$config['chemins']['widgetsDossier'].strtolower($this->widget).DIRECTORY_SEPARATOR;
-
 
119
			
-
 
120
			$fichier_widget = self::$config['chemins']['widgetCourantDossier'].$classe_widget.'.php';
121
			$fichier_widget = self::$config['chemins']['widgetCourantDossier'].$classe_widget.'.php';
121
			if (file_exists($fichier_widget))  {
122
			if (file_exists($fichier_widget))  {
122
				$this->chargerWidgetConfig();
123
				$this->chargerWidgetConfig();
Line 123... Line 124...
123
				
124
				
Line 132... Line 133...
132
	
133
	
133
	/**
134
	/**
134
	 * Charge le fichier de config spécifique du wiget et fusionne la config avec celle partagés par l'ensemble des widgets.
135
	 * Charge le fichier de config spécifique du wiget et fusionne la config avec celle partagés par l'ensemble des widgets.
135
	 */
136
	 */
136
	private function chargerWidgetConfig() {
137
	private function chargerWidgetConfig() {
137
		$widget_config_ini_fichier = self::$config['chemins']['widgetCourantDossier'].DIRECTORY_SEPARATOR.'config.ini';
138
		$widget_config_ini_fichier = self::$config['chemins']['widgetCourantDossier'].'config.ini';
138
		if (file_exists($widget_config_ini_fichier))  {
139
		if (file_exists($widget_config_ini_fichier))  {
139
			$widget_config = parse_ini_file($widget_config_ini_fichier, TRUE);
140
			$widget_config = parse_ini_file($widget_config_ini_fichier, TRUE);
140
			self::$config = array_merge(self::$config, $widget_config);
141
			self::$config = array_merge(self::$config, $widget_config);
141
		}
142
		}