scrutariexport_librealire/scrutariexport_librealire_fonctions.php

32 lines
964 B
PHP
Raw Normal View History

2023-03-02 16:50:30 +01:00
<?php
if (!defined('_ECRIRE_INC_VERSION')) {
return;
}
function filtre_scrutari_attr($texte) {
$result = "";
$array = explode("\n", $texte);
for($i = 0; $i < count($array); $i++) {
$value = trim($array[$i]);
if (strlen($value) > 0) {
$result .= "<val>".$value."</val>\n";
}
}
return $result;
}
function filtre_scrutari_textebrut($texte) {
$u = $GLOBALS['meta']['pcre_u'];
$texte = str_replace("&nbsp;", " ", $texte);
$texte = preg_replace('/\s+/S' . $u, " ", $texte);
$texte = str_replace("<br/>", "\n\n", $texte);
$texte = preg_replace("/<(p|br|li|h[1-6]|dd|dt)( [^>]*)?" . ">/iS", "\n\n", $texte);
$texte = preg_replace("/^\n+/", "", $texte);
$texte = preg_replace("/\n+$/", "", $texte);
$texte = preg_replace("/\n +/", "\n", $texte);
$texte = supprimer_tags($texte);
$texte = filtrer_entites($texte);
$texte = htmlspecialchars($texte, ENT_XML1 | ENT_QUOTES);
return $texte;
}