From 2c1088f99d690ac0b0dab27744c52ab737b0ed87 Mon Sep 17 00:00:00 2001 From: Cerdic <cedric@yterium.com> Date: Thu, 25 Oct 2018 08:01:32 +0000 Subject: [PATCH] la fonction echapper_html_suspect() peut etre surchargee par une fonction inc_echapper_html_suspect_dist() dans un plugin, pour traiter specifiquement certains use case --- ecrire/inc/texte_mini.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/ecrire/inc/texte_mini.php b/ecrire/inc/texte_mini.php index 5ba6937535..3f20d17eee 100644 --- a/ecrire/inc/texte_mini.php +++ b/ecrire/inc/texte_mini.php @@ -454,10 +454,24 @@ function echapper_faux_tags($letexte) { * @return string */ function echapper_html_suspect($texte, $strict=true) { - if (!$texte - or strpos($texte, '<') === false or strpos($texte, '=') === false) { + static $echapper_html_suspect; + if (!$texte or !is_string($texte)) { return $texte; } + + if (!isset($echapper_html_suspect)) { + $echapper_html_suspect = charger_fonction('echapper_html_suspect', 'inc', true); + } + // si fonction personalisee, on delegue + if ($echapper_html_suspect) { + return $echapper_html_suspect($texte, $strict); + } + + if (strpos($texte, '<') === false + or strpos($texte, '=') === false) { + return $texte; + } + // quand c'est du texte qui passe par propre on est plus coulant tant qu'il y a pas d'attribut du type onxxx= // car sinon on declenche sur les modeles ou ressources if (!$strict and -- GitLab