*
* @param string $t
* @return string
*/
function detecter_liens_blocs(&$t) {
// si une balise bloc est dans le liens, on y a aussi ajoute un , il suffit donc de detecter ce dernier
if (strpos($t[2], "
") !== false) {
return "" . $t[1] . "" . $t[2] . "
" . $t[3] . "\n";
}
return $t[0];
}
/**
* Callback fermer-para-mano
*
* On refait le preg, à la main
*
* @param string $t
* @return string
*/
function fermer_para_mano(&$t) {
# match: ",
\n<$2$3"
foreach (array('
"
\n", ' "") as $cut => $close) {
if (strpos($t, $cut) !== false) {
foreach (explode($cut, $t) as $c => $p) {
if ($c == 0) {
$t = $p;
} else {
$pi = strtolower($p);
if (preg_match(
",?(?:stop p|" . _BALISES_BLOCS . ")\b,S",
$pi, $r)) {
$pos = strpos($pi, $r[0]);
$t .= $cut . str_replace("\n", _AUTOBR . "\n",
($close ? rtrim(substr($p, 0, $pos)) : substr($p, 0, $pos))) . $close . substr($p, $pos);
} else {
$t .= $cut . $p;
}
}
}
}
}
if (strpos($t, "") !== false) {
$t = str_replace("", "", $t); // pour respecter les non-retour lignes avant
$t = str_replace("", "", $t); // pour respecter les non-retour lignes avant
$t = str_replace("", "\n", $t);
}
if (_AUTOBR) {
$t = str_replace(_AUTOBR . "\n" . "
]*>\s*)' . preg_quote(_AUTOBR . "\n", ',') . ",iS";
$t = preg_replace($reg, '\1' . "\n", $t);
}
return $t;
}