- ne jamais passer les filtres d'orthotypo sur les balises elle meme (<small> <md> <del> <img ...> <a ...>) : on split le texte selon les balises et on filtre chaque partie ensuite

- classes CSS sur le formulaire de config
- compat SPIP 3.3
svn/root/tags/v1.5.2
cedric@yterium.com 4 years ago
parent e3deb19f0e
commit d0a675321e

@ -9,7 +9,7 @@
<div>
#ACTION_FORMULAIRE{#ENV{action}}
#SET{fl,orthotypo}
<ul>
<ul class="editer-groupe">
#SET{name,guillemets}#SET{obli,''}#SET{defaut,'1'}#SET{erreurs,#ENV**{erreurs}|table_valeur{#GET{name}}}
<li class="editer pleine_largeur editer_[(#GET{name})][ (#GET{obli})][ (#GET{erreurs}|oui)erreur]">[
<span class='erreur_message'>(#GET{erreurs})</span>
@ -80,7 +80,7 @@
<li class="fieldset">
<fieldset>
<legend><:orthotypo:legend_corrections:></legend>
<ul>
<ul class="editer-groupe">
#SET{name,corrections}#SET{obli,''}#SET{defaut,'0'}#SET{erreurs,#ENV**{erreurs}|table_valeur{#GET{name}}}
<li class="editer pleine_largeur editer_[(#GET{name})][ (#GET{obli})][ (#GET{erreurs}|oui)erreur]">[
<span class='erreur_message'>(#GET{erreurs})</span>

@ -100,14 +100,35 @@ function orthotypo_filtre_texte_echappe($texte, $filtre, $balises='', $args=NULL
}
// retour du texte simplement protege
if ($filtre===false) return $texte;
// transformation par $fonction
if (!$args)
$texte = $filtre($texte);
// transformation par $fonction : on split le texte pour ne pas filtrer les <balises ...> ou </balises> html elle meme
if (strpos($texte, "<") !== false
and $parts = preg_split(",(</?\w+>|<\w+\s[^>]*>),Uims",$texte, -1, PREG_SPLIT_DELIM_CAPTURE)) {
for ($i=0;$i<count($parts);$i+=2) {
if ($parts[$i] !== "") {
if (!$args) {
$parts[$i] = $filtre($parts[$i]);
}
else {
array_unshift($args, $parts[$i]);
$parts[$i] = call_user_func_array($filtre, $args);
array_shift($args);
}
}
}
$texte = implode($parts);
}
else {
array_unshift($args,$texte);
$texte = call_user_func_array($filtre, $args);
if (!$args){
$texte = $filtre($texte);
}
else {
array_unshift($args,$texte);
$texte = call_user_func_array($filtre, $args);
}
}
// deprotection des balises
return echappe_retour($texte, 'FILTRETEXTECHAPPE');
}
@ -387,9 +408,6 @@ function orthotypo_exposants_post_typo($texte){
$lang = $GLOBALS['spip_lang'];
}
if(function_exists($fonction = 'orthotypo_exposants_'.lang_typo($lang))){
// prudence : on protege les balises <a> et <img>
if (strpos($texte, '<')!==false)
$texte = preg_replace_callback('/(<(a|img)\s[^>]+>)/Uims', 'orthotypo_exposants_echappe_balises_callback', $texte);
$texte = orthotypo_filtre_texte_echappe($texte,$fonction,'html|code|cadre|frame|script|acronym|cite');
return echappe_retour($texte, 'EXPO');
}

@ -1,9 +1,9 @@
<paquet
prefix="orthotypo"
categorie="edition"
version="1.4.8"
version="1.5.0"
etat="stable"
compatibilite="[3.0.0;3.2.*]"
compatibilite="[3.0.0;3.3.*]"
logo="prive/themes/spip/images/orthotypo-32.png"
documentation="https://contrib.spip.net/Ortho-typographie"
>

Loading…
Cancel
Save