developer.jelix.org is not used any more and exists only for
history. Post new tickets on the Github account.
developer.jelix.org n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.
developer.jelix.org n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.
#1118 closed enhancement (fixed)
html non encodé dans des locales
Reported by: | hadrien | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | Jelix 1.2 beta |
Component: | jelix:plugins:tpl | Version: | 1.1.6 |
Severity: | normal | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Documentation needed: | no | |
Hosting Provider: | Php version: |
Description
voici un patch de function.jlocale.php pour qu'il accepte de ne pas encoder le texte des locales quand elles se terminent par ".html" :
diff --git a/lib/jelix/plugins/tpl/html/function.jlocale.php b/lib/jelix/plugins/tpl/html/function.jlocale.php index 0cfd538..da9caa6 100644 --- a/lib/jelix/plugins/tpl/html/function.jlocale.php +++ b/lib/jelix/plugins/tpl/html/function.jlocale.php @@ -21,14 +21,19 @@ function jtpl_function_html_jlocale($tpl, $locale) { if(func_num_args() == 3 && is_array(func_get_arg(2))){ $param = func_get_arg(2); - echo nl2br(htmlspecialchars(jLocale::get($locale, $param))); + $str = jLocale::get($locale, $param); }elseif(func_num_args() > 2){ $params = func_get_args(); unset($params[0]); unset($params[1]); - echo nl2br(htmlspecialchars(jLocale::get($locale, $params))); + $str = jLocale::get($locale, $params); }else{ - echo nl2br(htmlspecialchars(jLocale::get($locale))); + $str = jLocale::get($locale); + } + if (preg_match('@\.html$@', $locale)){ + echo $str; + }else{ + echo nl2br(htmlspecialchars($str)); } }
Ainsi, text.kikoo = Kikoo <strong>Lol</strong> sera htmlencodé, mais pas text.kikoo.html = Kikoo <strong>Lol</strong>.
Change History (5)
comment:1 Changed 11 years ago by laurentj
- Milestone set to Jelix 1.2 beta
- review changed from review? to review+
comment:2 Changed 11 years ago by laurentj
- Resolution set to fixed
- Status changed from new to closed
comment:3 Changed 11 years ago by hadrien
"Hadrien Lanneau" pour le nom d'auteur ;)
comment:4 Changed 11 years ago by laurentj
- Documentation needed set
comment:5 Changed 10 years ago by foxmask
- Documentation needed unset
Note: See
TracTickets for help on using
tickets.
checked in http://bitbucket.org/jelix/jelix-trunk/changeset/394520a98e0d
thanks for the patch