Prepare a more complete fix for #15016
This commit is contained in:
parent
a4d2927f82
commit
623cb54480
@ -5647,11 +5647,12 @@ function picto_required()
|
||||
* @param integer $removelinefeed 1=Replace all new lines by 1 space, 0=Only ending new lines are removed others are replaced with \n, 2=Ending new lines are removed but others are kept with a same number of \n than nb of <br> when there is both "...<br>\n..."
|
||||
* @param string $pagecodeto Encoding of input/output string
|
||||
* @param integer $strip_tags 0=Use internal strip, 1=Use strip_tags() php function (bugged when text contains a < char that is not for a html tag)
|
||||
* @param integer $removedoublespace Replace double space into one space
|
||||
* @return string String cleaned
|
||||
*
|
||||
* @see dol_escape_htmltag() strip_tags() dol_string_onlythesehtmltags() dol_string_neverthesehtmltags()
|
||||
*/
|
||||
function dol_string_nohtmltag($stringtoclean, $removelinefeed = 1, $pagecodeto = 'UTF-8', $strip_tags = 0)
|
||||
function dol_string_nohtmltag($stringtoclean, $removelinefeed = 1, $pagecodeto = 'UTF-8', $strip_tags = 0, $removedoublespaces = 1)
|
||||
{
|
||||
if ($removelinefeed == 2) $stringtoclean = preg_replace('/<br[^>]*>(\n|\r)+/ims', '<br>', $stringtoclean);
|
||||
$temp = preg_replace('/<br[^>]*>/i', "\n", $stringtoclean);
|
||||
@ -5669,13 +5670,14 @@ function dol_string_nohtmltag($stringtoclean, $removelinefeed = 1, $pagecodeto =
|
||||
|
||||
$temp = dol_html_entity_decode($temp, ENT_COMPAT, $pagecodeto);
|
||||
|
||||
// Supprime aussi les retours
|
||||
// Remove also backspaces
|
||||
if ($removelinefeed == 1) $temp = str_replace(array("\r\n", "\r", "\n"), " ", $temp);
|
||||
|
||||
// et les espaces doubles
|
||||
while (strpos($temp, " "))
|
||||
{
|
||||
$temp = str_replace(" ", " ", $temp);
|
||||
// And double quotes
|
||||
if ($removedoublespaces) {
|
||||
while (strpos($temp, " ")) {
|
||||
$temp = str_replace(" ", " ", $temp);
|
||||
}
|
||||
}
|
||||
|
||||
return trim($temp);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user