From 3d3e09832b2ab0f5201bff05f8babba8109f6aa8 Mon Sep 17 00:00:00 2001
From: Cerdic <cedric@yterium.com>
Date: Wed, 15 Sep 2010 08:12:28 +0000
Subject: [PATCH] report de [16120]

---
 ecrire/inc_version.php         | 6 ++++++
 ecrire/public/compiler.php     | 4 ++--
 ecrire/public/decompiler.php   | 2 +-
 ecrire/public/phraser_html.php | 8 ++++----
 4 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/ecrire/inc_version.php b/ecrire/inc_version.php
index 7e7b360b00..baf4aa4f95 100644
--- a/ecrire/inc_version.php
+++ b/ecrire/inc_version.php
@@ -91,6 +91,12 @@ OR (_EXTENSION_PHP AND @file_exists($f = _ROOT_RESTREINT . _NOM_CONFIG . _EXTENS
 	define('_FILE_OPTIONS', $f);
 } else define('_FILE_OPTIONS', '');
 
+// les modules par defaut pour la traduction.
+// Constante utilisee par le compilateur et le decompilateur
+// sa valeur etant traitee par inc_traduire_dist
+
+define('MODULES_IDIOMES', 'public/spip/ecrire');
+
 // *** Fin des define *** //
 
 
diff --git a/ecrire/public/compiler.php b/ecrire/public/compiler.php
index 2da49affa0..152380a035 100644
--- a/ecrire/public/compiler.php
+++ b/ecrire/public/compiler.php
@@ -646,9 +646,9 @@ function compile_cas($tableau, $descr, &$boucles, $id_boucle) {
 		case 'idiome':
 			$l = array();
 			foreach ($p->arg as $k => $v) {
-				if ($k) $l[]=$k.' => '.calculer_liste($v,$p->descr,$boucles,$id_boucle);
+			  if ($k) $l[]= _q($k).' => '.calculer_liste($v,$p->descr,$boucles,$id_boucle);
 			}
-			$l = !$l ? '' : (",array(".implode(', ',$l).")");
+			$l = !$l ? '' : (", array(".implode(",\n",$l).")");
 			$code = "_T('" . $p->module . ":" .$p->nom_champ . "'$l)";
 			if ($p->param) {
 				$p->id_boucle = $id_boucle;
diff --git a/ecrire/public/decompiler.php b/ecrire/public/decompiler.php
index 43217cf41f..6c0c10c3b1 100644
--- a/ecrire/public/decompiler.php
+++ b/ecrire/public/decompiler.php
@@ -71,7 +71,7 @@ function decompiler_polyglotte($struct, $fmt='', $prof=0)
 
 function decompiler_idiome($struct, $fmt='', $prof=0)
 {
-	$module = ($struct->module == 'public/spip/ecrire')? ''
+	$module = ($struct->module == MODULES_IDIOMES)? ''
 	  : $struct->module;
 
 	$args = array();
diff --git a/ecrire/public/phraser_html.php b/ecrire/public/phraser_html.php
index e63bb168a9..d69bd37bbc 100644
--- a/ecrire/public/phraser_html.php
+++ b/ecrire/public/phraser_html.php
@@ -126,15 +126,15 @@ function phraser_idiomes($texte,$ligne,$result) {
 		$texte = substr($texte,$p+strlen($match[0]));
 		// Stocker les arguments de la balise de traduction
 		$args=array();
-		$vals=explode(',',$match[5]);
+		$vals=preg_split('/,\s*/',$match[5]);
 		foreach ($vals as $val) {
-			$arg=explode('=',$val);
+			$arg=preg_split('/\s*=/',$val);
 			if ($arg[0])
-				$args[$arg[0]]=phraser_champs($arg[1], 0, $_arg);	
+			  $args[$arg[0]]=phraser_champs($arg[1], 0, array());	
 		}
 		$champ->arg=$args;
 		$champ->nom_champ = strtolower($match[3]);
-		$champ->module = $match[2] ? $match[2] : 'public/spip/ecrire';
+		$champ->module = $match[2] ? $match[2] : MODULES_IDIOMES;
 		// pas d'imbrication pour les filtres sur langue
 		phraser_args(@$match[7], ":", '', array(), $champ);
 		$result[] = $champ;
-- 
GitLab