From e3ece7de01ae163513210010fa7411547bfd259f Mon Sep 17 00:00:00 2001
From: Matthieu Marcillaud <marcimat@rezo.net>
Date: Sun, 1 Oct 2017 14:00:21 +0000
Subject: [PATCH] =?UTF-8?q?Compl=C3=A9ment=20=C3=A0=20r23731=20:=20en=20pr?=
 =?UTF-8?q?=C3=A9sence=20du=20plugin=20'dev'=20ou=20du=20mode=20'traductio?=
 =?UTF-8?q?ns'=20ne=20pas=20prendre=20toutes=20les=20chaines=20de=20langue?=
 =?UTF-8?q?s=20comme=20non=20traduites=20!=20(Eric)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 ecrire/inc/utils.php | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/ecrire/inc/utils.php b/ecrire/inc/utils.php
index 9f86eb6767..44090e2e30 100644
--- a/ecrire/inc/utils.php
+++ b/ecrire/inc/utils.php
@@ -822,10 +822,19 @@ function _T($texte, $args = array(), $options = array()) {
  */
 function _L($text, $args = array(), $options = array()) {
 	$f = $text;
+	$defaut_options = array(
+		'class' => null,
+		'sanitize' => true,
+	);
+	// support de l'ancien argument $class
 	if ($options and is_string($options)) {
-		// support de l'ancien argument $class
 		$options = array('class' => $options);
+	} elseif (is_array($options)) {
+		$options += $defaut_options;
+	} else {
+		$options = $defaut_options;
 	}
+
 	if (is_array($args)) {
 		if (!function_exists('interdire_scripts')) {
 			include_spip('inc/texte');
@@ -834,11 +843,11 @@ function _L($text, $args = array(), $options = array()) {
 			include_spip('inc/texte_mini');
 		}
 		foreach ($args as $name => $value) {
-			if (!isset($options['sanitize']) or $options['sanitize']) {
+			if ($options['sanitize']) {
 				$value = echapper_html_suspect($value);
 				$value = interdire_scripts($value, -1);
 			}
-			if (isset($options['class']) and $options['class']) {
+			if (!empty($options['class'])) {
 				$value = "<span class='".$options['class']."'>$value</span>";
 			}
 			$t = str_replace("@$name@", $value, $text);
@@ -854,7 +863,7 @@ function _L($text, $args = array(), $options = array()) {
 		}
 	}
 
-	if (($GLOBALS['test_i18n'] or (_request('var_mode') == 'traduction')) and (!isset($options['class']) or !$options['class'])) {
+	if (($GLOBALS['test_i18n'] or (_request('var_mode') == 'traduction')) and is_null($options['class'])) {
 		return "<span class=debug-traduction-erreur>$text</span>";
 	} else {
 		return $text;
-- 
GitLab